Skip to content

Commit

Permalink
trying to isolate failing test situation
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Feb 9, 2021
1 parent 712f4d2 commit 94b3587
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"lint:package": "prettier --write package.json --plugin=prettier-plugin-package",
"posttest": "npm install webpack@^4.44.2",
"security": "npm audit --audit-level=moderate",
"test": "npm list --depth=0 && npm run test:v5",
"test": "npm run test:v5",
"test:v4": "ava",
"test:v5": "npm install webpack@^5.0.0 --no-save && ava --match=\"works with asset modules\""
"test:v5": "npm install webpack@^5.0.0 --no-save && node test/unit/test.js"
},
"files": [
"lib",
Expand Down
44 changes: 44 additions & 0 deletions test/unit/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const { join } = require('path');
const fs = require('fs');

const webpack = require('webpack');

const { WebpackManifestPlugin } = require('../../lib');

const outputPath = join(__dirname, '../output/unit', 'auxiliary-assets');
const config = {
context: __dirname,
entry: '../fixtures/import_image.js',
output: {
path: outputPath,
assetModuleFilename: `images/[name].[hash:4][ext]`,
filename: '[name].js',
publicPath: ''
},
optimization: { chunkIds: 'named' },
plugins: [new WebpackManifestPlugin({})],
module: {
rules: [
{
test: /\.(png)/,
type: 'asset/resource'
}
]
}
};

const compiler = webpack(config);

compiler.run((error, stats) => {
if (error) {
throw error;
}

if (stats.hasErrors()) {
console.log('Stat Errors', stats.toJson());
}

const manifest = fs.readFileSync(join(outputPath, 'manifest.json')).toString();

console.log(manifest);
});

0 comments on commit 94b3587

Please sign in to comment.