Some tests use projects as inputs, e.g.,
animation.tests.ts
component.tests.ts
mesh.tests.ts
scene.test.ts
scene-gltf.test.ts
Those projects are required to be built before the tests can run.
First reach the test
folder:
cd ./test
You can then build all projects using:
npm run build -- path/to/wonderlandeditor-binary
Each projects deploy/
will be copied into test/resources/projects
.
To run all the end-to-end tests from the api root, use:
npm run test:e2e -- --deploy path/to/wonderland/deploy
It's required to pass the Wonderland Editor deploy folder as a CLI argument using
the --deploy
argument.
If no such flag is passed, the test framework will assume
that the deploy folder is located in ../../deploy
.
npm run test:e2e
is a shortcut for:
cd test-2e2
npm run test
To run the tests in a file, use:
npm run test:e2e -- [PATH] --deploy path/to/wonderland/deploy
Example with the component file:
npm run test:e2e -- component.test.ts --deploy path/to/wonderland/deploy
Note: Since test:e2e forwards the npm script to the test package, paths are relative to the test folder, and not to the api root.
It's possible to watch one/multiple test(s) using --watch
:
npm run test:e2e -- --deploy path/to/wonderland/deploy --watch
The runner uses Mocha, which supports filtering tests using regexp.
You can provide a regexp using --grep
or -g
:
npm run test:e2e -- -g 'MeshComponent'
The grep
flag can be mixed with the positional file argument:
npm run test:e2e -- component.test.ts -g 'MeshComponent'
This command will only run the tests matching the "MeshComponent" string in the test/component.test.ts
file.
Wonderland Engine API TypeScript and JavaScript code is released under MIT license. The runtime and editor are licensed under the Wonderland Engine EULA