Skip to content

Commit

Permalink
feat(repo): run e2e tests outside of the repo (nrwl#9496)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin authored and sidmonta committed Apr 2, 2022
1 parent 82cd7a2 commit 7edb650
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
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

0 comments on commit 7edb650

Please sign in to comment.