Commit Graph

317 Commits

Author SHA1 Message Date
Moshe Atlow
d1eaded0d1
test_runner: count nested tests
PR-URL: https://github.com/nodejs/node/pull/47094
Fixes: https://github.com/nodejs/node/issues/46762
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-03-21 08:16:38 +00:00
cjihrig
3d63d5333d
test_runner: handle errors not bound to tests
This commit addresses a previously untested branch of the code.
It is possible when using the test runner that an error occurs
outside of a test. In this case, the test runner would simply
rethrow the error. This commit updates the logic to handle the
error in the same fashion as other uncaughtExceptions.

PR-URL: https://github.com/nodejs/node/pull/46962
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2023-03-07 13:59:47 -05:00
Moshe Atlow
ca033c16fe
test_runner: align behavior of it and test
PR-URL: https://github.com/nodejs/node/pull/46889
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2023-03-05 09:42:29 +02:00
Moshe Atlow
a37b72da87
test_runner: avoid running twice tests in describe
PR-URL: https://github.com/nodejs/node/pull/46888
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-03-03 07:27:16 +02:00
Moshe Atlow
c7e6a0c1b1
test_runner: fix reconstruction of errors extracted from YAML
PR-URL: https://github.com/nodejs/node/pull/46872
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2023-03-01 22:16:39 +00:00
Richie McColl
0093fd3ca8
test_runner: add describe.only and it.only shorthands
PR-URL: https://github.com/nodejs/node/pull/46604
Fixes: https://github.com/nodejs/node/issues/46562
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-02-21 22:28:03 +00:00
Richie McColl
c90ea9301b
test_runner: emit test-only diagnostic warning
PR-URL: https://github.com/nodejs/node/pull/46540
Fixes: https://github.com/nodejs/node/issues/46448
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-02-21 08:39:17 +00:00
Richie McColl
261bf9652b
test_runner: display skipped tests in spec reporter output
PR-URL: https://github.com/nodejs/node/pull/46651
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2023-02-18 22:36:08 +00:00
Moshe Atlow
3354f89dcf
test_runner: flatten TAP output when running using --test
PR-URL: https://github.com/nodejs/node/pull/46440
Fixes: https://github.com/nodejs/node/issues/45833
Refs: https://github.com/nodejs/node/issues/45833
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-02-18 16:19:24 +00:00
Moshe Atlow
2787e2dfc2
test_runner: allow nesting test within describe
PR-URL: https://github.com/nodejs/node/pull/46544
Fixes: https://github.com/nodejs/node/issues/46478
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-02-17 13:42:01 +00:00
Moshe Atlow
1118db718c
test_runner: fix missing test diagnostics
PR-URL: https://github.com/nodejs/node/pull/46450
Fixes: https://github.com/nodejs/node/issues/45911
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-02-02 20:00:06 +00:00
Pulkit Gupta
61c65b066b
test_runner: top-level diagnostics not ommited when running with --test
PR-URL: https://github.com/nodejs/node/pull/46441
Fixes: https://github.com/nodejs/node/issues/45910
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-02-02 10:42:43 +00:00
Antoine du Hamel
ac66a99cf1
test: add trailing commas in test/message
PR-URL: https://github.com/nodejs/node/pull/46372
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-01-29 19:15:22 +01:00
Pulkit Gupta
2f38c74e26
test: fix tap escaping with and without --test
PR-URL: https://github.com/nodejs/node/pull/46311
Fixes: https://github.com/nodejs/node/issues/45836
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-01-28 21:07:47 +00:00
Moshe Atlow
a1b27b25bb
test_runner: add reporters
PR-URL: https://github.com/nodejs/node/pull/45712
Fixes: https://github.com/nodejs/node/issues/45648
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-12-19 17:35:57 +00:00
Colin Ihrig
385d595a4f
test_runner: run t.after() if test body throws
This commit fixes a bug where t.after() was not called if the
test body threw an exception.

PR-URL: https://github.com/nodejs/node/pull/45870
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2022-12-17 06:36:15 +00:00
Moshe Atlow
232efb06fe
test_runner: parse yaml
PR-URL: https://github.com/nodejs/node/pull/45815
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-12-13 14:51:35 +00:00
Pulkit Gupta
22dc987fde
test: fix invalid output TAP if there newline in test name
PR-URL: https://github.com/nodejs/node/pull/45742
Fixes: https://github.com/nodejs/node/issues/45396
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2022-12-11 20:02:37 +00:00
cjihrig
215c5317d4 test_runner: add t.after() hook
This commit adds an after() hook to the TestContext class. This
hook can be used to clean up after a test finishes.

PR-URL: https://github.com/nodejs/node/pull/45792
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2022-12-11 19:19:07 +00:00
Jithil P Ponnan
3759935ee2
test_runner: fix afterEach not running on test failures
test_runner: fix afterEach not running on test failures

PR-URL: https://github.com/nodejs/node/pull/45204
Fixes: https://github.com/nodejs/node/issues/45192
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2022-11-07 05:58:39 +00:00
Moshe Atlow
3e57891ee2
test_runner: report tap subtest in order
PR-URL: https://github.com/nodejs/node/pull/45220
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-10-30 15:36:35 +02:00
Colin Ihrig
a69a30016c
test_runner: call {before,after}Each() on suites
Prior to this commit, beforeEach() and afterEach() hooks were
not called on test suites (describe()). This commit addresses that.

Fixes: https://github.com/nodejs/node/issues/45028
PR-URL: https://github.com/nodejs/node/pull/45161
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-10-27 08:27:35 +00:00
Bryan English
e260b373f1
test_runner: add extra fields in AssertionError YAML
Many TAP reporters offer special-case handling of YAML objects
containing `expected`, `actual`, and `operator` fields, as produced by
`AssertionError` and similar userland Error classes.

PR-URL: https://github.com/nodejs/node/pull/44952
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-10-26 04:00:13 +00:00
cjihrig
87170c3f92
test_runner: add --test-name-pattern CLI flag
This commit adds support for running tests that match a
regular expression.

Fixes: https://github.com/nodejs/node/issues/42984
2022-10-04 09:15:02 -04:00
Alan Agius
e6018e2864
lib: don't match sourceMappingURL in strings
Prior to this change `sourceMappingURL` in string where being matched
by the RegExp which caused sourcemaps not be loaded when using the
`--enable-source-maps` flag. This commit changes the RegExp to match
the last occurrence.

Fixes: https://github.com/nodejs/node/issues/44654
PR-URL: https://github.com/nodejs/node/pull/44658
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-09-26 00:11:18 +08:00
Moshe Atlow
cb7e0c59df
test_runner: include stack of uncaught exceptions
PR-URL: https://github.com/nodejs/node/pull/44614
Fixes: https://github.com/nodejs/node/issues/44611
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-09-14 19:28:18 +00:00
Moshe Atlow
59527de13d test_runner: support programmatically running --test
PR-URL: https://github.com/nodejs/node/pull/44241
Fixes: https://github.com/nodejs/node/issues/44023
Fixes: https://github.com/nodejs/node/issues/43675
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-08-24 15:54:44 +03:00
Moshe Atlow
0d46cf6af8
test_runner: fix test runner hooks failure stack
PR-URL: https://github.com/nodejs/node/pull/44284
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-08-20 23:31:23 +00:00
Geoffrey Booth
d6e626d54c
test: remove cjs loader from stack traces
PR-URL: https://github.com/nodejs/node/pull/44197
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2022-08-14 21:59:02 +00:00
legendecas
0a2c910ae9
src,lib: print prinstine source when source map source not found
Print unmapped source lines when the source map source is not
found. Error stacks should be correctly mapped even when the
source is absent.

PR-URL: https://github.com/nodejs/node/pull/44052
Refs: https://github.com/nodejs/node/pull/44019
Reviewed-By: Ben Coe <bencoe@gmail.com>
2022-08-06 19:56:27 +08:00
Moshe Atlow
8cf33850be
test_runner: verbous error when entire test tree is canceled
PR-URL: https://github.com/nodejs/node/pull/44060
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-08-02 06:52:41 +01:00
Moshe Atlow
5ec2d7bc5d
test_runner: empty pending tests queue post running
PR-URL: https://github.com/nodejs/node/pull/44059
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-07-31 12:53:06 +01:00
Moshe Atlow
af0921d877
esm: add --import flag
PR-URL: https://github.com/nodejs/node/pull/43942
Fixes: https://github.com/nodejs/node/issues/40110
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-07-31 04:08:02 +01:00
Moshe Atlow
659dc12693 test_runner: add before/after/each hooks
PR-URL: https://github.com/nodejs/node/pull/43730
Fixes: https://github.com/nodejs/node/issues/43403
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-07-30 23:10:51 +03:00
Moshe Atlow
a3e110820f
test_runner: fix top level describe queuing
PR-URL: https://github.com/nodejs/node/pull/43998
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-07-28 10:54:09 +01:00
legendecas
803a7b2b23
src,lib: print source map error source on demand
The source context is not prepended to the value of the `stack` property
when the source map is not enabled. Rather than prepending the error
source context to the value of the `stack` property unconditionally,
this patch aligns the behavior and only prints the source context when
the error is not handled by userland (e.g. fatal errors).

Also, this patch fixes that when source-map support is enabled, the
error source context is not pointing to where the error was thrown.

PR-URL: https://github.com/nodejs/node/pull/43875
Fixes: https://github.com/nodejs/node/issues/43186
Fixes: https://github.com/nodejs/node/issues/41541
Reviewed-By: Ben Coe <bencoe@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2022-07-28 08:09:30 +08:00
Moshe Atlow
2e682f10b6
test_runner: pass signal on timeout
PR-URL: https://github.com/nodejs/node/pull/43911
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-07-24 15:16:10 +01:00
Moshe Atlow
389b7e138e
test_runner: recieve and pass AbortSignal
PR-URL: https://github.com/nodejs/node/pull/43554
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-07-20 13:32:58 +01:00
Moshe Atlow
a3766bc8a8
test_runner: fix it concurrency
PR-URL: https://github.com/nodejs/node/pull/43757
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Jacob Smith <jacob@frende.me>
2022-07-15 16:52:13 +01:00
Moshe Atlow
c1d659591d
test_runner: support timeout for tests
PR-URL: https://github.com/nodejs/node/pull/43505
Refs: https://github.com/nodejs/node/issues/43490
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2022-07-14 09:11:42 +01:00
Moshe Atlow
3aec7da5c6
test_runner: catch errors thrown within describe
PR-URL: https://github.com/nodejs/node/pull/43729
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-07-12 16:16:40 +02:00
legendecas
02eb10b87b
lib,src: add source map support for global eval
Dynamic sources with FunctionConstructor is not supported yet as
V8 prepends lines to the sources which makes the stack line number
incorrect.

PR-URL: https://github.com/nodejs/node/pull/43428
Refs: https://github.com/nodejs/node/issues/43047
Reviewed-By: Ben Coe <bencoe@gmail.com>
2022-07-11 21:44:04 +08:00
Antoine du Hamel
a276bd87ab
test: fix typo in file name
`desctibe` -> `describe`

PR-URL: https://github.com/nodejs/node/pull/43764
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-07-11 10:26:56 +02:00
Livia Medeiros
653cfff223
util: add AggregateError.prototype.errors to inspect output
PR-URL: https://github.com/nodejs/node/pull/43646
Fixes: https://github.com/nodejs/node/issues/43645
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-07-09 17:01:02 +01:00
Moshe Atlow
1523a1817e
test_runner: cancel on termination
PR-URL: https://github.com/nodejs/node/pull/43549
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2022-07-08 11:17:44 +01:00
Moshe Atlow
e2225ba8e1 test_runner: expose describe and it
PR-URL: https://github.com/nodejs/node/pull/43420
Refs: https://github.com/nodejs/node/issues/43415
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-06-29 12:31:47 +03:00
Moshe Atlow
5fadc389b8
test_runner: add Subtest to tap protocol output
PR-URL: https://github.com/nodejs/node/pull/43417
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2022-06-19 08:58:48 +01:00
MURAKAMI Masahiko
8cbc39068c
test: improve lib/internal/test_runner/test.js coverage
PR-URL: https://github.com/nodejs/node/pull/42745
Refs: https://coverage.nodejs.org/coverage-24adba675179ebba/lib/internal/test_runner/test.js.html#L371
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-04-27 22:42:56 +01:00
Colin Ihrig
adaf602405
test_runner: add initial CLI runner
This commit introduces an initial version of a CLI-based
test runner.

PR-URL: https://github.com/nodejs/node/pull/42658
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-04-15 18:37:28 +01:00
Michaël Zasso
d49df5ca8d
test: adapt message tests for V8 10.2
There are some changes for function names in stack traces.

PR-URL: https://github.com/nodejs/node/pull/42657
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2022-04-12 22:11:17 +02:00