Skip to content

Commit

Permalink
feat(core): tests for divided command
Browse files Browse the repository at this point in the history
  • Loading branch information
gearonix committed Nov 11, 2023
1 parent abdca81 commit 2920601
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions packages/nx/src/executors/run-commands/run-commands.impl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,42 @@ describe('Run Commands', () => {
expect(readFile(f)).toEqual('12');
});

it('should run the command, but divided into paths', async () => {
const f = fileSync().name;
const result = await runCommands(
{
command: [`echo 1 >> ${f}`, '&&', `echo 2 >> ${f}`],
parallel: false,

__unparsed__: [],
},
context
);
expect(result).toEqual(expect.objectContaining({ success: true }));
expect(readFile(f)).toEqual('12');
});

it('should run the command, but divided into several paths', async () => {
const f = fileSync().name;
const result = await runCommands(
{
command: [
`echo 1 >> ${f} `,
`&&`,
`echo 2 >> ${f}`,
';',
`echo 34 >> ${f}`,
],
parallel: false,

__unparsed__: [],
},
context
);
expect(result).toEqual(expect.objectContaining({ success: true }));
expect(readFile(f)).toEqual('1234');
});

it('should run commands in parallel', async () => {
const f = fileSync().name;
const result = await runCommands(
Expand Down

0 comments on commit 2920601

Please sign in to comment.