Skip to content
This repository was archived by the owner on Sep 9, 2021. It is now read-only.

Commit b207f3e

Browse files
committedFeb 22, 2017
Rename text cases
1 parent 200f428 commit b207f3e

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed
 
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎test/index.js

+14-13
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ process.chdir(__dirname);
99

1010
const readFile = file => fs.readFileSync(file, 'utf-8');
1111

12-
const makeBundle = name => del(`expected/${name}`).then(() => {
13-
const bundle = webpack({
12+
const makeBundle = (name, options) => del(`expected/${name}`).then(() => {
13+
const config = Object.assign({
1414
entry: `./fixtures/${name}/entry.js`,
1515
output: {
1616
path: `expected/${name}`,
1717
filename: 'bundle.js',
1818
},
19-
});
19+
}, options);
20+
const bundle = webpack(config);
2021
return new Promise((resolve, reject) => {
2122
bundle.run((err, stats) => {
2223
if (err) {
@@ -29,37 +30,37 @@ const makeBundle = name => del(`expected/${name}`).then(() => {
2930
});
3031

3132
describe('worker-loader', () => {
32-
it('should create chunk with worker', () =>
33-
makeBundle('worker').then((stats) => {
33+
it('should create chunk with worker via query', () =>
34+
makeBundle('worker-query').then((stats) => {
3435
const workerFile = stats.toJson('minimal').children
3536
.map(item => item.chunks)
3637
.reduce((acc, item) => acc.concat(item), [])
3738
.map(item => item.files)
38-
.map(item => `expected/worker/${item}`)[0];
39+
.map(item => `expected/worker-query/${item}`)[0];
3940
assert(workerFile);
4041
assert.notEqual(readFile(workerFile).indexOf('// worker test mark'), -1);
4142
})
4243
);
4344

44-
it('should create chunk with specified name', () =>
45-
makeBundle('name').then((stats) => {
46-
const workerFile = 'expected/name/namedWorker.js';
45+
it('should create chunk with specified name in query', () =>
46+
makeBundle('name-query').then((stats) => {
47+
const workerFile = 'expected/name-query/namedWorker.js';
4748
const receivedWorkerFile = stats.toJson('minimal').children
4849
.map(item => item.chunks)
4950
.reduce((acc, item) => acc.concat(item), [])
5051
.map(item => item.files)
51-
.map(item => `expected/name/${item}`)[0];
52+
.map(item => `expected/name-query/${item}`)[0];
5253
assert.equal(receivedWorkerFile, workerFile);
5354
assert.notEqual(readFile(workerFile).indexOf('// named worker test mark'), -1);
5455
})
5556
);
5657

57-
it('should inline worker with inline option', () =>
58-
makeBundle('inline').then((stats) => {
58+
it('should inline worker with inline option in query', () =>
59+
makeBundle('inline-query').then((stats) => {
5960
const bundleFile = stats.toJson('minimal').chunks
6061
.map(item => item.files)
6162
.reduce((acc, item) => acc.concat(item), [])
62-
.map(item => `expected/inline/${item}`)[0];
63+
.map(item => `expected/inline-query/${item}`)[0];
6364
assert(bundleFile);
6465
assert.notEqual(readFile(bundleFile).indexOf('// inlined worker test mark'), -1);
6566
})

0 commit comments

Comments
 (0)
This repository has been archived.