mirror of https://github.com/status-im/js-waku.git
refactor(test): include webpack config in karma config
So it is clear that this webpack config is only necessary for Karma.
This commit is contained in:
parent
e119fc46d6
commit
5c022da3ea
|
@ -1,34 +1,49 @@
|
||||||
process.env.CHROME_BIN = require("puppeteer").executablePath();
|
process.env.CHROME_BIN = require('puppeteer').executablePath();
|
||||||
const webpackConfig = require("./webpack.config.cjs");
|
const webpack = require('webpack');
|
||||||
const webpack = require("webpack");
|
|
||||||
|
|
||||||
module.exports = function (config) {
|
module.exports = function(config) {
|
||||||
config.set({
|
config.set({
|
||||||
frameworks: ["webpack", "mocha"],
|
frameworks: ['webpack', 'mocha'],
|
||||||
files: ["src/lib/**/!(node).spec.ts"],
|
files: ['src/lib/**/!(node).spec.ts'],
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
"src/lib/**/!(node).spec.ts": ["webpack"],
|
'src/lib/**/!(node).spec.ts': ['webpack']
|
||||||
},
|
},
|
||||||
envPreprocessor: ["CI"],
|
envPreprocessor: ['CI'],
|
||||||
reporters: ["progress"],
|
reporters: ['progress'],
|
||||||
browsers: ["ChromeHeadless"],
|
browsers: ['ChromeHeadless'],
|
||||||
singleRun: true,
|
singleRun: true,
|
||||||
client: {
|
client: {
|
||||||
mocha: {
|
mocha: {
|
||||||
timeout: 6000, // Default is 2s
|
timeout: 6000 // Default is 2s
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
webpack: {
|
webpack: {
|
||||||
mode: "production",
|
mode: 'production',
|
||||||
module: webpackConfig.module,
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.(js|tsx?)$/,
|
||||||
|
use: 'ts-loader',
|
||||||
|
exclude: /(node_modules)|(node\.spec\.ts)/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /node\.spec\.ts$/,
|
||||||
|
use: 'ignore-loader'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
"process.env.CI": process.env.CI || false,
|
'process.env.CI': process.env.CI || false
|
||||||
}),
|
}),
|
||||||
...webpackConfig.plugins,
|
new webpack.ProvidePlugin({
|
||||||
|
process: 'process/browser.js'
|
||||||
|
})
|
||||||
],
|
],
|
||||||
resolve: webpackConfig.resolve,
|
resolve: {
|
||||||
stats: { warnings: false },
|
extensions: ['.ts', '.js']
|
||||||
},
|
},
|
||||||
|
stats: { warnings: false }
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
const webpack = require("webpack");
|
|
||||||
const path = require("path");
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
mode: "development",
|
|
||||||
entry: {
|
|
||||||
"js-waku": "./src/index.ts",
|
|
||||||
},
|
|
||||||
devtool: "inline-source-map",
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.(js|tsx?)$/,
|
|
||||||
use: "ts-loader",
|
|
||||||
exclude: /(node_modules)|(node\.spec\.ts)/,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /node\.spec\.ts$/,
|
|
||||||
use: "ignore-loader",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.ProvidePlugin({
|
|
||||||
process: "process/browser.js",
|
|
||||||
Buffer: ["buffer", "Buffer"],
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
resolve: {
|
|
||||||
extensions: [".ts", ".js"],
|
|
||||||
fallback: {
|
|
||||||
buffer: require.resolve("buffer/"),
|
|
||||||
crypto: false,
|
|
||||||
stream: require.resolve("stream-browserify"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: "[name].js",
|
|
||||||
path: path.resolve(__dirname, "build/umd"),
|
|
||||||
library: "jswaku",
|
|
||||||
libraryTarget: "umd",
|
|
||||||
globalObject: "this",
|
|
||||||
},
|
|
||||||
optimization: {
|
|
||||||
splitChunks: {
|
|
||||||
name: "vendors",
|
|
||||||
chunks: "all",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
Loading…
Reference in New Issue