mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-09 22:05:57 +00:00
e4e1431c55
* First take on running the tests inside an Electron render process * Making progress * Making it possible to override the location of the admin token * Ignoreing the realm-object-server files * Fixing a console.log to return a string instead of a boolean But it should probably be removed entirely * Making the downloaded ROS log less * Adjusting comments in the test.sh * Checking number of windows to determine an Electron crash * Added a test that triggers garbage collection of ArrayBuffers * Enabled the ability to run the tests in Electrons main process * Run tests first in main process and the render * Added a README.md that documents how Electron tests can be run * Added a comment on why the garbage-collection test was added. * Waiting with reading the admin token, until it is actually used * Disabling the GarbageCollectionTests for now
41 lines
1.6 KiB
Markdown
41 lines
1.6 KiB
Markdown
# Realm JS tests running in an Electron enviroment
|
|
|
|
Currently this directory consists of:
|
|
- An electron app in `tests/electron/app` which has
|
|
- `jasmine.js` that imports the jasmin lib, setup a console logger and exports an execute function.
|
|
- `main.js` which starts a hidden `BrowserWindow` and either runs the tests itself (see --main flag below) or lets
|
|
the render process do the heavy lifting.
|
|
- `renderer.js` detects if it's supposed to run the tests and does that using the `jasmine.js`.
|
|
- `spec.js` in which imports and executes the tests exported by `tests/js/index.js`.
|
|
- A `test/electron/runner.js` script, which uses [spectron](https://www.npmjs.com/package/spectron) to start the Electron app and read out the console from the Electron process, and console logging it.
|
|
|
|
## Flags
|
|
|
|
To use these flags, you need to prepend them when calling `npm test` after the `--`, which indicates that the flag is
|
|
not ment for npm.
|
|
|
|
### Process
|
|
|
|
You can specify in which Electron process to run the tests:
|
|
- `--process=main` for the main process or
|
|
- `--process=render` the render process (which is default)
|
|
|
|
As an example, this runs all tests in the main process:
|
|
|
|
npm test -- --process=main
|
|
|
|
### Filter
|
|
|
|
If you want to run only a subset of the tests, use the `--filter` flag, ex:
|
|
|
|
As an example, this runs only the suite named "UserTests":
|
|
|
|
npm test -- --filter=UserTests
|
|
|
|
## Failing tests
|
|
|
|
These tests are failing at the moment:
|
|
- SessionTests (because REALM_MODULE_PATH is missing, due to `tests/spec/helpers` not loading correctly.
|
|
- AsyncTests (because of the same reason as SessionTests)
|
|
- GarbageCollectionTests (due to a bug that I'll be reporting soon)
|