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>
24 lines
600 B
Markdown
24 lines
600 B
Markdown
# JavaScript tests with expected output
|
|
|
|
Tests in `test/message` pass if the output matches the expected output.
|
|
Message tests are particularly useful when checking for exact error messages.
|
|
|
|
Tests and their expected output must have the same filename, with the `.js` and
|
|
`.out` extension.
|
|
|
|
```
|
|
foo.js
|
|
foo.out
|
|
```
|
|
|
|
You can use a regex in the expected output instead of the exact
|
|
path:
|
|
|
|
```
|
|
*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a'
|
|
```
|
|
|
|
Empty lines are ignored in the comparison, but whitespaces are not.
|
|
|
|
Exact details of the test runner are in [testcfg.py](testcfg.py).
|