Skip to content

Commit

Permalink
start using local scripts in build process
Browse files Browse the repository at this point in the history
  • Loading branch information
rotemmiz committed Mar 14, 2017
1 parent c557884 commit bf63e8f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
1 change: 0 additions & 1 deletion detox-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "detox CLI tool wrapper",
"main": "index.js",
"scripts": {
"test": "jest"
},
"bin": {
"detox": "./cli.sh"
Expand Down
12 changes: 8 additions & 4 deletions detox/scripts/detox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,27 @@ const program = require('commander');
const path = require('path');
const cp = require('child_process');
program
.option('-r, --runner [runner]', 'test runner', 'mocha')
.option('-c, --runner-config [config]', 'test runner config file', 'mocha.opts')
.option('-r, --runner [runner]', 'Test runner (currently supports mocha)', 'mocha')
.option('-c, --runner-config [config]', 'Test runner config file', 'mocha.opts')
.option('-l, --loglevel [value]', 'info, debug, verbose, silly')
.option('-d, --device [device name]', 'Run test on this device')
.parse(process.argv);

const config = require(path.join(process.cwd(), 'package.json')).detox;
const testFolder = config.specs || 'e2e';

console.log('runner', program.runner);

const loglevel = program.loglevel ? `--loglevel ${program.loglevel}` : '';
const device = program.device ? `--device ${program.device}` : '';

let command;
switch (program.runner) {
case 'mocha':
command = `node_modules/.bin/${program.runner} ${testFolder} --opts ${testFolder}/${program.runnerConfig} --loglevel ${program.loglevel}`;
command = `node_modules/.bin/${program.runner} ${testFolder} --opts ${testFolder}/${program.runnerConfig} ${device} ${loglevel}`;
break;
default:
throw new Error(`${program.runner} is not supported in detox cli tools. You can still runb your tests with the runner's own cli tool`);
throw new Error(`${program.runner} is not supported in detox cli tools. You can still run your tests with the runner's own cli tool`);
}

console.log(command);
Expand Down
5 changes: 3 additions & 2 deletions detox/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"private": true,
"scripts": {
"packager": "react-native start",
"detox-server": "detox-server",
"e2e": "mocha e2e --opts ./e2e/mocha.opts"
"detox-server": "detox run-server",
"e2e": "detox test --device ios.sim.release",
"build": "detox build --device ios.sim.release"
},
"dependencies": {
"lodash": "^4.14.1",
Expand Down
8 changes: 4 additions & 4 deletions scripts/travis.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash -e

lerna bootstrap
lerna run build
lerna run test
lerna run --ignore detox-demo* build
lerna run --ignore detox-demo* test

cd detox
#cd detox

cd test
set -o pipefail && export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -project ios/example.xcodeproj -scheme example -configuration Release -sdk iphonesimulator -derivedDataPath ios/build | xcpretty
#set -o pipefail && export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -project ios/example.xcodeproj -scheme example -configuration Release -sdk iphonesimulator -derivedDataPath ios/build | xcpretty

npm run e2e

0 comments on commit bf63e8f

Please sign in to comment.