-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(read-config): allow multiple projects with programmatic usage (#1…
- Loading branch information
Showing
8 changed files
with
84 additions
and
8 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
9 changes: 9 additions & 0 deletions
9
e2e/__tests__/__snapshots__/runProgrammaticallyMultipleProjects.test.ts.snap
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`run programmatically with multiple projects: summary 1`] = ` | ||
Test Suites: 2 passed, 2 total | ||
Tests: 2 passed, 2 total | ||
Snapshots: 0 total | ||
Time: <<REPLACED>> | ||
Ran all test suites in 2 projects. | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import {resolve} from 'path'; | ||
import {wrap} from 'jest-snapshot-serializer-raw'; | ||
import stripAnsi = require('strip-ansi'); | ||
import {extractSummary, run} from '../Utils'; | ||
|
||
const dir = resolve(__dirname, '../run-programmatically-multiple-projects'); | ||
|
||
test('run programmatically with multiple projects', () => { | ||
const {stderr, exitCode} = run(`node run-jest.js`, dir); | ||
const {summary} = extractSummary(stripAnsi(stderr)); | ||
expect(exitCode).toEqual(0); | ||
expect(wrap(summary)).toMatchSnapshot('summary'); | ||
}); |
10 changes: 10 additions & 0 deletions
10
e2e/run-programmatically-multiple-projects/client/client.test.js
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
describe('client', () => { | ||
it('should work', () => {}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "runcli-multiple-projects", | ||
"version": "1.0.0", | ||
"dependencies": {}, | ||
"jest": {} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const {runCLI} = require('@jest/core'); | ||
|
||
const config = { | ||
projects: [ | ||
{testMatch: ['<rootDir>/client/**/*.test.js']}, | ||
{testMatch: ['<rootDir>/server/**/*.test.js']}, | ||
], | ||
}; | ||
|
||
runCLI({config: JSON.stringify(config)}, [process.cwd()]) | ||
.then(() => console.log('run-programmatically-mutiple-projects completed')) | ||
.catch(err => { | ||
console.error(err); | ||
process.exitCode = 1; | ||
}); |
10 changes: 10 additions & 0 deletions
10
e2e/run-programmatically-multiple-projects/server/server.test.js
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
describe('server', () => { | ||
it('should work', () => {}); | ||
}); |
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