From 5180d32ff54ed5661c41e72d90d8dad959a2cf84 Mon Sep 17 00:00:00 2001 From: Emily Xiong Date: Wed, 2 Aug 2023 11:57:45 -0400 Subject: [PATCH] fix(detox): fix detox to work with yarn pnp --- packages/detox/src/executors/build/build.impl.ts | 6 +++--- packages/detox/src/executors/test/test.impl.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/detox/src/executors/build/build.impl.ts b/packages/detox/src/executors/build/build.impl.ts index 3752986e7174f..c1b9c309788d8 100644 --- a/packages/detox/src/executors/build/build.impl.ts +++ b/packages/detox/src/executors/build/build.impl.ts @@ -1,5 +1,5 @@ import { ExecutorContext } from '@nx/devkit'; -import { join } from 'path'; +import { resolve as pathResolve } from 'path'; import { ChildProcess, fork } from 'child_process'; import { DetoxBuildOptions } from './schema'; @@ -35,10 +35,10 @@ export function runCliBuild( ) { return new Promise((resolve, reject) => { childProcess = fork( - join(workspaceRoot, './node_modules/detox/local-cli/cli.js'), + require.resolve('detox/local-cli/cli.js'), ['build', ...createDetoxBuildOptions(options)], { - cwd: join(workspaceRoot, projectRoot), + cwd: pathResolve(workspaceRoot, projectRoot), env: process.env, } ); diff --git a/packages/detox/src/executors/test/test.impl.ts b/packages/detox/src/executors/test/test.impl.ts index 4dd41a202f783..66c6b7dee79c3 100644 --- a/packages/detox/src/executors/test/test.impl.ts +++ b/packages/detox/src/executors/test/test.impl.ts @@ -4,7 +4,7 @@ import { readTargetOptions, } from '@nx/devkit'; import { names } from '@nx/devkit'; -import { join } from 'path'; +import { resolve as pathResolve } from 'path'; import { ChildProcess, fork } from 'child_process'; import { DetoxBuildOptions } from '../build/schema'; @@ -59,10 +59,10 @@ function runCliTest( ) { return new Promise((resolve, reject) => { childProcess = fork( - join(workspaceRoot, './node_modules/detox/local-cli/cli.js'), + require.resolve('detox/local-cli/cli.js'), ['test', ...createDetoxTestOptions(options)], { - cwd: join(workspaceRoot, projectRoot), + cwd: pathResolve(workspaceRoot, projectRoot), env: process.env, } );