Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import HtmlWebpackPlugin from 'html-webpack-plugin';
import espack from '../index';
import webpackConfig from '../../webpack.config';
import CSSExtractPlugin from '../plugins/CSSExtractPlugin';
import EventCallbackPlugin from '../plugins/EventCallbackPlugin';
import { setConfigOptions, OUTPUT_FILE_NAME, INFO_CHUNK_NAME } from '../../config';
import presetStage from '../../babel/preset-stage';
jest.unmock('../../config');
jest.mock('fs-extra');
jest.mock('glob');
jest.unmock('webpack');
jest.mock('mini-css-extract-plugin');
jest.mock('uglifyjs-webpack-plugin');
require('glob').__setMockFiles([ // eslint-disable-line no-underscore-dangle, global-require
'src/pages/index.js',
]);
global.console.log = jest.fn();
const Api = espack.constructor;
jest.spyOn(Api, 'log');
describe('API 需要先提供 config 驗證', () => {
beforeEach(() => {
setConfigOptions({
dev: false,
dropConsole: false,
port: '8888',
viewsFolder: '.',
staticFolder: '.',
beforeEach(() => {
require('glob').__setMockFiles([ // eslint-disable-line no-underscore-dangle, global-require
'src/pages/index.js',
]);
});