Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Slashgear committed Apr 29, 2020
1 parent 2c7eceb commit 4451995
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,28 @@ describe('loader and plugin', () => {
assets['main.js'].source().should.contain(`__webpack_require__.p + "${spriteFilename}`);
});

it('should generate asset with output path without changing publicPath', async () => {
const publicPath = '/olala/';
const spriteFilename = defaultSpriteFilename;

const v4Config = {};
if (webpackVersion.IS_4) {
v4Config.mode = 'development';
v4Config.devtool = false;
}

const { assets } = await compile(Object.assign(v4Config, {
entry: './entry',
output: { publicPath },
module: rules(
svgRule({ extract: true, spriteFilename, outputPath: '/foo/' })
),
plugins: [new SpritePlugin()]
}));

assets['main.js'].source().should.contain(`__webpack_require__.p + "${spriteFilename}`);
});

it('should emit only built chunks', () => {
// TODO test with webpack-recompilation-emulator
});
Expand Down

0 comments on commit 4451995

Please sign in to comment.