Skip to content

Commit

Permalink
cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Apr 28, 2021
1 parent dfe0262 commit 6afb5a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
8 changes: 4 additions & 4 deletions test/functional.js
Original file line number Diff line number Diff line change
Expand Up @@ -2661,19 +2661,19 @@ module.exports = {
splitChunks.minSize = 0;
});

testSetup.runWebpack(config, (webpackAssert) => {
testSetup.runWebpack(config, () => {
// in production, we hash the chunk names to avoid exposing any extra details
const entrypointsData = JSON.parse(webpackAssert.readOutputFile('entrypoints.json'));
const entrypointsData = JSON.parse(readOutputFileContents('entrypoints.json', config));
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');
expect(entrypointsData.entrypoints.main.css[0]).matches(/\/build\/(\d)+\.css/);

// make split chunks are correct in manifest
const manifestData = JSON.parse(webpackAssert.readOutputFile('manifest.json'));
const manifestData = JSON.parse(readOutputFileContents('manifest.json', config));
mainJsFiles.forEach((file) => {
// file.substring(1) => /build/main.js -> build/main.js
expect(Object.keys(manifestData)).includes(file.substring(1));
Expand Down
10 changes: 0 additions & 10 deletions test/helpers/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,6 @@ 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

0 comments on commit 6afb5a3

Please sign in to comment.