Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(testing): cypress dot notation args not being passed #10858

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 24 additions & 2 deletions e2e/cypress/src/cypress.test.ts
@@ -1,5 +1,6 @@
import {
checkFilesExist,
createFile,
killPorts,
newProject,
readFile,
Expand Down Expand Up @@ -41,9 +42,30 @@ describe('Cypress E2E Test runner', () => {
`generate @nrwl/react:app ${myapp} --e2eTestRunner=cypress --linter=eslint`
);

expect(runCLI(`e2e ${myapp}-e2e --no-watch`)).toContain(
'All specs passed!'
// make sure arg parsing doesn't regress
// https://github.com/nrwl/nx/issues/10808
createFile(
`apps/${myapp}-e2e/cypress.env.json`,
JSON.stringify({
NX_API_URL: 'http://localhost:1234',
})
);
createFile(
`apps/${myapp}-e2e/src/integration/args.spec.ts`,
`
describe('args', () => {
it('should have the correct args', () => {
expect(Cypress.env('NX_API_URL')).eq('http://localhost:9000')
});
});
`
);

expect(
runCLI(
`e2e ${myapp}-e2e --env.NX_API_URL=http://localhost:9000 --no-watch`
)
).toContain('All specs passed!');
await killPorts(4200);
const originalContents = JSON.parse(
readFile(`apps/${myapp}-e2e/cypress.json`)
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/command-line/nx-commands.spec.ts
@@ -1,4 +1,4 @@
import { commandsObject } from 'nx/src/command-line/nx-commands';
import { commandsObject } from './nx-commands';

describe('nx-commands', () => {
it('should parse dot notion cli args', () => {
Expand Down