-
-
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.
feat: add support for snapshot matchers in concurrent tests
- Loading branch information
Showing
9 changed files
with
121 additions
and
19 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import {skipSuiteOnJasmine} from '@jest/test-utils'; | ||
import runJest from '../runJest'; | ||
|
||
skipSuiteOnJasmine(); | ||
|
||
test('Snapshots get correct names in concurrent tests', () => { | ||
const result = runJest('snapshot-concurrent', ['--ci']); | ||
expect(result.exitCode).toBe(0); | ||
}); |
21 changes: 21 additions & 0 deletions
21
e2e/snapshot-concurrent/__tests__/__snapshots__/works.test.js.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,21 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`A a 1`] = `"Aa1"`; | ||
|
||
exports[`A a 2`] = `"Aa2"`; | ||
|
||
exports[`A b 1`] = `"Ab1"`; | ||
|
||
exports[`A b 2`] = `"Ab2"`; | ||
|
||
exports[`A c 1`] = `"Ac1"`; | ||
|
||
exports[`A c 2`] = `"Ac2"`; | ||
|
||
exports[`B 1`] = `"B1"`; | ||
|
||
exports[`B 2`] = `"B2"`; | ||
|
||
exports[`C 1`] = `"C1"`; | ||
|
||
exports[`C 2`] = `"C2"`; |
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,40 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
'use strict'; | ||
|
||
const sleep = ms => new Promise(r => setTimeout(r, ms)); | ||
|
||
describe('A', () => { | ||
it.concurrent('a', async () => { | ||
await sleep(100); | ||
expect('Aa1').toMatchSnapshot(); | ||
expect('Aa2').toMatchSnapshot(); | ||
}); | ||
|
||
it.concurrent('b', async () => { | ||
await sleep(10); | ||
expect('Ab1').toMatchSnapshot(); | ||
expect('Ab2').toMatchSnapshot(); | ||
}); | ||
|
||
it.concurrent('c', async () => { | ||
expect('Ac1').toMatchSnapshot(); | ||
expect('Ac2').toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
it.concurrent('B', async () => { | ||
await sleep(10); | ||
expect('B1').toMatchSnapshot(); | ||
expect('B2').toMatchSnapshot(); | ||
}); | ||
|
||
it.concurrent('C', async () => { | ||
expect('C1').toMatchSnapshot(); | ||
expect('C2').toMatchSnapshot(); | ||
}); |
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,5 @@ | ||
{ | ||
"jest": { | ||
"testEnvironment": "node" | ||
} | ||
} |
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
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