mirror of
https://github.com/hanzoai/Detox.git
synced 2026-09-24 16:55:12 +00:00
38 lines
991 B
JavaScript
38 lines
991 B
JavaScript
const detox = require('../internals');
|
|
|
|
const TestRunnerCommand = require('./testCommand/TestRunnerCommand');
|
|
const patchJestUtil = require('./utils/patchJestUtil');
|
|
|
|
module.exports.command = 'test';
|
|
module.exports.desc = 'Run your test suites with the test runner specified in the project\'s Detox config';
|
|
module.exports.builder = require('./testCommand/builder');
|
|
module.exports.middlewares = require('./testCommand/middlewares').default;
|
|
|
|
module.exports.handler = async function test({ detoxArgs, runnerArgs }) {
|
|
try {
|
|
const opts = {
|
|
argv: detoxArgs,
|
|
testRunnerArgv: runnerArgs,
|
|
workerId: null,
|
|
};
|
|
|
|
const config = await detox.resolveConfig(opts);
|
|
if (!config.cli.inspectBrk) {
|
|
await detox.init(opts);
|
|
}
|
|
|
|
if (config.cli.repl) {
|
|
patchJestUtil();
|
|
}
|
|
|
|
const runnerCommand = new TestRunnerCommand({
|
|
config,
|
|
env: process.env,
|
|
});
|
|
|
|
await runnerCommand.execute();
|
|
} finally {
|
|
await detox.cleanup();
|
|
}
|
|
};
|