ladybird/Base/usr/share/man/man1/test-js.md
kleines Filmröllchen 98c0c5e9e6 Help+Base: Add help://man URLs for links between man pages
The URLs of the form `help://man/<section>/<page>` link to another help
page inside the help application. All previous relative page links are
replaced by this new form. This doesn't change any behavior but it looks
much nicer :^)

Note that man doesn't handle these new links, but the previous relative
links didn't work either.
2022-01-11 00:24:57 +01:00

1.3 KiB

Name

test-js - run the LibJS test suite

Synopsis

$ test-js [options...] [path]

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 (see test-common.js).

It also supports the test262 parser tests.

The test root directory is assumed to be /home/anon/js-tests, or $SERENITY_SOURCE_DIR/Userland/Libraries/LibJS/Tests 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.

Options

  • -t, --show-time: Show duration of each test
  • -g, --collect-often: Collect garbage after every allocation
  • --test262-parser-tests: Run test262 parser tests

Examples

A very simple test looks like this:

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