Skip to content
This repository was archived by the owner on Nov 25, 2018. It is now read-only.

Commit d6122e0

Browse files
author
Brandon Orther
committed
Only result in a single bows-loader in config.
If defined multiple times it still should only only result in a single loader in the generated webpack config.
1 parent 9d70251 commit d6122e0

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/index.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const { createConfig } = require('@webpack-blocks/webpack2');
2+
13
import bows from '../src';
24

35
describe('bows', () => {
@@ -59,3 +61,31 @@ describe('bows', () => {
5961
});
6062
});
6163

64+
describe('webpack config only has one bows-loader', () => {
65+
it('set one bows-loader', () => {
66+
const config = createConfig([bows()]);
67+
const loadersWithBows = config.module.loaders.filter(
68+
rule => rule.loaders[0] === 'bows-loader'
69+
);
70+
expect(loadersWithBows).toHaveLength(1);
71+
expect(loadersWithBows[0].loaders).toEqual(['bows-loader']);
72+
});
73+
74+
it('set two bows-loader', () => {
75+
const config = createConfig([bows(), bows()]);
76+
const loadersWithBows = config.module.loaders.filter(
77+
rule => rule.loaders[0] === 'bows-loader'
78+
);
79+
expect(loadersWithBows).toHaveLength(1);
80+
expect(loadersWithBows[0].loaders).toEqual(['bows-loader']);
81+
});
82+
83+
it('set three bows-loader', () => {
84+
const config = createConfig([bows(), bows(), bows()]);
85+
const loadersWithBows = config.module.loaders.filter(
86+
rule => rule.loaders[0] === 'bows-loader'
87+
);
88+
expect(loadersWithBows).toHaveLength(1);
89+
expect(loadersWithBows[0].loaders).toEqual(['bows-loader']);
90+
});
91+
});

0 commit comments

Comments
 (0)