Skip to content

Commit

Permalink
fix(repo): ensure cypress is installed for the e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav committed Oct 14, 2022
1 parent 10e626c commit 81037a8
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions e2e/utils/index.ts
@@ -1,5 +1,4 @@
import {
createProjectGraphAsync,
joinPathFragments,
parseJson,
ProjectConfiguration,
Expand Down Expand Up @@ -399,7 +398,32 @@ export async function cleanupProject(opts?: RunCmdOpts) {
}

export function runCypressTests() {
return process.env.NX_E2E_RUN_CYPRESS === 'true';
if (process.env.NX_E2E_RUN_CYPRESS === 'true') {
let cypressVerified = true;
try {
const r = execSync('npx cypress verify', {
stdio: 'inherit',
encoding: 'utf-8',
cwd: tmpProjPath(),
});
if (r.indexOf('Verified Cypress!') === -1) {
cypressVerified = false;
}
} catch {
cypressVerified = false;
} finally {
if (!cypressVerified) {
e2eConsoleLogger('Cypress was not verified. Installing Cypress now.');
execSync('npx cypress install', {
stdio: 'inherit',
encoding: 'utf-8',
cwd: tmpProjPath(),
});
}
}
return true;
}
return false;
}

export function isNotWindows() {
Expand Down

0 comments on commit 81037a8

Please sign in to comment.