Skip to content

Commit

Permalink
Merge branch 'enable-strict-mode' into improve-test-runner
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanjtc committed Nov 10, 2023
2 parents 478a103 + 44bae0d commit acb899a
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 11 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Typecheck

on: [push, pull_request]

jobs:
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: '18.x'

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Type check
run: yarn tsc

3 changes: 0 additions & 3 deletions src/csf/__snapshots__/transformCsf.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,6 @@ exports[`transformCsf calls the beforeEachPrefixer function once 1`] = `
},
},
};
export const Primary = () => '<button>Primary</button>';
Expand Down Expand Up @@ -1163,7 +1162,6 @@ exports[`transformCsf calls the testPrefixer function for each test 1`] = `
},
},
};
export const Primary = () => '<button>Primary</button>';
Expand Down Expand Up @@ -1302,7 +1300,6 @@ exports[`transformCsf executes beforeEach code before each test 1`] = `
},
},
};
export const Primary = () => '<button>Primary</button>';
Expand Down
4 changes: 0 additions & 4 deletions src/csf/transformCsf.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe('transformCsf', () => {
},
},
};
export const Primary = () => '<button>Primary</button>';
`;

Expand All @@ -52,7 +51,6 @@ describe('transformCsf', () => {
},
},
};
export const Primary = () => '<button>Primary</button>';
`;
const result = transformCsf(csfCode, { testPrefixer, beforeEachPrefixer: undefined });
Expand All @@ -73,7 +71,6 @@ describe('transformCsf', () => {
},
},
};
export const Primary = () => '<button>Primary</button>';
`;

Expand All @@ -95,7 +92,6 @@ describe('transformCsf', () => {
},
},
};
export const Primary = () => '<button>Primary</button>';
`;
const beforeEachPrefixer = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/test-storybook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ process.on('unhandledRejection', (err) => {

const log = (message: string) => console.log(`[test-storybook] ${message}`);
const error = (err: Error) => {
if (err) {
if (err instanceof Error) {
console.error(`\x1b[31m[test-storybook]\x1b[0m ${err.message} \n\n${err.stack}`);
} else {
console.error(`\x1b[31m[test-storybook]\x1b[0m ${err}`);
Expand Down
10 changes: 8 additions & 2 deletions src/util/getCliOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,17 @@ describe('getCliOptions', () => {

it('handles extra arguments correctly', () => {
jest.spyOn(cliHelper, 'getParsedCliOptions').mockReturnValue({
options: { version: true, cache: false, coverageDirectory: './test' },
options: { version: true, cache: false, env: 'node' },
extraArgs: ['--watch', '--coverage'],
});
const opts = getCliOptions();
expect(opts.jestOptions).toEqual(['--version', '--no-cache', '--watch', '--coverage']);
expect(opts.jestOptions).toEqual([
'--version',
'--no-cache',
'--env="node"',
'--watch',
'--coverage',
]);
});

it('returns extra args if passed', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/util/getStorybookMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join } from 'path';
import { normalizeStories, getProjectRoot } from '@storybook/core-common';
import { getStorybookMain } from './getStorybookMain';
import type { StoriesEntry } from '@storybook/types';
import { StoriesEntry } from '@storybook/types';

export const getStorybookMetadata = () => {
const workingDir = getProjectRoot();
Expand Down

0 comments on commit acb899a

Please sign in to comment.