第一类
beforeEach(angular.mock.module("app"));
第二种类型
beforeEach(function () {
angular.module("app");
});
谢谢:)
答案 0 :(得分:0)
来自 angular-mocks.js
window.module = angular.mock.module = function() {
...
更多信息:
http://www.bradoncode.com/blog/2015/05/24/ngmock-fundamentals-angularjs-unit-testing/ https://github.com/bbraithwaite/angular.js/blob/master/src/ngMock/angular-mocks.js#L2259 https://gist.github.com/trinitroglycerin/68754b920df83a977f12#gistcomment-2851474
要启用“模块”的使用,请将其添加到 webpack 配置中:
const webpack = require('webpack');
module.exports = function(config) {
config.set({
//...config
webpack: {
//...webpack config
plugins: [
new webpack.DefinePlugin({
module: 'window.module',
}),
],
}
});
};