UNPKG

600 BJavaScriptView Raw
1const assert = require('assert');
2const path = require('path');
3const mock = require('./index').default;
4const appHandler = require('./lib/app_handler');
5
6const { getEggOptions } = require('./lib/utils');
7
8const options = getEggOptions();
9
10// throw error when an egg plugin test is using bootstrap
11const pkgInfo = require(path.join(options.baseDir || process.cwd(), 'package.json'));
12if (pkgInfo.eggPlugin) throw new Error('DO NOT USE bootstrap to test plugin');
13
14appHandler.setupApp();
15
16module.exports = {
17 assert,
18 get app() {
19 return appHandler.getBootstrapApp();
20 },
21 mock,
22 mm: mock,
23};