-
-
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.
- Loading branch information
1 parent
9d167c6
commit f650b5f
Showing
3 changed files
with
166 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`runs the tests in the correct order 1`] = ` | ||
" console.log | ||
[[beforeAll]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test one start]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test three start]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test five start]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test six start]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test seven (fails) start]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test three end]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test eight start]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test one end]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test nine start]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test six end]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test ten (fails) start]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test eight end]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test nine end]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[test five end]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
console.log | ||
[[afterAll]] | ||
at log (__tests__/concurrent.test.js:12:29) | ||
" | ||
`; |
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,24 @@ | ||
/** | ||
* 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, {json as runWithJson} from '../runJest'; | ||
|
||
skipSuiteOnJasmine(); | ||
|
||
it('runs the correct number of tests', () => { | ||
const {json} = runWithJson('circus-concurrent', ['concurrent.test.js']); | ||
|
||
expect(json.numTotalTests).toBe(10); | ||
expect(json.numPassedTests).toBe(6); | ||
expect(json.numFailedTests).toBe(2); | ||
expect(json.numPendingTests).toBe(2); | ||
}); | ||
|
||
it('runs the tests in the correct order', () => { | ||
const {stdout} = runJest('circus-concurrent', ['concurrent.test.js']); | ||
expect(stdout).toMatchSnapshot(); | ||
Check failure on line 23 in e2e/__tests__/circusConcurrent.test.ts GitHub Actions / Node LTS on Ubuntu with coverage (3/4)runs the tests in the correct order
|
||
}); |
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,58 @@ | ||
/** | ||
* 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 {setTimeout} = require('timers/promises'); | ||
|
||
const marker = s => console.log(`[[${s}]]`); | ||
|
||
beforeAll(() => marker('beforeAll')); | ||
afterAll(() => marker('afterAll')); | ||
|
||
beforeEach(() => marker('beforeEach')); | ||
afterEach(() => marker('afterEach')); | ||
|
||
const testFn = (name, delay, fail) => { | ||
return async () => { | ||
marker(`test ${name} start`); | ||
await setTimeout(delay); | ||
if (fail) { | ||
throw new Error(`${name} failed`); | ||
} | ||
expect(name).toBe(name); | ||
expect.assertions(1); | ||
marker(`test ${name} end`); | ||
}; | ||
}; | ||
|
||
it.concurrent('one', testFn('one', 100)); | ||
it.concurrent.skip('two (skipped)', testFn('two (skipped)', 100)); | ||
|
||
describe('level 1', () => { | ||
beforeEach(() => marker('beforeEach level 1')); | ||
afterEach(() => marker('afterEach level 1')); | ||
|
||
it.concurrent('three', testFn('three', 60)); | ||
|
||
it.concurrent.skip('four (skipped)', testFn('four (skipped)', 100)); | ||
|
||
describe('level 2', () => { | ||
beforeEach(() => marker('beforeEach level 2')); | ||
afterEach(() => marker('afterEach level 2')); | ||
it.concurrent('five', testFn('five', 150)); | ||
|
||
it.concurrent('six', testFn('six', 100)); | ||
}); | ||
|
||
it.concurrent('seven (fails)', testFn('seven (fails)', 100, true)); | ||
it.concurrent('eight', testFn('eight', 50)); | ||
}); | ||
|
||
it.concurrent('nine', testFn('nine', 20)); | ||
|
||
it.concurrent('ten (fails)', testFn('ten (fails)', 30, true)); |