-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: add enqueue and dequeue events #48428
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 | ||||
---|---|---|---|---|---|---|
|
@@ -1461,6 +1461,16 @@ object, streaming a series of events representing the execution of the tests. | |||||
|
||||||
Emitted when code coverage is enabled and all tests have completed. | ||||||
|
||||||
### Event: `'test:dequeue'` | ||||||
|
||||||
* `data` {Object} | ||||||
* `file` {string|undefined} The path of the test file, | ||||||
undefined if test is not ran through a file. | ||||||
* `name` {string} The test name. | ||||||
* `nesting` {number} The nesting level of the test. | ||||||
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. Nit
Suggested change
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.
|
||||||
|
||||||
Emitted when a test is dequeued, right before it is executed. | ||||||
|
||||||
### Event: `'test:diagnostic'` | ||||||
|
||||||
* `data` {Object} | ||||||
|
@@ -1471,6 +1481,16 @@ Emitted when code coverage is enabled and all tests have completed. | |||||
|
||||||
Emitted when [`context.diagnostic`][] is called. | ||||||
|
||||||
### Event: `'test:enqueue'` | ||||||
|
||||||
* `data` {Object} | ||||||
* `file` {string|undefined} The path of the test file, | ||||||
undefined if test is not ran through a file. | ||||||
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. What are you trying to say here? "will not run" in this (and above) perhaps? 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. I think running within REPL is the main example of this. Il refine this in a follow-up |
||||||
* `name` {string} The test name. | ||||||
* `nesting` {number} The nesting level of the test. | ||||||
|
||||||
Emitted when a test is enqueued for execution. | ||||||
|
||||||
### Event: `'test:fail'` | ||||||
|
||||||
* `data` {Object} | ||||||
|
@@ -1520,7 +1540,9 @@ Emitted when all subtests have completed for a given test. | |||||
* `name` {string} The test name. | ||||||
* `nesting` {number} The nesting level of the test. | ||||||
|
||||||
Emitted when a test starts. | ||||||
Emitted when a test starts reporting its own and its subtests status. | ||||||
This event is guaranteed to be emitted in the same order as the tests are | ||||||
defined. | ||||||
|
||||||
### Event: `'test:stderr'` | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,7 +97,7 @@ describe('node:test reporters', { concurrency: true }, () => { | |
testFile]); | ||
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. Would be useful to also test the arguments |
||
assert.strictEqual(child.stderr.toString(), ''); | ||
const stdout = child.stdout.toString(); | ||
assert.match(stdout, /{"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/); | ||
assert.match(stdout, /{"test:enqueue":5,"test:dequeue":5,"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/); | ||
assert.strictEqual(stdout.slice(0, filename.length + 2), `${filename} {`); | ||
}); | ||
}); | ||
|
@@ -109,7 +109,7 @@ describe('node:test reporters', { concurrency: true }, () => { | |
assert.strictEqual(child.stderr.toString(), ''); | ||
assert.match( | ||
child.stdout.toString(), | ||
/^package: reporter-cjs{"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/, | ||
/^package: reporter-cjs{"test:enqueue":5,"test:dequeue":5,"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/, | ||
); | ||
}); | ||
|
||
|
@@ -120,7 +120,7 @@ describe('node:test reporters', { concurrency: true }, () => { | |
assert.strictEqual(child.stderr.toString(), ''); | ||
assert.match( | ||
child.stdout.toString(), | ||
/^package: reporter-esm{"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/, | ||
/^package: reporter-esm{"test:enqueue":5,"test:dequeue":5,"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":\d+}$/, | ||
); | ||
}); | ||
|
||
|
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.
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.
this exact terminology is used in 6 other places in this file, so I will fix it in a follow-up PR