Skip to content

Commit 4451995

Browse files
committed
add test
1 parent 2c7eceb commit 4451995

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/loader.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,28 @@ describe('loader and plugin', () => {
446446
assets['main.js'].source().should.contain(`__webpack_require__.p + "${spriteFilename}`);
447447
});
448448

449+
it('should generate asset with output path without changing publicPath', async () => {
450+
const publicPath = '/olala/';
451+
const spriteFilename = defaultSpriteFilename;
452+
453+
const v4Config = {};
454+
if (webpackVersion.IS_4) {
455+
v4Config.mode = 'development';
456+
v4Config.devtool = false;
457+
}
458+
459+
const { assets } = await compile(Object.assign(v4Config, {
460+
entry: './entry',
461+
output: { publicPath },
462+
module: rules(
463+
svgRule({ extract: true, spriteFilename, outputPath: '/foo/' })
464+
),
465+
plugins: [new SpritePlugin()]
466+
}));
467+
468+
assets['main.js'].source().should.contain(`__webpack_require__.p + "${spriteFilename}`);
469+
});
470+
449471
it('should emit only built chunks', () => {
450472
// TODO test with webpack-recompilation-emulator
451473
});

0 commit comments

Comments
 (0)