Skip to content

Commit 39cb9bd

Browse files
committed
chore(cr): move tests into
1 parent bc0e9bf commit 39cb9bd

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

test/config-generator.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,4 +1014,30 @@ describe('The config-generator function', () => {
10141014
});
10151015
});
10161016
});
1017+
1018+
describe('Test configureLoaderRule()', () => {
1019+
it('configure rule for "eslint"', () => {
1020+
const config = createConfig();
1021+
config.setPublicPath('/');
1022+
config.enableEslintLoader();
1023+
config.configureLoaderRule('eslint', (loader) => {
1024+
loader.test = /\.(jsx?|vue)/;
1025+
});
1026+
1027+
const webpackConfig = configGenerator(config);
1028+
const eslintLoader = webpackConfig.module.rules.find(rule => rule.loader === 'eslint-loader');
1029+
1030+
expect(eslintLoader).to.deep.equals({
1031+
test: /\.(jsx?|vue)/,
1032+
enforce: 'pre',
1033+
exclude: /node_modules/,
1034+
loader: 'eslint-loader',
1035+
options: {
1036+
cache: true,
1037+
emitWarning: true,
1038+
parser: 'babel-eslint'
1039+
}
1040+
});
1041+
});
1042+
});
10171043
});

test/loaders/eslint.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
const expect = require('chai').expect;
1313
const WebpackConfig = require('../../lib/WebpackConfig');
1414
const RuntimeConfig = require('../../lib/config/RuntimeConfig');
15-
const configGenerator = require('../../lib/config-generator');
1615
const eslintLoader = require('../../lib/loaders/eslint');
17-
const isWindows = (process.platform === 'win32');
1816

1917
function createConfig() {
2018
const runtimeConfig = new RuntimeConfig();
@@ -79,29 +77,4 @@ describe('loaders/eslint', () => {
7977
const actualOptions = eslintLoader.getOptions(config);
8078
expect(actualOptions).to.deep.equals({ foo: true });
8179
});
82-
83-
it('configure ESLint loader rule', () => {
84-
const config = createConfig();
85-
config.outputPath = isWindows ? 'C:\\tmp\\public' : '/tmp/public';
86-
config.setPublicPath('/');
87-
config.enableEslintLoader();
88-
config.configureLoaderRule('eslint', (loader) => {
89-
loader.test = /\.(jsx?|vue)/;
90-
});
91-
92-
const webpackConfig = configGenerator(config);
93-
const eslintLoader = webpackConfig.module.rules.find(rule => rule.loader === 'eslint-loader');
94-
95-
expect(eslintLoader).to.deep.equals({
96-
test: /\.(jsx?|vue)/,
97-
enforce: 'pre',
98-
exclude: /node_modules/,
99-
loader: 'eslint-loader',
100-
options: {
101-
cache: true,
102-
emitWarning: true,
103-
parser: 'babel-eslint'
104-
}
105-
});
106-
});
10780
});

0 commit comments

Comments
 (0)