Commit Graph

6 Commits

Author SHA1 Message Date
Andreas Kling
5a7853099e LibJS: Support .mjs files in test-js-ast and test-js-bytecode
Automatically pass --as-module to the js binary when the test input
file has a .mjs extension. This allows us to write AST and bytecode
tests for module-only syntax like import and export statements.
2026-02-19 12:02:50 +01:00
Andreas Kling
06f7abe00f Tests/LibJS: Add test-js-bytecode --rebaseline 2026-02-17 20:44:57 +01:00
Andreas Kling
273c657a88 Tests/LibJS: Use local build's js binary in test-js-bytecode
Instead of hardcoding the path to Build/debug/bin/js, detect the build
directory from the script's location. The script is copied to
bin/test-js-bytecode during build, so the build directory is one level
up from the script.

This allows the bytecode tests to run correctly regardless of which
build preset is being used.
2026-01-27 10:58:39 +01:00
Jelle Raaijmakers
fa59cb17fb Tests/LibJS: Report number of tests run in test-js-bytecode.py 2026-01-22 07:46:48 -05:00
Jelle Raaijmakers
e3faa9b5ad LibJS: Move tests to /Tests/LibJS 2026-01-22 07:46:48 -05:00
dosisod
bc823878c7 LibJS: Add bytecode IR regression tests
This adds a new `test-js-bytecode` target which ensures that codegen
changes do not impact emitted bytecode IR, or if it does, it is known
and the tests are updated accordingly.

Similar to the LibWeb tests, the tests are stored in the following
format:

* `Libraries/LibJS/Bytecode/Tests/input`: Input `.js` files
* `Libraries/LibJS/Bytecode/Tests/expected`: Expected `.txt` bytecode
* `Libraries/LibJS/Bytecode/Tests/output`: Emitted `.txt` bytecode

The `output` dir is git-ignored, but stores the output so you can diff
and inspect failed tests more easily.

There is only one test so far, which is a baseline test that should not
change dramatically unless we change the bytecode output format.
2026-01-22 08:44:24 +01:00