UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

65 lines (46 loc) 1.92 kB
/* Siesta 5.6.1 Copyright(c) 2009-2022 Bryntum AB https://bryntum.com/contact https://bryntum.com/products/siesta/license */ Role('Siesta.Project.Browser.Automation.NodeJS', { has : { isNodeJS : false }, override : { initialize : function () { if (typeof process != 'undefined') { this.isAutomated = true this.isNodeJS = true } this.SUPERARG(arguments) }, setup : function () { if (this.isNodeJS && typeof AS_LAUNCHER != 'undefined') { this.SUPER(function () { var path = require('path') var requireInContext = require("./src/nodejs/util/helper/RequireInContext.js").requireInContext //---- // relative to CanRequireInContext file var _launcher_ = requireInContext('../../../../bin/siesta-launcher-all.js') var launcher = new _launcher_.Siesta.Launcher.NodeJS({ args : [ path.resolve(__dirname, './bin'), 'NOT_USED' ].concat(process.argv.slice(1)) }) launcher.start().then(function (exitCode) { launcher.exit(exitCode) }) }) } else { var indexFile = process.argv[ 1 ] if (this.chdirToIndex) { var path = require('path') process.chdir(path.dirname(indexFile)) } this.scopeProvider = 'Scope.Provider.NodeJsEmbed' this.SUPERARG(arguments) } if (typeof process != 'undefined') { this.transparentEx = true } } } })