Close database connections after running tests
This commit is contained in:
parent
9b9ded57e7
commit
0bc640962c
8
jest.config.js
Normal file
8
jest.config.js
Normal file
@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
moduleNameMapper: {
|
||||
"\\.css$": "<rootDir>/modules/__mocks__/styleMock.js"
|
||||
},
|
||||
setupTestFrameworkScriptFile:
|
||||
"<rootDir>/modules/__tests__/setupTestFramework.js",
|
||||
testMatch: ["**/__tests__/*-test.js"]
|
||||
};
|
3
modules/__tests__/setupTestFramework.js
Normal file
3
modules/__tests__/setupTestFramework.js
Normal file
@ -0,0 +1,3 @@
|
||||
const closeDatabase = require("./utils/closeDatabase");
|
||||
|
||||
afterAll(closeDatabase);
|
9
modules/__tests__/utils/closeDatabase.js
Normal file
9
modules/__tests__/utils/closeDatabase.js
Normal file
@ -0,0 +1,9 @@
|
||||
const cache = require('../../utils/cache');
|
||||
const data = require('../../utils/data');
|
||||
|
||||
function closeDatabase() {
|
||||
cache.quit();
|
||||
data.quit();
|
||||
}
|
||||
|
||||
module.exports = closeDatabase;
|
@ -70,14 +70,5 @@
|
||||
},
|
||||
"engines": {
|
||||
"node": "8"
|
||||
},
|
||||
"jest": {
|
||||
"moduleNameMapper": {
|
||||
"\\.css$": "<rootDir>/modules/__mocks__/styleMock.js"
|
||||
},
|
||||
"testPathIgnorePatterns": [
|
||||
"/node_modules/",
|
||||
"__tests__/utils"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user