Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.12.0 #335

Merged
merged 14 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @yannbf @kasperpeulen
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,14 @@ test:
- name: Testing storybook
run: yarn test-storybook --coverage --shard=${{ matrix.shard }}/${{ strategy.job-total }}
- name: Renaming coverage file
uses: mv coverage/storybook/coverage-storybook.json coverage/storybook/coverage-storybook-${matrix.shard}.json
run: mv coverage/storybook/coverage-storybook.json coverage/storybook/coverage-storybook-${matrix.shard}.json
report-coverage:
name: Reporting storybook coverage
steps:
- name: Merging coverage
uses: yarn nyc merge coverage/storybook merged-output/merged-coverage.json
run: yarn nyc merge coverage/storybook merged-output/merged-coverage.json
- name: Report coverage
uses: yarn nyc report --reporter=text -t merged-output --report-dir merged-output
run: yarn nyc report --reporter=text -t merged-output --report-dir merged-output
```

Circle CI example:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"build:watch": "tsup --watch",
"test": "jest",
"storybook": "storybook dev -p 6006",
"start": "concurrently \"yarn build:watch\" \"yarn storybook -- --no-manager-cache --quiet\"",
"start": "concurrently \"yarn build:watch\" \"yarn storybook -- --quiet\"",
"build-storybook": "storybook build",
"release": "yarn build && auto shipit",
"test-storybook": "node dist/test-storybook",
Expand Down
2 changes: 1 addition & 1 deletion src/test-storybook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function reportCoverage() {

const onProcessEnd = () => {
cleanup();
if (process.env.STORYBOOK_COLLECT_COVERAGE !== 'true') {
if (process.env.STORYBOOK_COLLECT_COVERAGE === 'true') {
reportCoverage();
}
};
Expand Down
18 changes: 17 additions & 1 deletion src/util/getCliOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@ import { getCliOptions } from './getCliOptions';
import * as cliHelper from './getParsedCliOptions';

describe('getCliOptions', () => {
let originalArgv: string[] = process.argv;

afterEach(() => {
process.argv = originalArgv;
});

it('returns custom options if passed', () => {
const customConfig = { configDir: 'custom', indexJson: true };
jest
.spyOn(cliHelper, 'getParsedCliOptions')
.mockReturnValue({ options: customConfig, extraArgs: [] });
.mockReturnValueOnce({ options: customConfig, extraArgs: [] });
const opts = getCliOptions();
expect(opts.runnerOptions).toMatchObject(customConfig);
});

it('returns extra args if passed', () => {
const extraArgs = ['TestName', 'AnotherTestName'];
// mock argv to avoid side effect from running tests e.g. jest --coverage,
// which would end up caught by getCliOptions
process.argv = [];
jest.spyOn(cliHelper, 'getParsedCliOptions').mockReturnValueOnce({ options: {}, extraArgs });
const opts = getCliOptions();
expect(opts.jestOptions).toEqual(extraArgs);
});
});
6 changes: 2 additions & 4 deletions src/util/getCliOptions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { getParsedCliOptions } from './getParsedCliOptions';
import type { BrowserType } from 'jest-playwright-preset';

export type JestOptions = {
[key: string]: any;
};
export type JestOptions = string[];

export type CliOptions = {
runnerOptions: {
Expand Down Expand Up @@ -63,7 +61,7 @@ export const getCliOptions = (): CliOptions => {
}, defaultOptions);

if (extraArgs.length) {
finalOptions.jestOptions.push(...[extraArgs]);
finalOptions.jestOptions.push(...extraArgs);
}

return finalOptions;
Expand Down
Loading