KScript docs
EN

Testing

Running tests

kscript test with no paths runs every test file in the current project: the folder of the nearest kscript.json, or the current folder if there isn't one. Folders whose names start with ., and node_modules, bin and obj, are skipped. You may also name folders and files, or pick tests by name:

CommandWhat it does
kscript testThe project's tests a change can affect.
kscript test --allEvery test in the project.
kscript test --failedOnly the tests that failed last time.
kscript test --changedThe tests your uncommitted changes can affect.
kscript test --changed masterThe tests this branch's changes can affect.
kscript test --watchRun the affected tests each time you save.
kscript test tests/cart tests/api.test.kscriptA folder and a file.
kscript test --filter "cart › adds"Only tests whose full name contains the text (any case)
kscript test --timeout 30Seconds per test (0: no limit)
kscript test --junit test-results.xmlAlso write a JUnit XML report.

kscript tests/cart.test.kscript runs one file too.

Colours are used when the output is a terminal; set NO_COLOR to turn them off or FORCE_COLOR to keep them. Ctrl+C stops the run after the current test.

--junit writes the results in the JUnit XML format that GitHub Actions reporters, GitLab, Jenkins and Azure Pipelines can show. A failed check is a <failure>, another error is an <error>, and a file that couldn't run is reported as an <error> on a test named (load).