siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
50 lines (37 loc) • 1.94 kB
text/typescript
// Exit codes:
// 0 - all tests passed
// 1 - there were test failures
// 2 - inactivity timeout while running the test suite
// 3 - no supported browsers available on this machine
// 4 - no tests to run (probably `include` doesn't match any test url or `exclude` match anything)
// 5 - can't open project page
// 6 - wrong arguments
// 7 - exception thrown
// 8 - exit after printing version
// 9 - java is not installed or not available in PATH
const path = require('path')
const argv = process.argv.slice(2)
const Module = require('module')
// this weirdly looking line activates the `patched` flag in `Module` module
// and forces the loader to use `vm.runInThisContext` - required after Node 10.5
Module.wrap = Module.wrap
if (argv[ 0 ] == 'AS_CONNECTOR') {
const {LogLevel} = require("./src/generic/util/role/CanLog.js")
const {NodeJsPageChildEndPoint} = require("./src/nodejs/launcher/NodeJsPageRpcClient.js")
const CLIENT = new NodeJsPageChildEndPoint({ logLevel : LogLevel.debug })
CLIENT.connect()
let _project_ = CLIENT.projectContext
_project_.SCOPE = global
_project_.PROJECT_REQUIRE = require("esm")(module)
module.exports = _project_.Siesta
} else {
const {requireInContext} = require("./src/nodejs/util/helper/RequireInContext.js")
//----
// pass own `require` function to use file names, relative to this index file itself
// otherwise, file names should be relative to `CanRequireInContext` file
let _project_ = requireInContext('./siesta-nodejs-all.js', null, require)
_project_.AS_LAUNCHER = true
_project_.SCOPE = global
_project_.PROJECT_REQUIRE = require("esm")(module)
module.exports = _project_.Siesta
}