mirror of https://github.com/waku-org/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();
|
||||
const webpackConfig = require("./webpack.config.cjs");
|
||||
const webpack = require("webpack");
|
||||
process.env.CHROME_BIN = require('puppeteer').executablePath();
|
||||
const webpack = require('webpack');
|
||||
|
||||
module.exports = function (config) {
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
frameworks: ["webpack", "mocha"],
|
||||
files: ["src/lib/**/!(node).spec.ts"],
|
||||
frameworks: ['webpack', 'mocha'],
|
||||
files: ['src/lib/**/!(node).spec.ts'],
|
||||
preprocessors: {
|
||||
"src/lib/**/!(node).spec.ts": ["webpack"],
|
||||
'src/lib/**/!(node).spec.ts': ['webpack']
|
||||
},
|
||||
envPreprocessor: ["CI"],
|
||||
reporters: ["progress"],
|
||||
browsers: ["ChromeHeadless"],
|
||||
envPreprocessor: ['CI'],
|
||||
reporters: ['progress'],
|
||||
browsers: ['ChromeHeadless'],
|
||||
singleRun: true,
|
||||
client: {
|
||||
mocha: {
|
||||
timeout: 6000, // Default is 2s
|
||||
},
|
||||
timeout: 6000 // Default is 2s
|
||||
}
|
||||
},
|
||||
webpack: {
|
||||
mode: "production",
|
||||
module: webpackConfig.module,
|
||||
mode: 'production',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(js|tsx?)$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /(node_modules)|(node\.spec\.ts)/
|
||||
},
|
||||
{
|
||||
test: /node\.spec\.ts$/,
|
||||
use: 'ignore-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
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,
|
||||
stats: { warnings: false },
|
||||
},
|
||||
resolve: {
|
||||
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