Skip to content

Commit 8c82bd2

Browse files
author
Patrick Taddey
committed
wrote a test for the styleloader-configuration (configureStyleLoader)
1 parent db6d606 commit 8c82bd2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/functional.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2913,6 +2913,34 @@ module.exports = {
29132913
done();
29142914
});
29152915
});
2916+
2917+
it('With CSS extraction disabled and with options callback of the StyleLoader', (done) => {
2918+
const config = createWebpackConfig('build', 'dev');
2919+
config.setPublicPath('/build');
2920+
config.disableSingleRuntimeChunk();
2921+
config.addEntry('main', './js/css_import');
2922+
config.disableCssExtraction();
2923+
config.configureStyleLoader((options) => {
2924+
options.attributes = { id: 'TESTING_ATTRIBUTES' };
2925+
});
2926+
2927+
testSetup.runWebpack(config, (webpackAssert) => {
2928+
expect(config.outputPath).to.be.a.directory()
2929+
.with.files([
2930+
'manifest.json',
2931+
'entrypoints.json',
2932+
'main.js'
2933+
]);
2934+
2935+
webpackAssert.assertOutputFileContains(
2936+
'main.js',
2937+
'TESTING_ATTRIBUTES'
2938+
);
2939+
2940+
done();
2941+
});
2942+
});
2943+
29162944
});
29172945

29182946
if (!process.env.DISABLE_UNSTABLE_CHECKS) {

0 commit comments

Comments
 (0)