Skip to content

doc: improve docs around running javascript tests #49022

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions doc/contributing/writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,28 @@ request. Interesting things to notice:
exit gracefully. Remember that for a test to succeed, it must exit with a
status code of 0.

## Running tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking this pull request but a suggestion for someone motivated to do it: This PR might contain information that we don't have elsewhere, but we do have "how to run tests" information in both BUILDING.md and doc/contributing/pull-requests.md. Not blocking on this pull request for this, but it would probably be good to consolidate how-to-run-tests info in one place and then put links to the One True Source Of Information in the docs that we remove it from. Part of me wants to suggest putting it all in test/README.md, but any of the places where it exists now would be fine, including the one being created in this PR.


All tests can be executed by running the `jstest` target:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't run all the tests, as its name implies it's only a subset of them.

Suggested change
All tests can be executed by running the `jstest` target:
Running the `jstest` target will execute all the tests for the `node` binary:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is still a catch in this...that internet tests aren't run with make jstest 😂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
All tests can be executed by running the `jstest` target:
Running the `jstest` target will execute all the tests for the `node` binary
except those which require internet access:


```bash
make jstest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
make jstest
make jstest -j12

```

A filter can be applied to only run specific tests:

```bash
make jstest test/parallel/test-debugger-pid.js test/sequential/test-debugger-pid.js test/sequential/test-debugger-launch.mjs
```
Comment on lines +150 to +154
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's true, it runs the full test suite for me.

Suggested change
A filter can be applied to only run specific tests:
```bash
make jstest test/parallel/test-debugger-pid.js test/sequential/test-debugger-pid.js test/sequential/test-debugger-launch.mjs
```
A filter can be applied to only run specific tests:
```bash
./tools/test.py test/parallel/test-debugger-pid.js test/sequential/test-debugger-pid
```


A filter can be applied to skip certain single/multiple test cases:

```bash
make jstest CI_SKIP_TESTS=parallel/test-cluster-bind-privileged-port.js,...
```

Note that test paths must be relative to the project and cannot be absolute file paths.

## General recommendations

### Timers
Expand Down