Skip to content

Commit aaf6264

Browse files
authored
fix(cli): support monorepos with --inspect-brk (#4761)
1 parent 1ead1ee commit aaf6264

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

detox/src/configuration/composeRunnerConfig.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
const os = require('os');
1+
const path = require('path');
2+
const process = require('process');
23

34
const _ = require('lodash');
5+
const resolveFrom = require('resolve-from');
46

57
const log = require('../utils/logger');
68

@@ -122,10 +124,10 @@ function hasEmptyPositionalArgs(value, key) {
122124
* @param {Detox.DetoxTestRunnerConfig} config
123125
*/
124126
function inspectBrkHookDefault(config) {
125-
/* istanbul ignore next */
126-
config.args.$0 = os.platform() !== 'win32'
127-
? `node --inspect-brk ./node_modules/.bin/jest`
128-
: `node --inspect-brk ./node_modules/jest/bin/jest.js`;
127+
const cwd = process.cwd();
128+
const binAbsolute = resolveFrom(cwd, 'jest/bin/jest');
129+
const bin = path.relative(cwd, binAbsolute);
130+
config.args.$0 = `node --inspect-brk ${bin}`;
129131
config.args.runInBand = true;
130132
delete config.args.w;
131133
delete config.args.workers;

0 commit comments

Comments
 (0)