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

feat(repo): run e2e tests outside of the repo #9496

Merged
merged 1 commit into from Mar 24, 2022
Merged
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -188,7 +188,7 @@ jobs:
- run:
name: Run E2E Tests
command: |
npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-storybook,e2e-react-native,e2e-detox,e2e-workspace-integrations --parallel=1
npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-storybook,e2e-react-native,e2e-detox --parallel=1
no_output_timeout: 45m
- run:
name: Stop All Running Agents for This CI Run
Expand Down
6 changes: 4 additions & 2 deletions e2e/utils/index.ts
Expand Up @@ -49,7 +49,10 @@ export function currentCli() {
return process.env.SELECTED_CLI || 'nx';
}

export const e2eRoot = isCI ? dirSync({ prefix: 'nx-e2e-' }).name : `./tmp`;
export const e2eRoot = isCI
? dirSync({ prefix: 'nx-e2e-' }).name
: '/tmp/nx-e2e';

export const e2eCwd = `${e2eRoot}/${currentCli()}`;
ensureDirSync(e2eCwd);

Expand Down Expand Up @@ -524,7 +527,6 @@ export function runCommand(
}
return r;
} catch (e) {
console.log('ERROR CAUGHT', e);
// this is intentional
// npm ls fails if package is not found
return e.stdout?.toString() + e.stderr?.toString();
Expand Down
8 changes: 4 additions & 4 deletions e2e/workspace-integrations/src/affected.test.ts
Expand Up @@ -25,6 +25,7 @@ describe('affected:*', () => {
afterEach(() => cleanupProject());

it('should print, build, and test affected apps', async () => {
process.env.CI = 'true';
const myapp = uniq('myapp');
const myapp2 = uniq('myapp2');
const mylib = uniq('mylib');
Expand Down Expand Up @@ -150,10 +151,9 @@ describe('affected:*', () => {
`affected:test --files="libs/${mylib}/src/index.ts"`,
{ silenceError: true }
);
expect(failedTests).toContain(`Running target test for 3 project(s):`);
expect(failedTests).toContain(`- ${mylib}`);
expect(failedTests).toContain(`- ${myapp}`);
expect(failedTests).toContain(`- ${mypublishablelib}`);
expect(failedTests).toContain(mylib);
expect(failedTests).toContain(myapp);
expect(failedTests).toContain(mypublishablelib);
expect(failedTests).toContain(`Failed tasks:`);

// Fix failing Unit Test
Expand Down
4 changes: 2 additions & 2 deletions scripts/e2e-build-package-publish.ts
Expand Up @@ -20,8 +20,8 @@ async function buildPackagePublishAndCleanPorts() {
}
await Promise.all([
remove('./build'),
remove('./tmp/nx/proj-backup'),
remove('./tmp/angular/proj-backup'),
remove('/tmp/nx-e2e/nx/proj-backup'),
remove('/tmp/nx-e2e/angular/proj-backup'),
remove('./tmp/local-registry'),
]);
}
Expand Down