Files
Bubberstation/tgui/docs/writing-tests.md
SkyratBot 259c30097e [MIRROR] tgui: API improvements + docs [MDB IGNORE] (#12862)
* tgui: API improvements + docs

* fix

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com>
2022-04-19 18:58:13 +01:00

619 B

Jest

You can now write and run unit tests in tgui.

It's quite simple: create a file ending in .test.ts or .spec.ts (usually with the same filename as the file you're testing), and create a test case:

test('something', () => {
  expect('a').toBe('a');
});

Refer to README to learn how to run tests.

There is an example test in packages/common/react.spec.ts.

You can read more about Jest here: https://jestjs.io/docs/en/getting-started

Note, that there is still no real solution to test UIs for now, even though a lot of the support is here (jest + jsdom). That will come later.