js-noise/karma.conf.cjs

61 lines
1.3 KiB
JavaScript
Raw Normal View History

2022-11-13 13:39:26 +00:00
process.env.CHROME_BIN = require("puppeteer").executablePath();
const os = require("os");
const path = require("path");
const ResolveTypeScriptPlugin = require("resolve-typescript-plugin");
const output = {
2022-11-15 21:56:25 +00:00
path: path.join(os.tmpdir(), "_karma_webpack_") + Math.floor(Math.random() * 1000000),
2022-11-13 13:39:26 +00:00
};
module.exports = function (config) {
config.set({
2023-01-31 23:34:05 +00:00
frameworks: ["webpack", "mocha"],
2022-11-13 13:39:26 +00:00
preprocessors: {
2023-01-31 23:27:23 +00:00
"**/*.ts": ["webpack"],
2022-11-13 13:39:26 +00:00
},
files: [
"src/**/*.spec.ts",
"src/**/*.ts",
{
pattern: `${output.path}/**/*`,
watched: false,
included: false,
served: true,
},
],
envPreprocessor: ["CI"],
reporters: ["progress"],
browsers: ["ChromeHeadless"],
singleRun: true,
client: {
mocha: {
timeout: 6000, // Default is 2s
},
},
webpack: {
mode: "production",
module: {
rules: [
{
test: /\.wasm$/,
type: "asset/resource",
},
{
test: /\.(js|tsx?)$/,
loader: "ts-loader",
2023-02-01 00:43:40 +00:00
exclude: /node_modules|\.d\.ts$/,
2022-11-13 13:39:26 +00:00
options: { configFile: "tsconfig.karma.json" },
},
2023-02-01 00:02:03 +00:00
{
test: /\.d\.ts$/,
loader: "ignore-loader",
},
2022-11-13 13:39:26 +00:00
],
},
output,
},
});
};