-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test using the 6.4 canary of the test runner
- Loading branch information
Showing
2 changed files
with
106 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,31 +17,16 @@ export const testRunner: Task = { | |
|
||
// We could split this out into a separate task if it became annoying | ||
const publishController = await servePackages({}); | ||
await exec(`yarn add --dev @storybook/test-runner jest-junit`, execOptions); | ||
|
||
// Note we could split this out into a separate task too. We sort of do by checking if the file exists | ||
const testFilePathname = join(sandboxDir, 'test-runner-jest.config.js'); | ||
if (junitFilename && !(await pathExistsSync(testFilePathname))) { | ||
await exec(`yarn test-storybook --eject`, execOptions); | ||
const testFile = await readFile(testFilePathname, 'utf8'); | ||
|
||
const reporters = `reporters: [ | ||
'default', | ||
['jest-junit', { | ||
outputDirectory: '${junitFilename}', | ||
addFileAttribute: 'true', | ||
usePathForSuiteName: 'true', | ||
uniqueOutputName: 'true' }, | ||
], | ||
],`; | ||
|
||
const newTestFile = testFile.replace(/}\s*$/m, `${reporters}$&`); | ||
await writeFile(testFilePathname, newTestFile); | ||
} | ||
await exec(`yarn add --dev @storybook/[email protected]`, execOptions); | ||
|
||
const storybookController = await serveSandbox(builtSandboxDir, {}); | ||
|
||
await exec(`yarn test-storybook --url http://localhost:8001`, execOptions); | ||
await exec(`yarn test-storybook --url http://localhost:8001 --junit`, { | ||
...execOptions, | ||
env: { | ||
JEST_JUNIT_OUTPUT_FILE: junitFilename, | ||
}, | ||
}); | ||
|
||
publishController.abort(); | ||
storybookController.abort(); | ||
|