-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_runner: add support for boolean values for
concurrency
option
PR-URL: #43887 Fixes: #43837 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me>
- Loading branch information
Showing
3 changed files
with
44 additions
and
4 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
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,29 @@ | ||
'use strict'; | ||
require('../common'); | ||
const { describe, it } = require('node:test'); | ||
const assert = require('assert'); | ||
|
||
describe('Concurrency option (boolean) = true ', { concurrency: true }, () => { | ||
let isFirstTestOver = false; | ||
it('should start the first test', () => new Promise((resolve) => { | ||
setImmediate(() => { isFirstTestOver = true; resolve(); }); | ||
})); | ||
it('should start before the previous test ends', () => { | ||
// Should work even on single core CPUs | ||
assert.strictEqual(isFirstTestOver, false); | ||
}); | ||
}); | ||
|
||
describe( | ||
'Concurrency option (boolean) = false ', | ||
{ concurrency: false }, | ||
() => { | ||
let isFirstTestOver = false; | ||
it('should start the first test', () => new Promise((resolve) => { | ||
setImmediate(() => { isFirstTestOver = true; resolve(); }); | ||
})); | ||
it('should start after the previous test ends', () => { | ||
assert.strictEqual(isFirstTestOver, true); | ||
}); | ||
} | ||
); |