Files
Citadel-Station-13-RP/tgui/docs/writing-tests.md
Zandario ed27a01b58 Massive backend updoot: Juke Build, TGUI upgrades, Soft Ping, and too much to list! (#3990)
* Time to become our TGUI God.

* Visually sprucing the copyrights.

These shouldn't be ignored :)

* babababa

* https://github.com/tgstation/tgstation/pull/50422

* dooootdooot

* Holy fuck

Updates the tools folder
Updates our build tooling
Updates TGUI MASSIVELY
I'm going to go scream in a hole now

* ??

* Was it this dum thing?

* orrrr

* It's this isn't it

* Did it manually

* hubah

* TGUI Changelog

* oops

* What if I use the original?

* Lets try this again

* Shit commenting out for now

* asdasd

* Fuck it use the old one and remember to replace later

* Updates yarn.lock

* Lets try something horrid

* Nope it HATES THAT

* fucc

* The great eslinting

* HOLY SHIT

* Final?

* ?

* asd

tgstation/tgstation/pull/59914
tgstation/tgstation/pull/66317

* Improved Asset handling.

* Oops

* Subsystem stuff

* Recompiles the Changelong again.

* Finally Fixed Communicators

* Compiled Changelogs... AGAIN
2022-05-09 18:02:09 -07: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.