Currently it seems that detox allows configuring only in the package.json of the project. But using a mono-repo (lerna), we want to run detox in specific packages. However I don't want to duplicate our detox config in each package.json
I've seen a discussion in https://github.com/wix/detox/issues/175 but it doesn't mention creating the file outside the package.json
Possible solution:
detox-config.json
you can do this in the current build
const config = require('../config').detox;
await detox.init(config);
Unless I put a detox and configuration object in my package.json, I still get:
if (_.size(config.configurations) === 1) {
^
TypeError: Cannot read property 'configurations' of undefined
at getDefaultConfiguration (/Users/ore/env/dev/repos/x/node_modules/detox/local-cli/detox-test.js:207:21)
at Object.<anonymous> (/Users/ore/env/dev/repos/x/node_modules/detox/local-cli/detox-test.js:23:151)
This is due to
detox/local-cli.js
const config = require(path.join(process.cwd(), 'package.json')).detox;
You're right, we should give an opportunity for users to get an external config file, not only in package.json.
Logic may try getting config from package.json, and failover to a config file (or vice versa).
A PR is most welcome!
@oreporan , check what's inside of your detox/tests/package.json. Maybe you modified something?
Sorry, I found the issue and removed the comment :)
Made a PR
https://github.com/wix/detox/pull/906
Closing in favor of #1238
Most helpful comment
You're right, we should give an opportunity for users to get an external config file, not only in package.json.
Logic may try getting config from package.json, and failover to a config file (or vice versa).
A PR is most welcome!