egg-mock
Advanced tools
Comparing version 5.2.0 to 5.2.1
@@ -20,15 +20,13 @@ 'use strict'; | ||
app = mock.app(options); | ||
if (typeof beforeAll === 'function') { | ||
// jest | ||
beforeAll(() => app.ready()); | ||
} else { | ||
// mocha | ||
before(() => app.ready()); | ||
} | ||
afterEach(() => app.backgroundTasksFinished()); | ||
afterEach(mock.restore); | ||
} | ||
if (typeof beforeAll === 'function') { | ||
// jest | ||
beforeAll(() => app.ready()); | ||
} else { | ||
// mocha | ||
before(() => app.ready()); | ||
} | ||
afterEach(() => app.backgroundTasksFinished()); | ||
// restore should be the last one | ||
afterEach(mock.restore); | ||
module.exports = { | ||
@@ -35,0 +33,0 @@ assert, |
5.2.1 / 2022-11-11 | ||
================== | ||
**fixes** | ||
* [[`18c366d`](http://github.com/eggjs/egg-mock/commit/18c366d4d8f110e8b5e166bb4109be6659f59dd2)] - fix: use global hook for register global hook (#132) (killa <<killa123@126.com>>) | ||
5.2.0 / 2022-11-08 | ||
@@ -3,0 +9,0 @@ ================== |
const Agent = require('./agent'); | ||
const { getEggOptions } = require('../utils'); | ||
const mock = require('../../index').default; | ||
@@ -15,1 +16,17 @@ let agent; | ||
}; | ||
exports.mochaHooks = { | ||
async beforeAll() { | ||
const { app } = require('../../bootstrap'); | ||
if (app) { | ||
await app.ready(); | ||
} | ||
}, | ||
async afterEach() { | ||
const { app } = require('../../bootstrap'); | ||
if (app) { | ||
await app.backgroundTasksFinished(); | ||
} | ||
await mock.restore(); | ||
}, | ||
}; |
{ | ||
"name": "egg-mock", | ||
"version": "5.2.0", | ||
"version": "5.2.1", | ||
"eggPlugin": { | ||
@@ -59,2 +59,3 @@ "name": "egg-mock" | ||
"mkdirp": "^0.5.1", | ||
"mocha": "^10.1.0", | ||
"pedding": "^1.1.0", | ||
@@ -61,0 +62,0 @@ "tsd": "^0.24.1" |
112361
2203
13