Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to css-minimize-webpack-plugin 2.0 #966

Merged
merged 7 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions test/functional.js
Original file line number Diff line number Diff line change
Expand Up @@ -2663,21 +2663,21 @@ module.exports = {

testSetup.runWebpack(config, (webpackAssert) => {
// in production, we hash the chunk names to avoid exposing any extra details
webpackAssert.assertOutputJsonFileMatches('entrypoints.json', {
entrypoints: {
main: {
js: ['/build/runtime.js', '/build/843.js', '/build/38.js', '/build/main.js'],
css: ['/build/38.css']
},
other: {
js: ['/build/runtime.js', '/build/843.js', '/build/38.js', '/build/other.js'],
css: ['/build/38.css']
}
}
});
const entrypointsData = JSON.parse(webpackAssert.readOutputFile('entrypoints.json'));
const mainJsFiles = entrypointsData.entrypoints.main.js;
expect(mainJsFiles).to.have.length(4);
expect(mainJsFiles[0]).equals('/build/runtime.js');
// keys 1 and 2 are "split files" with an integer name that sometimes changes
expect(mainJsFiles[3]).equals('/build/main.js');

expect(entrypointsData.entrypoints.main.css[0]).equals('/build/38.css');
weaverryan marked this conversation as resolved.
Show resolved Hide resolved

// make split chunks are correct in manifest
webpackAssert.assertManifestKeyExists('build/843.js');
const manifestData = JSON.parse(webpackAssert.readOutputFile('manifest.json'));
mainJsFiles.forEach((file) => {
// file.substring(1) => /build/main.js -> build/main.js
expect(Object.keys(manifestData)).includes(file.substring(1));
});

done();
});
Expand Down
10 changes: 10 additions & 0 deletions test/helpers/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,16 @@ class Assert {
throw new Error(`Files ${Object.keys(expectedFileStrings).join(', ')} were expected to be found in the directory but were not. Actual files: ${actualFiles.join(', ')}`);
}
}

/**
* Return the contents of a built file.
*
* @param {string} filePath
* @return {string}
*/
readOutputFile(filePath) {
return readOutputFile(this.webpackConfig, filePath);
}
}

module.exports = function(webpackConfig) {
Expand Down