Fixed jest mocha

This commit is contained in:
Daniel
2020-07-23 02:00:34 +02:00
parent 9a9b7aeb86
commit 74ee6f34e4

View File

@@ -1,6 +1,11 @@
const cwd = process.cwd() const cwd = process.cwd()
const is_jest = !!global.test
if (is_jest) { // it's jest
global.before = (msg,fn) => global.beforeAll(fn||msg)
global.after = (msg,fn) => global.afterAll(fn||msg)
}
before (()=> process.chdir(__dirname)) before (()=> process.chdir(__dirname))
after(()=> process.chdir(cwd)) after (()=> process.chdir(cwd))
describe('Custom Handlers', () => { describe('Custom Handlers', () => {
const { GET, POST, expect } = require('./capire').launch('bookshop') const { GET, POST, expect } = require('./capire').launch('bookshop')