js-waku/packages/core/karma.conf.cjs

56 lines
1.3 KiB
JavaScript
Raw Normal View History

2022-07-26 04:40:40 +00:00
process.env.CHROME_BIN = require("puppeteer").executablePath();
const webpack = require("webpack");
2022-05-20 13:40:56 +00:00
2022-07-26 04:40:40 +00:00
module.exports = function (config) {
2022-05-20 13:40:56 +00:00
config.set({
2022-07-26 04:40:40 +00:00
frameworks: ["webpack", "mocha"],
files: ["src/lib/**/!(node).spec.ts"],
2022-05-20 13:40:56 +00:00
preprocessors: {
2022-07-26 04:40:40 +00:00
"src/lib/**/!(node).spec.ts": ["webpack"],
2022-05-20 13:40:56 +00:00
},
2022-07-26 04:40:40 +00:00
envPreprocessor: ["CI"],
reporters: ["progress"],
browsers: ["ChromeHeadless"],
2022-05-20 13:40:56 +00:00
singleRun: true,
client: {
mocha: {
2022-07-26 04:40:40 +00:00
timeout: 6000, // Default is 2s
},
2022-05-20 13:40:56 +00:00
},
webpack: {
2022-07-26 04:40:40 +00:00
mode: "production",
module: {
rules: [
{
test: /\.(js|tsx?)$/,
use: [
{
loader: "ts-loader",
options: { configFile: "tsconfig.karma.json" },
},
],
2022-07-26 04:40:40 +00:00
exclude: /(node_modules)|(node\.spec\.ts)/,
},
{
test: /node\.spec\.ts$/,
2022-07-26 04:40:40 +00:00
use: "ignore-loader",
},
],
},
2022-05-23 04:40:37 +00:00
plugins: [
new webpack.DefinePlugin({
2022-07-26 04:40:40 +00:00
"process.env.CI": process.env.CI || false,
2022-05-23 04:40:37 +00:00
}),
new webpack.ProvidePlugin({
2022-07-26 04:40:40 +00:00
process: "process/browser.js",
}),
2022-05-23 04:40:37 +00:00
],
resolve: {
2022-07-26 04:40:40 +00:00
extensions: [".ts", ".js"],
},
2022-07-26 04:40:40 +00:00
stats: { warnings: false },
devtool: "inline-source-map",
2022-07-26 04:40:40 +00:00
},
2022-05-20 13:40:56 +00:00
});
};