-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_runner: allow nesting test within describe #46544
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -2,7 +2,7 @@ | |||
'use strict'; | ||||
require('../common'); | ||||
const assert = require('node:assert'); | ||||
const { describe, it } = require('node:test'); | ||||
const { describe, it, test } = require('node:test'); | ||||
const util = require('util'); | ||||
|
||||
|
||||
|
@@ -41,6 +41,8 @@ it('async pass', async () => { | |||
|
||||
}); | ||||
|
||||
test('mixing describe/it and test should work', () => {}); | ||||
|
||||
it('async throw fail', async () => { | ||||
throw new Error('thrown from async throw fail'); | ||||
}); | ||||
|
@@ -95,6 +97,7 @@ describe('subtest sync throw fail', () => { | |||
it('+sync throw fail', () => { | ||||
throw new Error('thrown from subtest sync throw fail'); | ||||
}); | ||||
test('mixing describe/it and test should work', () => {}); | ||||
}); | ||||
|
||||
it('sync throw non-error fail', async () => { | ||||
|
@@ -106,7 +109,7 @@ describe('level 0a', { concurrency: 4 }, () => { | |||
const p1a = new Promise((resolve) => { | ||||
setTimeout(() => { | ||||
resolve(); | ||||
}, 1000); | ||||
}, 100); | ||||
}); | ||||
|
||||
return p1a; | ||||
|
@@ -124,7 +127,7 @@ describe('level 0a', { concurrency: 4 }, () => { | |||
const p1c = new Promise((resolve) => { | ||||
setTimeout(() => { | ||||
resolve(); | ||||
}, 2000); | ||||
}, 200); | ||||
}); | ||||
|
||||
return p1c; | ||||
|
@@ -134,7 +137,7 @@ describe('level 0a', { concurrency: 4 }, () => { | |||
const p1c = new Promise((resolve) => { | ||||
setTimeout(() => { | ||||
resolve(); | ||||
}, 1500); | ||||
}, 150); | ||||
}); | ||||
|
||||
return p1c; | ||||
|
@@ -143,7 +146,7 @@ describe('level 0a', { concurrency: 4 }, () => { | |||
const p0a = new Promise((resolve) => { | ||||
setTimeout(() => { | ||||
resolve(); | ||||
}, 3000); | ||||
}, 300); | ||||
}); | ||||
|
||||
return p0a; | ||||
|
@@ -309,12 +312,12 @@ describe('describe async throw fails', async () => { | |||
describe('timeouts', () => { | ||||
it('timed out async test', { timeout: 5 }, async () => { | ||||
return new Promise((resolve) => { | ||||
setTimeout(resolve, 1000); | ||||
setTimeout(resolve, 100); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should these setTimeouts use common platform timeout machinery or are you convinced there is no/little flakiness potential here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have already changed these values in the equivalent node/test/message/test_runner_output.js Line 116 in 5092346
|
||||
}); | ||||
}); | ||||
|
||||
it('timed out callback test', { timeout: 5 }, (done) => { | ||||
setTimeout(done, 1000); | ||||
setTimeout(done, 100); | ||||
}); | ||||
|
||||
|
||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can't we use
??
here?