Skip to content

Commit 08ad5e7

Browse files
patrickCodePratik Bhattacharya
andauthored
feat (tests): Added headless test for github workflows (#5)
Co-authored-by: Pratik Bhattacharya <pratikb@microsoft.com>
1 parent 0150378 commit 08ad5e7

File tree

3 files changed

+76
-2
lines changed

3 files changed

+76
-2
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ When you submit a pull request, a CLA-bot will automatically determine whether y
99
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
1010
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
1111

12+
If you are adding new features please add unit test cases. For the modification of any existing feature
13+
ensure all existing test cases are running.
14+
1215
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
1316
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
1417
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

karma.conf.headless.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
module.exports = function (config) {
2+
config.set({
3+
frameworks: ["jasmine", "karma-typescript"],
4+
files: [
5+
{ pattern: "src/**/*.ts" },
6+
{ pattern: "test/**/*.ts" }
7+
],
8+
preprocessors: {
9+
"src/**/*.ts": ["karma-typescript"],
10+
"test/**/*.ts": "karma-typescript"
11+
},
12+
reporters: ["progress"],
13+
customLaunchers: {
14+
ChromeHeadlessCustom: {
15+
base: 'ChromeHeadless',
16+
flags: ['--no-sandbox', '--disable-gpu']
17+
}
18+
},
19+
browsers: ["ChromeHeadlessCustom"],
20+
karmaTypescriptConfig: {
21+
coverageReporter: {
22+
instrumenterOptions: {
23+
istanbul: { noCompact: true }
24+
}
25+
},
26+
bundlerOptions: {
27+
transforms: [
28+
require("karma-typescript-es6-transform")({
29+
presets: [
30+
["env", {
31+
targets: {
32+
chrome: "60"
33+
}
34+
}]
35+
]
36+
})
37+
]
38+
},
39+
compilerOptions: {
40+
module: "commonjs",
41+
sourceMap: true,
42+
target: "es6",
43+
allowJs: false,
44+
declaration: true,
45+
moduleResolution: "node",
46+
skipLibCheck: true,
47+
lib: ["es2017", "DOM"],
48+
downlevelIteration: true
49+
},
50+
typeRoots: [
51+
"node_modules/@types"
52+
],
53+
exclude: [
54+
"node_modules/**/*"
55+
]
56+
},
57+
singleRun: true,
58+
autoWatch: false,
59+
plugins: ['karma-jasmine', 'karma-chrome-launcher', 'karma-typescript']
60+
});
61+
};

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@
99
"url": "https://www.devcompost.com/"
1010
},
1111
"homepage": "https://github.com/microsoft/redux-micro-frontend",
12-
"keywords": ["redux", "micro frontend", "microfrontend", "microfrontends", "micro frontends", "state", "statemanagement"],
12+
"keywords": [
13+
"redux",
14+
"micro frontend",
15+
"microfrontend",
16+
"microfrontends",
17+
"micro frontends",
18+
"state",
19+
"statemanagement"
20+
],
1321
"bugs": {
1422
"url": "https://github.com/microsoft/redux-micro-frontend/issues",
1523
"email": "pratikb@microsoft.com"
@@ -20,7 +28,8 @@
2028
},
2129
"scripts": {
2230
"build": "tsc",
23-
"test": "karma start karma.conf.js",
31+
"test-chrome": "karma start karma.conf.js",
32+
"test": "karma start karma.conf.headless.js",
2433
"release:pre": "npm run build && npm version prerelease && npm run copyfiles:publish-beta",
2534
"release:patch": "npm run build && npm version patch && npm run copyfiles:publish",
2635
"release:minor": "npm run build && npm version minor && npm run copyfiles:publish",
@@ -48,6 +57,7 @@
4857
"karma-jasmine": "^3.3.1",
4958
"karma-typescript": "^4.1.1",
5059
"karma-typescript-es6-transform": "^4.1.1",
60+
"puppeteer": "^5.5.0",
5161
"rimraf": "^3.0.2",
5262
"typescript": "^3.5.3"
5363
}

0 commit comments

Comments
 (0)