-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcypress.config.js
32 lines (29 loc) · 904 Bytes
/
cypress.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { defineConfig } = require("cypress");
const { resetTestDatabase, executeSqlFile } = require('./cypress/__utils__/db-setup.js')
const fs = require('fs');
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
on('before:run', async (details) => {
await resetTestDatabase()
await executeSqlFile('tests.sql')
})
on('after:run', async (results) => {
// Results will be undefined in interactive mode
if (results) {
// Deletes the build folder that the test run
// generates. Only works if we supply a callback
// function:
fs.rmdir('build', {recursive: true}, () => {})
console.log(
results.totalPassed,
'out of',
results.totalTests,
'passed'
)
}
})
},
baseUrl: 'http://localhost:5002',
}
});