Commit Graph

37 Commits

Author SHA1 Message Date
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
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
cjihrig
8302b0add0 test_runner: don't use a symbol for runHook()
This is not exposed to userland, so there is no need to put it
behind a symbol.

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:06 +00:00
Debadree Chatterjee
8541b3a4c0
lib: added SuiteContext class
added SuiteContext class to replace object literal

Fixes: https://github.com/nodejs/node/issues/45641
Refs: https://github.com/nodejs/node/issues/45641#issuecomment-1329130581
PR-URL: https://github.com/nodejs/node/pull/45687
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2022-12-02 06:29:48 +00:00
Wassim Chegham
f8ce9117b1
test_runner: add initial TAP parser
Work in progress

PR-URL: https://github.com/nodejs/node/pull/43525
Refs: https://github.com/nodejs/node/issues/43344
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2022-11-21 22:50:21 +00:00
cjihrig
7c6682957b
test_runner: support function mocking
This commit allows tests in the test runner to mock functions
and methods.

PR-URL: https://github.com/nodejs/node/pull/45326
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2022-11-07 18:25:54 -05: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
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
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
a165193c5c
test_runner: support using --inspect with --test
PR-URL: https://github.com/nodejs/node/pull/44520
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-09-10 17:01:42 +00:00
Moshe Atlow
6ee1f3444f
test_runner: fix duration_ms to be milliseconds
PR-URL: https://github.com/nodejs/node/pull/44450
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2022-09-04 07:06:24 +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
Antoine du Hamel
5e1873e91d
test_runner: refactor to use more primordials
PR-URL: https://github.com/nodejs/node/pull/44062
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
2022-08-04 04:03:28 +00: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
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
Antoine du Hamel
60da0a1b36
test_runner: validate concurrency option
PR-URL: https://github.com/nodejs/node/pull/43976
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-07-26 23:37:41 +01:00
Lenvin Gonsalves
dab492f044
test_runner: add support for boolean values for concurrency option
PR-URL: https://github.com/nodejs/node/pull/43887
Fixes: https://github.com/nodejs/node/issues/43837
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2022-07-24 23:41:46 +02:00
Antoine du Hamel
d83446b4c4
test_runner: validate timeout option
PR-URL: https://github.com/nodejs/node/pull/43843
Reviewed-By: Feng Yu <F3n67u@outlook.com>
2022-07-24 23:11:16 +02: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
Antoine du Hamel
2fe4e9473f
test_runner: protect internals against prototype tampering
PR-URL: https://github.com/nodejs/node/pull/43578
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-07-09 14:02:35 +02: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
LiviaMedeiros
44aa46d705
test_runner: use kEmptyObject
PR-URL: https://github.com/nodejs/node/pull/43159
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-06-11 12:18:15 +02: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
Colin Ihrig
54819f08e0
test_runner: support 'only' tests
This commit introduces a CLI flag and test runner functionality
to support running a subset of tests that are indicated by an
'only' option passed to the test.

PR-URL: https://github.com/nodejs/node/pull/42514
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-04-04 15:14:49 +01:00
cjihrig
432d1b50e0 test: add initial test module
This commit adds a new 'test' module that exposes an API
for creating JavaScript tests. As the tests execute, TAP
output is written to standard output. This commit only supports
executing individual test files, and does not implement
command line functionality for a full test runner.

PR-URL: https://github.com/nodejs/node/pull/42325
Refs: https://github.com/nodejs/node/issues/40954
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-03-21 22:21:09 +00:00