js-rln/karma.conf.cjs

80 lines
1.8 KiB
JavaScript
Raw Normal View History

2024-02-28 01:43:27 +01:00
const path = require("path");
2024-02-17 00:29:57 +01:00
const webpack = require("webpack");
const playwright = require('playwright');
2022-09-23 21:35:17 -04:00
2024-02-17 00:29:57 +01:00
process.env.CHROME_BIN = playwright.chromium.executablePath();
2022-09-06 12:06:19 -04:00
2024-02-28 01:43:27 +01:00
const output = {
path: path.join(__dirname, "dist"),
};
2022-09-06 12:06:19 -04:00
module.exports = function (config) {
config.set({
frameworks: ["webpack", "mocha"],
2024-02-29 23:15:05 +01:00
preprocessors: {
"**/*.ts": ["webpack"],
},
2024-02-28 00:37:24 +01:00
files: [
2024-02-29 23:15:05 +01:00
"src/**/*.spec.ts",
"src/**/*.ts",
2024-02-28 00:37:24 +01:00
{
2024-02-28 01:43:27 +01:00
pattern: `${output.path}/**/*`,
2024-02-28 00:37:24 +01:00
watched: false,
included: false,
served: true,
},
],
2022-09-06 12:06:19 -04:00
envPreprocessor: ["CI"],
reporters: ["progress"],
2024-02-29 23:15:05 +01:00
browsers: ["ChromeHeadless"],
pingTimeout: 60000,
2022-09-06 12:06:19 -04:00
singleRun: true,
client: {
mocha: {
2024-02-29 23:15:05 +01:00
timeout: 60000, // Default is 2s
},
2022-09-06 12:06:19 -04:00
},
webpack: {
2024-02-28 01:43:27 +01:00
output,
2024-02-29 22:30:24 +01:00
mode: "production",
2024-02-17 00:29:57 +01:00
module: {
2024-02-29 23:15:05 +01:00
rules: [
{
test: /\.wasm$/,
type: "asset/resource",
},
{
test: /\.(js|tsx?)$/,
loader: "ts-loader",
exclude: /node_modules|\.d\.ts$/,
options: { configFile: "tsconfig.karma.json" },
},
{
test: /\.d\.ts$/,
loader: "ignore-loader",
},
],
2024-02-17 00:29:57 +01:00
},
plugins: [
new webpack.DefinePlugin({
"process.env.CI": process.env.CI || false,
"process.env.DISPLAY": "Browser",
}),
new webpack.ProvidePlugin({
process: "process/browser.js"
})
],
2022-09-23 21:35:17 -04:00
resolve: {
extensions: [".ts", ".tsx", ".js"],
2024-02-17 00:29:57 +01:00
extensionAlias: {
".js": [".js", ".ts"],
".cjs": [".cjs", ".cts"],
".mjs": [".mjs", ".mts"]
}
2022-09-06 12:06:19 -04:00
},
2024-02-17 00:29:57 +01:00
stats: { warnings: false },
devtool: "inline-source-map"
2024-02-29 23:15:05 +01:00
},
2022-09-06 12:06:19 -04:00
});
2024-02-29 23:15:05 +01:00
};