From f9eb0fc3ff46a70f67993eb737e1d57fe7855607 Mon Sep 17 00:00:00 2001 From: Travis Vander Hoop Date: Mon, 3 Apr 2023 10:46:06 -0700 Subject: [PATCH] Properly scope yarn tasks to appropriate --cwd now that cypress directories/configs are at root --- .gitignore | 5 ++++- package.json | 1 + scripts/test-suite.mjs | 10 +++++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index db1e03e..1426ddb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ /build /node_modules /be/.env -/be/**/logs/* \ No newline at end of file +/be/**/logs/* + +# e2e test output +nohup.out diff --git a/package.json b/package.json index adefe98..b9a1c6e 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "be:server": "node ./be/server.js", "dev": "nodemon ./be/server.js", "test:integration": "cypress run", + "test": "yarn && node scripts/test-suite.mjs", "prepare": "husky install" }, "devDependencies": { diff --git a/scripts/test-suite.mjs b/scripts/test-suite.mjs index 59add5e..389673a 100644 --- a/scripts/test-suite.mjs +++ b/scripts/test-suite.mjs @@ -4,10 +4,10 @@ async function main () { try { // Build project first to ensure .index.js files are up-to-date log('Building project...') - exec('NODE_ENV=test yarn run build') + exec('NODE_ENV=test yarn --cwd fe run build') - log('Running unit tests...') - exec('yarn run test:unit') + log('Running unit fe tests...') + exec('yarn --cwd fe run test:unit') log('Running integration tests...') const doSeed = !process.argv.includes('no-seed') @@ -22,11 +22,11 @@ async function main () { async function runIntegrationTest(port, doSeed) { if (doSeed) { log('Seeding test database...') - exec('yarn run seed:test') + exec('yarn --cwd fe run seed:test') } log('Starting server...') // Run server in the background, redirect output to /dev/null - exec(`nohup bash -c "PORT=${port} NODE_ENV=test yarn run server"`) + exec(`nohup bash -c "PORT=${port} NODE_ENV=test yarn be:server" > /dev/null 2>&1&`) log('Running tests...') try { exec('yarn run test:integration')