init
This commit is contained in:
13
jdenticon-js/test/e2e/webpack/app.js
Normal file
13
jdenticon-js/test/e2e/webpack/app.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { testBrowser } from "../base-browser-test";
|
||||
|
||||
import * as jdenticonEsm from "jdenticon";
|
||||
testBrowser(jdenticonEsm, "browser-esm");
|
||||
|
||||
import * as jdenticonEsmBrowser from "jdenticon/browser";
|
||||
testBrowser(jdenticonEsmBrowser, "browser-esm");
|
||||
|
||||
import * as jdenticonEsmNode from "jdenticon/node";
|
||||
testBrowser(jdenticonEsmNode, "node-esm");
|
||||
|
||||
import * as jdenticonUmd from "jdenticon/standalone";
|
||||
testBrowser(jdenticonUmd, "browser-umd");
|
||||
40
jdenticon-js/test/e2e/webpack/runner.js
Normal file
40
jdenticon-js/test/e2e/webpack/runner.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const process = require("process");
|
||||
const config = require("./webpack.config");
|
||||
const moduleAlias = require("module-alias");
|
||||
const webpackPackageName = process.argv[2];
|
||||
|
||||
// This file is used instead of webpack-cli to allow testing with multiple webpack versions
|
||||
|
||||
if (!webpackPackageName) {
|
||||
console.error("Usage: node runner.js (webpack4|webpack5)");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!/^webpack\d+$/.test(webpackPackageName)) {
|
||||
console.error("Invalid webpack package name specified");
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
// The terser plugin in webpack4 imports "webpack/lib/RequestShortener", so we can't require the right webpack module
|
||||
// name and use it straight away. By using module-alias we make "webpack" requirable.
|
||||
moduleAlias.addAlias("webpack", webpackPackageName);
|
||||
|
||||
const webpack = require("webpack");
|
||||
|
||||
webpack(config, (err, stats) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
process.exit(3);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(stats.toString({
|
||||
colors: true
|
||||
}));
|
||||
|
||||
console.log("---");
|
||||
|
||||
if (stats.hasErrors()) {
|
||||
process.exit(4);
|
||||
}
|
||||
});
|
||||
33
jdenticon-js/test/e2e/webpack/webpack.config.js
Normal file
33
jdenticon-js/test/e2e/webpack/webpack.config.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const path = require("path");
|
||||
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
entry: path.join(__dirname, "app.js"),
|
||||
externals: {
|
||||
"tap": "commonjs tap",
|
||||
"canvas-renderer": "commonjs canvas-renderer"
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.mjs$/,
|
||||
enforce: 'pre',
|
||||
use: ['source-map-loader'],
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
enforce: 'pre',
|
||||
use: ['source-map-loader'],
|
||||
},
|
||||
],
|
||||
},
|
||||
stats: {
|
||||
warningsFilter: [/Failed to parse source map/],
|
||||
},
|
||||
devtool: "source-map",
|
||||
|
||||
output: {
|
||||
path: __dirname,
|
||||
filename: "app.bundle.js",
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user