Skip to content

Commit

Permalink
fix(node): quote filepath in cli e2e sample test (#14779)
Browse files Browse the repository at this point in the history
Fixes #14761
  • Loading branch information
barbados-clemens committed Feb 2, 2023
1 parent 259d4b2 commit bc788ff
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions packages/node/src/generators/e2e-project/e2e-project.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,33 @@ describe('e2eProjectGenerator', () => {

expect(tree.exists(`e2e/src/server/server.spec.ts`)).toBeTruthy();
});

it('should generate cli project', async () => {
await applicationGenerator(tree, {
name: 'api',
framework: 'none',
e2eTestRunner: 'none',
});
await e2eProjectGenerator(tree, {
projectType: 'cli',
project: 'api',
});
expect(tree.read('api-e2e/src/api/api.spec.ts', 'utf-8'))
.toMatchInlineSnapshot(`
"import { execSync } from 'child_process';
import { join } from 'path';
describe('CLI tests', () => {
it('should print a message', () => {
const cliPath = join(process.cwd(), \\"dist/api\\");
const output = execSync(\`node \${cliPath}\`).toString();
expect(output).toMatch(/Hello World/);
});
});
"
`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { join } from 'path';

describe('CLI tests', () => {
it('should print a message', () => {
const cliPath = join(process.cwd(), <%= mainFile %>);
const cliPath = join(process.cwd(), "<%= mainFile %>");

const output = execSync(`node ${cliPath}`).toString();

Expand Down

0 comments on commit bc788ff

Please sign in to comment.