ladybird/Base/usr/share/man/man1/test-js.md

47 lines
1.3 KiB
Markdown
Raw Normal View History

2020-07-06 23:47:48 +01:00
## Name
test-js - run the LibJS test suite
## Synopsis
```**sh
2020-10-18 22:02:01 +01:00
$ test-js [options...] [path]
2020-07-06 23:47:48 +01:00
```
## Description
`test-js` runs the LibJS test suite located in `/home/anon/js-tests`. These
tests are using a custom JavaScript testing framework inspired by
[Jest](https://jestjs.io) (see [`test-common.js`](/home/anon/js-tests/test-common.js)).
2020-07-06 23:47:48 +01:00
2020-10-18 22:02:01 +01:00
It also supports the [test262 parser tests](https://github.com/tc39/test262-parser-tests).
The test root directory is assumed to be `/home/anon/js-tests`, or `$SERENITY_SOURCE_DIR/Userland/Libraries/LibJS/Tests`
2020-10-18 22:02:01 +01:00
when using the Lagom build. Optionally you can pass a custom path to `test-js` to override these defaults.
You can disable output from `dbgln()` calls by setting the `DISABLE_DBG_OUTPUT` environment variable.
2020-10-18 22:02:01 +01:00
2020-07-06 23:47:48 +01:00
## Options
* `-t`, `--show-time`: Show duration of each test
2020-10-18 22:02:01 +01:00
* `-g`, `--collect-often`: Collect garbage after every allocation
* `--test262-parser-tests`: Run test262 parser tests
2020-07-06 23:47:48 +01:00
## Examples
A very simple test looks like this:
```js
describe("Examples from Gary Bernhardt's 'Wat' talk", () => {
test("Na na na na na na na na na na na na na na na na Batman!", () => {
expect(Array(16).join("wat" - 1) + " Batman!").toBe(
"NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman!"
);
});
});
```
## See also
* [`js`(1)](js.md)