Skip to content

Commit d9e4bcb

Browse files
authored
feat: add Firefox and Webkit to karma (#1598)
* add Firefox and Webkit to karma testing * try adding install to CI * add display var * try container prop * try FirefoxHeadless * set env var differently * apply for all configs * use root karma config * fix relative link in karma config * add log * return as before * fix path pattern * move karma to the root * try moving tsconfig * return ts config * use container for playwright * add FF for firefox and chrome * use command for playwright * add retries * remove retries
1 parent db46217 commit d9e4bcb

File tree

14 files changed

+279
-1402
lines changed

14 files changed

+279
-1402
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
with:
6565
node-version: ${{ env.NODE_JS }}
6666
- uses: ./.github/actions/npm
67+
- run: npx playwright install --with-deps
6768
- run: npm run build:esm
6869
- run: npm run test:browser
6970

karma.conf.cjs

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
const webpack = require("webpack");
2+
const playwright = require('playwright');
3+
4+
process.env.CHROME_BIN = playwright.chromium.executablePath();
5+
process.env.FIREFOX_BIN = playwright.firefox.executablePath();
6+
process.env.WEBKIT_HEADLESS_BIN = playwright.webkit.executablePath();
7+
8+
module.exports = function (config) {
9+
config.set({
10+
frameworks: ["webpack", "mocha"],
11+
files: ["src/**/!(node).spec.ts"],
12+
preprocessors: {
13+
"src/**/!(node).spec.ts": ["webpack"]
14+
},
15+
envPreprocessor: ["CI"],
16+
reporters: ["progress"],
17+
browsers: ["ChromeHeadless", "FirefoxHeadless", "WebkitHeadless"],
18+
singleRun: true,
19+
client: {
20+
mocha: {
21+
timeout: 6000 // Default is 2s
22+
}
23+
},
24+
webpack: {
25+
mode: "development",
26+
module: {
27+
rules: [{ test: /\.([cm]?ts|tsx)$/, loader: "ts-loader" }]
28+
},
29+
plugins: [
30+
new webpack.DefinePlugin({
31+
"process.env.CI": process.env.CI || false,
32+
"process.env.DISPLAY": "Browser",
33+
}),
34+
new webpack.ProvidePlugin({
35+
process: "process/browser.js"
36+
})
37+
],
38+
resolve: {
39+
extensions: [".ts", ".tsx", ".js"],
40+
extensionAlias: {
41+
".js": [".js", ".ts"],
42+
".cjs": [".cjs", ".cts"],
43+
".mjs": [".mjs", ".mts"]
44+
}
45+
},
46+
stats: { warnings: false },
47+
devtool: "inline-source-map"
48+
}
49+
});
50+
};

0 commit comments

Comments
 (0)