There is some babel problems with demo-react-native :
````
detox test --configuration ios.sim.release
node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration ios.sim.release
/Users/laurent/dev/react-native/detox/examples/demo-react-native/e2e/example.spec.js:2
beforeEach(async () => {
^
SyntaxError: Unexpected token (
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:528:28)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at /Users/laurent/dev/react-native/detox/examples/demo-react-native/node_modules/mocha/lib/mocha.js:230:27
at Array.forEach (native)
at Mocha.loadFiles (/Users/laurent/dev/react-native/detox/examples/demo-react-native/node_modules/mocha/lib/mocha.js:227:14)
at Mocha.run (/Users/laurent/dev/react-native/detox/examples/demo-react-native/node_modules/mocha/lib/mocha.js:495:10)
at Object.
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
child_process.js:526
throw err;
^
Error: Command failed: node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration ios.sim.release
at checkExecSyncError (child_process.js:483:13)
at Object.execSync (child_process.js:523:13)
at Object.
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
I was able to fix this with a .babelrc file and adding --compilers js:babel-core/register in mocha.opts
{
"presets": [ "latest" ]
}
But now I have the following error
detox test --configuration ios.sim.release
node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration ios.sim.release
/Users/laurent/dev/react-native/detox/examples/demo-react-native/e2e/example.spec.js:6
beforeEach(_asyncToGenerator(regeneratorRuntime.mark(function _callee() {
^
ReferenceError: regeneratorRuntime is not defined
at Suite.
at Object.create (/Users/laurent/dev/react-native/detox/examples/demo-react-native/node_modules/mocha/lib/interfaces/common.js:114:19)
at context.describe.context.context (/Users/laurent/dev/react-native/detox/examples/demo-react-native/node_modules/mocha/lib/interfaces/bdd.js:44:27)
at Object.
at Module._compile (module.js:556:32)
at loader (/Users/laurent/dev/react-native/detox/examples/demo-react-native/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/Users/laurent/dev/react-native/detox/examples/demo-react-native/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at /Users/laurent/dev/react-native/detox/examples/demo-react-native/node_modules/mocha/lib/mocha.js:230:27
at Array.forEach (native)
at Mocha.loadFiles (/Users/laurent/dev/react-native/detox/examples/demo-react-native/node_modules/mocha/lib/mocha.js:227:14)
at Mocha.run (/Users/laurent/dev/react-native/detox/examples/demo-react-native/node_modules/mocha/lib/mocha.js:495:10)
at Object.
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
child_process.js:526
throw err;
^
Error: Command failed: node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration ios.sim.release
at checkExecSyncError (child_process.js:483:13)
at Object.execSync (child_process.js:523:13)
at Object.
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
Thank to http://stackoverflow.com/questions/33527653/babel-6-regeneratorruntime-is-not-defined-with-async-await, I modified mocha.opts
--recursive
--timeout 120000
--bail
--compilers js:babel-core/register
--require babel-polyfill
````
This fixes the issue
For information :
````
npm ls --depth 0
[email protected] /Users/laurent/dev/react-native/detox/examples/demo-react-native
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── UNMET PEER DEPENDENCY [email protected]
└── [email protected]
npm ERR! peer dep missing: react@~15.4.0-rc.4, required by [email protected]
package.json
"devDependencies": {
"babel-polyfill": "^6.23.0",
"babel-preset-latest": "^6.24.1",
"detox": "^5.0.0",
"mocha": "^3.2.0"
},
````
Hi there, I just added a clarification here https://github.com/wix/detox/commit/bcf540391f23c34d9ee9af8f27b41f4f5c5b068f
Personally I prefer not to babel my tests, and since node 7.6.0 supports async-await there is no need to. It makes it much easier and saves lots of boilerplate configuration.
Did not intend to close the issue, reopening. feel free to close it if it solves your problem.
Works fine with node 7.6.0 (installed with "n 7.6.0")
thank you.
Upgrading my node version fixed this for me. Was running v7.1.0 and upgraded to v0.8.0
The easiest way to do this is using nvm. Here's how to upgrade
Most helpful comment
Hi there, I just added a clarification here https://github.com/wix/detox/commit/bcf540391f23c34d9ee9af8f27b41f4f5c5b068f
Personally I prefer not to babel my tests, and since node 7.6.0 supports async-await there is no need to. It makes it much easier and saves lots of boilerplate configuration.