Skip to content

Commit

Permalink
chore: assign framework
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 committed Aug 9, 2018
1 parent c00d20c commit 7236952
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
20 changes: 16 additions & 4 deletions packages/midway-mock/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
'use strict';

const {
const assert = require('power-assert');
const mock = require('./dist').default;

const options = {
framework: 'midway'
};

if (process.env.EGG_BASE_DIR) options.baseDir = process.env.EGG_BASE_DIR;
const app = mock.app(options);

before(() => app.ready());
afterEach(mock.restore);

module.exports = {
assert,
app,
mock,
mm
} = require('egg-mock/bootstrap');
module.exports = require('egg-mock/bootstrap');
mm: mock,
};

exports.assert = assert;
exports.app = app;
Expand Down
1 change: 1 addition & 0 deletions packages/midway-mock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"injection": "^0.2.4",
"is-type-of": "^1.2.0",
"midway-core": "^0.2.4",
"power-assert": "^1.6.0",
"ready-callback": "^2.0.1"
}
}
5 changes: 5 additions & 0 deletions packages/midway-mock/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ const mm2: MidwayMock = {
mockContainer
};

mm2.app = (options) => {
return mm2.app(Object.assign({
framework: 'midway'
}, options));
};
mm2.container = mockContainer;
module.exports = mm2;
exports.mm = mm2;
Expand Down

0 comments on commit 7236952

Please sign in to comment.