Skip to content

Commit 052e18c

Browse files
committed
refactor: fix missing bin in command
1 parent 5d4fd60 commit 052e18c

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

packages/nx-plugin/src/executors/cli/executor.int.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,25 @@ describe('runAutorunExecutor', () => {
5454
});
5555
});
5656

57+
it('should execute command with provided bin', async () => {
58+
const bin = 'packages/cli/dist';
59+
const output = await runAutorunExecutor(
60+
{
61+
verbose: true,
62+
bin,
63+
},
64+
executorContext('utils'),
65+
);
66+
expect(output.success).toBe(true);
67+
68+
expect(executeProcessSpy).toHaveBeenCalledTimes(1);
69+
expect(executeProcessSpy).toHaveBeenCalledWith(
70+
expect.objectContaining({
71+
args: expect.arrayContaining([bin]),
72+
}),
73+
);
74+
});
75+
5776
it('should execute command with provided env vars', async () => {
5877
const output = await runAutorunExecutor(
5978
{

packages/nx-plugin/src/executors/cli/executor.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default async function runAutorunExecutor(
1919
context: ExecutorContext,
2020
): Promise<ExecutorOutput> {
2121
const normalizedContext = normalizeContext(context);
22-
const { env, ...mergedOptions } = mergeExecutorOptions(
22+
const { env, bin, ...mergedOptions } = mergeExecutorOptions(
2323
context.target?.options,
2424
terminalAndExecutorOptions,
2525
);
@@ -30,6 +30,7 @@ export default async function runAutorunExecutor(
3030
const { dryRun, verbose, command } = mergedOptions;
3131
const commandString = createCliCommandString({
3232
command,
33+
bin,
3334
args: cliArgumentObject,
3435
});
3536
if (verbose) {
@@ -41,7 +42,7 @@ export default async function runAutorunExecutor(
4142
} else {
4243
try {
4344
await executeProcess({
44-
...createCliCommandObject({ command, args: cliArgumentObject }),
45+
...createCliCommandObject({ command, args: cliArgumentObject, bin }),
4546
...(context.cwd ? { cwd: context.cwd } : {}),
4647
env,
4748
});

0 commit comments

Comments
 (0)