Moshe Atlow
c9e72e34ab
test_runner: accept testOnly
in run
...
PR-URL: https://github.com/nodejs/node/pull/49753
Fixes: https://github.com/nodejs/node/issues/49733
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Raz Luvaton <rluvaton@gmail.com>
2023-09-24 10:46:13 +00:00
Moshe Atlow
a4c7f81241
test_runner: catch reporter errors
...
PR-URL: https://github.com/nodejs/node/pull/49646
Fixes: https://github.com/nodejs/node/issues/48937
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2023-09-21 23:22:21 +03:00
Moshe Atlow
22907ce366
test_runner: add junit reporter
...
PR-URL: https://github.com/nodejs/node/pull/49614
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2023-09-14 08:43:53 +00:00
Caio Borghi
4efa3744a0
test_runner: add jsdocs to mock.js
...
PR-URL: https://github.com/nodejs/node/pull/49555
Reviewed-By: Erick Wendel <erick.workspace@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-09-14 04:24:39 +00:00
Deokjin Kim
b3fc9173ed
lib: use internal fileURLToPath
...
For internal usage, `internal/url` should be used.
Refs: https://github.com/nodejs/node/pull/49553
PR-URL: https://github.com/nodejs/node/pull/49558
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Raz Luvaton <rluvaton@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2023-09-10 14:57:37 +00:00
Erick Wendel
a61bc9d933
test_runner: fix invalid timer call
...
Signed-off-by: Erick Wendel <erick.workspace@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/49477
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-09-05 21:17:28 +00:00
Erick Wendel
f139cc3ee8
test_runner: add jsdocs to MockTimers
...
Signed-off-by: Erick Wendel <erick.workspace@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/49476
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-09-05 16:53:07 +00:00
Moshe Atlow
47c5152545
test_runner: fix typescript coverage
...
PR-URL: https://github.com/nodejs/node/pull/49406
Fixes: https://github.com/nodejs/node/issues/49398
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2023-09-04 21:45:07 +00:00
Erick Wendel
8e82cfcbb3
test_runner: preserve original property descriptor
...
PR-URL: https://github.com/nodejs/node/pull/49433
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Raz Luvaton <rluvaton@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-09-03 19:08:26 +00:00
Erick Wendel
c750049318
test_runner: add support for setImmediate
...
PR-URL: https://github.com/nodejs/node/pull/49397
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2023-08-31 06:42:03 +00:00
Phil Nash
3a6a80a4e1
test_runner: report covered lines, functions and branches to reporters
...
This is a breaking change for the format of test:coverage events. But
the test coverage is still experimental, so I don't believe it requires
a semver-major bump.
Fixes https://github.com/nodejs/node/issues/49303
PR-URL: https://github.com/nodejs/node/pull/49320
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-08-30 20:22:45 +00:00
Colin Ihrig
b5740756ca
test_runner: reland run global after() hook earlier
...
This commit reverts the revert in
bb52656fc6
. It also includes the
fix for the issue that required the revert
(https://github.com/nodejs/node/pull/49059#issuecomment-1675171959 )
and an additional common.mustCall() in the added test.
Refs: https://github.com/nodejs/node/pull/49059
Refs: https://github.com/nodejs/node/pull/49110
PR-URL: https://github.com/nodejs/node/pull/49116
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-08-14 14:29:29 +00:00
Joyee Cheung
bb52656fc6
Revert "test_runner: run global after() hook earlier"
...
This reverts commit 6346bdc526
.
Reason for revert: breaking CI
PR-URL: https://github.com/nodejs/node/pull/49110
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-08-12 04:19:05 +00:00
cjihrig
6346bdc526
test_runner: run global after() hook earlier
...
This commit moves the global after() hook execution from the
'beforeExit' event to the point where all tests have finished
running. This gives the global after() a chance to clean up
handles that would otherwise prevent the 'beforeExit' event
from being emitted.
PR-URL: https://github.com/nodejs/node/pull/49059
Fixes: https://github.com/nodejs/node/issues/49056
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-08-11 09:16:51 -04:00
cjihrig
4e61c22699
test_runner: expose location of tests
...
This commit adds each test's line and column number to the reporter
output. This will aid in debugging test suite failures when error
stacks are not helpful, test suites are large, or tests have the
same name. This data is also exposed on the spec reporter.
This commit also replaces the filename that was previously being
reported, with the filename where the test actually exists. These
are normally correct, but could be wrong if tests were run from
a file other than the user's entrypoint.
PR-URL: https://github.com/nodejs/node/pull/48975
Fixes: https://github.com/nodejs/node/issues/48457
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-08-11 09:12:49 -04:00
Raz Luvaton
c58e8fc31f
test_runner: fix global after not failing the tests
...
PR-URL: https://github.com/nodejs/node/pull/48913
Fixes: https://github.com/nodejs/node/issues/48867
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-08-02 20:06:25 +00:00
Raz Luvaton
88094bba3c
test_runner: fix timeout in *Each hook failing further tests
...
PR-URL: https://github.com/nodejs/node/pull/48925
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-07-31 22:13:02 +00:00
Raz Luvaton
7a33f2b88d
test_runner: cleanup test timeout abort listener
...
fix #48475
PR-URL: https://github.com/nodejs/node/pull/48915
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-07-31 08:10:36 +00:00
Moshe Atlow
a955c534a8
test_runner: dont set exit code on todo tests
...
PR-URL: https://github.com/nodejs/node/pull/48929
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-07-29 20:45:16 +00:00
Moshe Atlow
040865c648
test_runner: fix todo and only in spec reporter
...
PR-URL: https://github.com/nodejs/node/pull/48929
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-07-29 20:45:16 +00:00
Colin Ihrig
bef3942820
test_runner: unwrap error message in TAP reporter
...
The TAP reporter unwraps errors that come from user code. It
was not properly unwrapping the error message when the failure
originated from a test hook. This lead to difficult to debug
errors when TAP output was used. This commit updates the TAP
reporter to properly unwrap the error message.
Fixes: https://github.com/nodejs/node/issues/48941
PR-URL: https://github.com/nodejs/node/pull/48942
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-07-29 18:36:55 +00:00
Raz Luvaton
ee391f3781
test_runner: add __proto__
null
...
PR-URL: https://github.com/nodejs/node/pull/48663
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-07-29 13:22:16 +00:00
Moshe Atlow
48345d0f62
watch: decrease debounce rate
...
PR-URL: https://github.com/nodejs/node/pull/48926
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2023-07-27 20:39:14 +00:00
Moshe Atlow
b814de6d77
watch: use debounce instead of throttle
...
PR-URL: https://github.com/nodejs/node/pull/48926
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2023-07-27 20:39:13 +00:00
Raz Luvaton
a0f3ed8ac4
test_runner: fix global before not called when no global test exists
...
PR-URL: https://github.com/nodejs/node/pull/48877
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-07-24 11:38:23 +00:00
Raz Luvaton
44b8a061df
test_runner: fix async callback in describe not awaited
...
PR-URL: https://github.com/nodejs/node/pull/48856
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-07-23 10:22:35 +00:00
Raz Luvaton
24c3d8a1b3
test_runner: call abort on test finish
...
PR-URL: https://github.com/nodejs/node/pull/48827
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2023-07-21 12:53:58 +00:00
Raz Luvaton
99881304c4
test_runner: add shards support
...
PR-URL: https://github.com/nodejs/node/pull/48639
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-07-05 03:57:28 +00:00
Shocker
d312bd96d3
test_runner: fixed test
shorthands return type
...
`test.todo`, `test.only` and `test.skip` are expected to return the
same as `test`. This commit corrects the inconsistent behavior of
these shorthands.
Fixes: https://github.com/nodejs/node/issues/48557
PR-URL: https://github.com/nodejs/node/pull/48555
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-07-03 09:04:11 +00:00
Benjamin Gruenbaum
1683e6030e
test: add Symbol.dispose support to mock timers
...
PR-URL: https://github.com/nodejs/node/pull/48549
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Erick Wendel <erick.workspace@gmail.com>
2023-06-29 07:45:44 +00:00
Moshe Atlow
7cd4e70948
test_runner: support passing globs
...
PR-URL: https://github.com/nodejs/node/pull/47653
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-06-25 14:40:34 +00:00
Chemi Atlow
78f6952751
fs: use kResistStopPropagation
...
PR-URL: https://github.com/nodejs/node/pull/48521
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-06-24 15:52:38 +00:00
Erick Wendel
da80964a3d
test_runner: add initial draft for fakeTimers
...
Signed-off-by: Erick Wendel <erick.workspace@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/47775
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-06-22 04:01:52 +00:00
Moshe Atlow
8bc6e193a0
test_runner: add enqueue and dequeue events
...
PR-URL: https://github.com/nodejs/node/pull/48428
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-06-13 18:33:43 +00:00
Moshe Atlow
c21fe3ad87
test_runner: make --test-name-pattern
recursive
...
PR-URL: https://github.com/nodejs/node/pull/48382
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2023-06-11 15:02:18 +00:00
Damien Seguin
23c7f65ead
test_runner: refactor coverage report output for readability
...
Add a "table" parameter to getCoverageReport.
Keep the tap coverage output intact.
Change the output by adding padding and truncating the tables' cells.
Add separation lines for table head/body/foot.
Group uncovered lines as ranges.
Add yellow color for coverage between 50 and 90.
Refs: https://github.com/nodejs/node/pull/46674
PR-URL: https://github.com/nodejs/node/pull/47791
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-06-07 09:08:27 +00:00
Moshe Atlow
5c27cc2afb
test_runner: apply runOnly
on suites
...
PR-URL: https://github.com/nodejs/node/pull/48279
Fixes: https://github.com/nodejs/node/issues/47937
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-06-05 00:05:34 +03:00
Moshe Atlow
5d685e4198
test_runner: emit test
⌚ drained event
...
PR-URL: https://github.com/nodejs/node/pull/48259
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-06-02 00:28:09 +00:00
Moshe Atlow
ca71ae6549
test_runner: stop watch mode when abortSignal aborted
...
PR-URL: https://github.com/nodejs/node/pull/48259
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-06-02 00:28:08 +00:00
Moshe Atlow
5e98a74327
test_runner: fix global after hook
...
PR-URL: https://github.com/nodejs/node/pull/48231
Fixes: https://github.com/nodejs/node/issues/48230
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2023-05-31 15:33:30 +00:00
Colin Ihrig
b47fce0762
test_runner: remove redundant check from coverage
...
The code coverage reporting logic already filters out URLs that
don't start with 'file:', so there is no need to also filter
out URLs that start with 'node:'.
PR-URL: https://github.com/nodejs/node/pull/48070
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
2023-05-29 04:47:21 +00:00
Moshe Atlow
e74465d678
test_runner: pass FORCE_COLOR to child process
...
PR-URL: https://github.com/nodejs/node/pull/48057
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-05-25 10:49:39 +00:00
Moshe Atlow
40a7a055c6
test_runner: dont split lines on test:stdout
...
PR-URL: https://github.com/nodejs/node/pull/48057
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-05-25 10:49:38 +00:00
Moshe Atlow
f0e70eede2
test_runner: fix test deserialize edge cases
...
PR-URL: https://github.com/nodejs/node/pull/48106
Fixes: https://github.com/nodejs/node/issues/48103
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-05-23 21:03:19 +00:00
Shiba
1229a22e51
test_runner: delegate stderr and stdout formatting to reporter
...
Introduce new `TestsStream` events `test:stderr` and `test:stdout`
to delegate `stderr` and `stdout` (e.g. `console.log()`) formatting
to the reporter. And patch existing reporters to:
- Spec: output the message as it is
- TAP: stay the same with existing `test:diagnostic`
PR-URL: https://github.com/nodejs/node/pull/48045
Fixes: https://github.com/nodejs/node/issues/48011
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2023-05-23 04:44:48 +00:00
Raz Luvaton
7e0c12fd56
test_runner: display dot report as wide as the terminal width
...
PR-URL: https://github.com/nodejs/node/pull/48038
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2023-05-23 04:44:38 +00:00
Moshe Atlow
05693acb15
lib: support FORCE_COLOR for non TTY streams
...
PR-URL: https://github.com/nodejs/node/pull/48034
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-05-18 12:36:38 +00:00
Benjamin Gruenbaum
3cf05be50e
test: fix suite signal
...
PR-URL: https://github.com/nodejs/node/pull/47800
Fixes: https://github.com/nodejs/node/issues/47882
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-05-17 08:57:21 +00:00
Moshe Atlow
7116bc08d7
test_runner: use v8.serialize instead of TAP
...
PR-URL: https://github.com/nodejs/node/pull/47867
Fixes: https://github.com/nodejs/node/issues/44656
Fixes: https://github.com/nodejs/node/issues/47955
Fixes: https://github.com/nodejs/node/issues/47481
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-05-15 14:27:45 +00:00
Chemi Atlow
8b3777d0c8
test_runner: add shorthands to test
...
PR-URL: https://github.com/nodejs/node/pull/47909
Fixes: https://github.com/nodejs/node/issues/47897
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-05-15 05:23:22 +00:00