Detox: point to a single configuration file

Created on 27 Aug 2018  路  8Comments  路  Source: wix/Detox

Description

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

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 8.0.0
  • Node: 8.9.4
accepteenhancement ux

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!

All 8 comments

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 :)

Closing in favor of #1238

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danut-t picture danut-t  路  3Comments

rengarima picture rengarima  路  4Comments

alexmngn picture alexmngn  路  3Comments

aamorozov picture aamorozov  路  3Comments

rikur picture rikur  路  4Comments