summaryrefslogtreecommitdiff
path: root/Userland/test-js.cpp
AgeCommit message (Collapse)Author
2020-09-27LibJS: Remove use of Interpreter& in JSONObject codeAndreas Kling
2020-09-27LibJS: Make native function/property callbacks take VM, not InterpreterAndreas Kling
More work on decoupling the general runtime from Interpreter. The goal is becoming clearer. Interpreter should be one possible way to execute code inside a VM. In the future we might have other ways :^)
2020-09-27LibJS: Move most of Interpreter into VMAndreas Kling
This patch moves the exception state, call stack and scope stack from Interpreter to VM. I'm doing this to help myself discover what the split between Interpreter and VM should be, by shuffling things around and seeing what falls where. With these changes, we no longer have a persistent lexical environment for the current global object on the Interpreter's call stack. Instead, we push/pop that environment on Interpreter::run() enter/exit. Since it should only be used to find the global "this", and not for variable storage (that goes directly into the global object instead!), I had to insert some short-circuiting when walking the environment parent chain during variable lookup. Note that this is a "stepping stone" commit, not a final design.
2020-09-21LibJS: Rename InterpreterScope => InterpreterExecutionScopeAndreas Kling
To make it a little clearer what this is for. (This is an RAII helper class for adding and removing an Interpreter to a VM's list of the currently active (executing code) Interpreters.)
2020-09-20LibJS+Clients: Add JS::VM object, separate Heap from InterpreterAndreas Kling
Taking a big step towards a world of multiple global object, this patch adds a new JS::VM object that houses the JS::Heap. This means that the Heap moves out of Interpreter, and the same Heap can now be used by multiple Interpreters, and can also outlive them. The VM keeps a stack of Interpreter pointers. We push/pop on this stack when entering/exiting execution with a given Interpreter. This allows us to make this change without disturbing too much of the existing code. There is still a 1-to-1 relationship between Interpreter and the global object. This will change in the future. Ultimately, the goal here is to make Interpreter a transient object that only needs to exist while you execute some code. Getting there will take a lot more work though. :^) Note that in LibWeb, the global JS::VM is called main_thread_vm(), to distinguish it from future worker VM's.
2020-09-09test-js: Catch SIGINFO and dump the current test name + pass/fail/skipAndreas Kling
This is pretty handy if the JS tests take a long time to run and you wonder what they're doing. :^)
2020-09-09test-js: Add -g option to run a garbage collection on each allocationAndreas Kling
This is very slow, but very good at flushing out GC bugs. :^)
2020-08-30Tests: Optionally switch off 858081 lines of dbg() in test-jsBen Wiederhake
2020-08-28Userland: Stop passing ignored timezones to gettimeofdayNico Weber
2020-08-26LibJS: Add a helper for calling JS::Function's with argumentsAnotherTest
The fact that a `MarkedValueList` had to be created was just annoying, so here's an alternative. This patchset also removes some (now) unneeded MarkedValueList.h includes.
2020-08-23test-js+test-web: Clear taskbar progress on error/assertion failureLuke
Closes #3240
2020-08-22test-js: Sometimes include more details for failuresNico Weber
LibJS doesn't store stacks for exception objects, so this only amends test-common.js's __expect() with an optional `details` function that can produce a more detailed error message, and it lets test-js.cpp read and print that error message. I added the optional details parameter to a few matchers, most notably toBe() where it now prints expected and actual value. It'd be nice to have line numbers of failures, but that seems hard to do with the current design, and this is already much better than the current state.
2020-08-22test-js: Print parse error if test-common.js fails to parseNico Weber
2020-08-12Test: Mark compilation-unit-only functions as staticBen Wiederhake
This enables a nice warning in case a function becomes dead code. Also, in the case of test-crypto.cpp, I took the liberty to add the prefix 'g_' to the global event loop.
2020-07-07test-js: Show progress in taskbarLinus Groh
This was a nice feature the old run-tests.sh script had - let's add it to test-js as well! :^)
2020-07-06test-js: Use Core::File::is_directory(path) instead of opening fileAndreas Kling
2020-07-06test-js: Remove tests_to_run in favor of a DirIteratorMatthew Olsson
2020-07-06LibJS: Convert Array tests to new testing frameworkLinus Groh
2020-07-06LibJS: Convert all remaining non-Array tests to the new system :)Matthew Olsson
2020-07-06LibJS: Convert remaining top-level tests to new systemMatthew Olsson
2020-07-06test-js: Only print files with failed or skipped testsMatthew Olsson
This does not affect output when the "-t" flag is specified -- all files will still be printed in that case.
2020-07-06test-js: Display messages from console.log in test outputMatthew Olsson
This will help greatly with debugging!
2020-07-06test-js: Only parse test-common.js onceMatthew Olsson
2020-07-06test-js: Print duration of each test when given '-t' flagMatthew Olsson
2020-07-06test-js: Allow skipping tests with "test.skip(name, callback)"Matthew Olsson
Skipped tests count as a "pass" rather than a "fail" (i.e. a test suite with a skipped test will pass), however it does display a message when the test is printing. This is intended for tests which _should_ work, but currently do not. This should be preferred over "// FIXME" notes if possible.
2020-07-06test-js: Remove run-tests.shMatthew Olsson
The shell script is no longer necessary -- simply run "test-js" from inside Serenity, or $SERENITY_ROOT/Build/Meta/Lagom/test-js from the host.
2020-07-06LibJS/test-js: Clean up test-js codeMatthew Olsson
This commit also exposes JSONObject's implementation of stringify to the public, so that it can be used by test-js without having to go through the interpreter's environment.
2020-07-06LibJS: Convert most builtin tests to new systemMatthew Olsson
2020-07-06LibJS: Convert Reflect object tests to new testing frameworkLinus Groh
2020-07-06LibJS: Convert Proxy testsMatthew Olsson
2020-07-06LibJS: Add test-common.js tests, remove unused matchersMatthew Olsson
Now that test-common.js is quite a bit more complicated, we need tests for test-common to make sure all of the matchers behave correctly
2020-07-06LibJS: Convert some top-level tests to the new systemMatthew Olsson
First test conversions! These look really good :)
2020-07-06LibJS/test-js: Create test-js program, prepare for test suite refactorMatthew Olsson
This moves most of the work from run-tests.sh to test-js.cpp. This way, we have a lot more control over how the test suite runs, as well as how it outputs. This should result in some cool functionality! This commit also refactors test-common.js to mimic the jest library. This should allow tests to be much more expressive :)