Skip to content

Commit

Permalink
Properly scope yarn tasks to appropriate --cwd now that cypress direc…
Browse files Browse the repository at this point in the history
…tories/configs are at root
  • Loading branch information
vanderhoop committed Apr 3, 2023
1 parent 54af3f9 commit f9eb0fc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/build
/node_modules
/be/.env
/be/**/logs/*
/be/**/logs/*

# e2e test output
nohup.out
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
10 changes: 5 additions & 5 deletions scripts/test-suite.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down

0 comments on commit f9eb0fc

Please sign in to comment.