Skip to content

Commit

Permalink
refine test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Feb 18, 2024
1 parent d393847 commit c79208b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion conf.d/mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ test:

development:
password: StaySafeOutThere
socketPath: /opt/local/var/run/mysql57/mysqld.sock
# socketPath: /opt/local/var/run/mysql82/mysqld.sock
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"prettier": "npx prettier *.js lib routes test html --check",
"prettier:fix": "npm run prettier -- --write",
"start": "NODE_ENV=production node ./server",
"testSetup": "node test/.setup.js",
"testTeardown": "node test/.teardown.js",
"test": "npm run testSetup; node --test; npm run testTeardown",
"test": "test/run.sh",
"versions": "npx dependency-version-checker check",
"watch": "npm run test -- --watch"
},
Expand Down
6 changes: 3 additions & 3 deletions test/.setup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const util = require('../lib/util')
const group = require('../lib/group')
// const session = require('../lib/session')
const user = require('../lib/user')
// const session = require('../lib/session')

const userCase = require('./fixtures/user.json')
const groupCase = require('./fixtures/group.json')

Expand All @@ -11,7 +11,7 @@ const setup = async () => {
// await createTestSession()
await user._mysql.disconnect()
await group._mysql.disconnect()
process.exit(1)
process.exit()
}

setup()
Expand Down
2 changes: 1 addition & 1 deletion test/.teardown.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const teardown = async () => {
await destroyTestGroup()
await user._mysql.disconnect()
await group._mysql.disconnect()
process.exit(1)
process.exit()
}

teardown()
Expand Down
5 changes: 5 additions & 0 deletions test/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

node test/.setup.js
node --test
node test/.teardown.js

0 comments on commit c79208b

Please sign in to comment.