Issue
Currently, there is a limitation to the usage of tests as only 1 test per file can be created to test actions within the runtime. This is due to the following. Hence, only 1 runtime can be initialised per thread. Due to how cargo tests are run serially(with --test-threads=1
) and in parallel, this means only 1 runtime can be initialised per executable, which requires 1 file per test.
It is currently not possible to initialize SpiderMonkey multiple times (that is, calling JS_Init/JSAPI methods/JS_ShutDown in that order, then doing so again). This restriction may eventually be lifted.
Finding a solution to this will improve flexibility for future tests with more complex modules, and JSAPI wrappers.
Currently, I have a draft of tests for the fs
module, but I am not satisfied with them, as putting them all in a singular function partially defeats the purpose of such tests, as they are not targeted. With this improvement, each portion of the fs
module can then be tested independently, and properly utilise cargo's test system, with many tests and test cases.
Requirements
- Advanced Understanding of Rust, static values and cargo tests
- Intermediate Understanding of JavaScript
- Understanding of Spidermonkey Runtime and Engine initialisation
Possible Solution
thread_local
or Mutex
could be used to store the ParentRuntime
and Runtime::create_with_parent
could be used to create the appropriate runtimes.
Type: Help Wanted Tests