Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update karma test configuration for track2 packages #13309

Merged
10 commits merged into from
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions sdk/anomalydetector/ai-anomaly-detector/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = function(config) {
"karma-ie-launcher",
"karma-env-preprocessor",
"karma-coverage",
"karma-remap-istanbul",
"karma-sourcemap-loader",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @xirzec, this is amazing!

I've been meaning to try karma-typescript instead, have you tried that too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

karma-typescript expects to read in TS files and do the compilation -- but since this is a browser bundle, we really want rollup to make the test js file for us with all the browser versions of modules. Not sure that we can do this with karma-typescript.

Copy link
Member

@HarshaNalluru HarshaNalluru Jan 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it takes TS files. But, since we are not publishing the browser bundle anyway, what's the point of making a bundle for tests?

Is the idea that it would closely represent how the user may do the bundling?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bundle makes sure our browser versions of files work as expected. And you can't really test without bundling in some form since we're not really using es module support in the browser yet.

"karma-junit-reporter",
"karma-json-preprocessor",
"karma-json-to-file-reporter"
Expand All @@ -44,7 +44,7 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"**/*.js": ["env"],
"**/*.js": ["sourcemap", "env"],
"recordings/browsers/**/*.json": ["json"],
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
// Preprocess source file to calculate code coverage, however this will make source file unreadable
Expand All @@ -56,22 +56,17 @@ module.exports = function(config) {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["mocha", "coverage", "karma-remap-istanbul", "junit", "json-to-file"],
reporters: ["mocha", "coverage", "junit", "json-to-file"],

coverageReporter: {
// specify a common output directory
dir: "coverage-browser/",
reporters: [{ type: "json", subdir: ".", file: "coverage.json" }]
},

remapIstanbulReporter: {
src: "coverage-browser/coverage.json",
reports: {
lcovonly: "coverage-browser/lcov.info",
html: "coverage-browser/html/report",
"text-summary": null,
cobertura: "./coverage-browser/cobertura-coverage.xml"
}
reporters: [
{ type: "json", subdir: ".", file: "coverage.json" },
{ type: "lcovonly", subdir: ".", file: "lcov.info" },
{ type: "html", subdir: "html" },
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }
]
},

junitReporter: {
Expand Down
2 changes: 1 addition & 1 deletion sdk/anomalydetector/ai-anomaly-detector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"karma-junit-reporter": "^2.0.1",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-remap-istanbul": "^0.6.0",
"karma-sourcemap-loader": "^0.3.8",
"mocha": "^7.1.1",
"mocha-junit-reporter": "^1.18.0",
"nyc": "^14.0.0",
Expand Down
21 changes: 8 additions & 13 deletions sdk/appconfiguration/app-configuration/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = function(config) {
"karma-ie-launcher",
"karma-env-preprocessor",
"karma-coverage",
"karma-remap-istanbul",
"karma-sourcemap-loader",
"karma-junit-reporter"
],

Expand Down Expand Up @@ -59,22 +59,17 @@ module.exports = function(config) {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["mocha", "coverage", "karma-remap-istanbul", "junit"],
reporters: ["mocha", "coverage", "junit"],

coverageReporter: {
// specify a common output directory
dir: "coverage-browser/",
reporters: [{ type: "json", subdir: ".", file: "coverage.json" }]
},

remapIstanbulReporter: {
src: "coverage-browser/coverage.json",
reports: {
lcovonly: "coverage-browser/lcov.info",
html: "coverage-browser/html/report",
"text-summary": null,
cobertura: "./coverage-browser/cobertura-coverage.xml"
}
reporters: [
{ type: "json", subdir: ".", file: "coverage.json" },
{ type: "lcovonly", subdir: ".", file: "lcov.info" },
{ type: "html", subdir: "html" },
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }
]
},

junitReporter: {
Expand Down
2 changes: 1 addition & 1 deletion sdk/appconfiguration/app-configuration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"karma-junit-reporter": "^2.0.1",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-remap-istanbul": "^0.6.0",
"karma-sourcemap-loader": "^0.3.8",
"mocha": "^7.1.1",
"mocha-junit-reporter": "^1.18.0",
"nock": "^12.0.3",
Expand Down
25 changes: 7 additions & 18 deletions sdk/communication/communication-administration/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = function(config) {
"karma-ie-launcher",
"karma-env-preprocessor",
"karma-coverage",
"karma-remap-istanbul",
"karma-sourcemap-loader",
"karma-junit-reporter",
"karma-json-to-file-reporter",
"karma-json-preprocessor"
Expand All @@ -46,7 +46,7 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"**/*.js": ["env"],
"**/*.js": ["sourcemap", "env"],
"recordings/browsers/**/*.json": ["json"]
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
// Preprocess source file to calculate code coverage, however this will make source file unreadable
Expand All @@ -69,30 +69,19 @@ module.exports = function(config) {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["mocha", "coverage", "karma-remap-istanbul", "junit", "json-to-file"],
reporters: ["mocha", "coverage", "junit", "json-to-file"],

coverageReporter: {
// specify a common output directory
dir: "coverage-browser/",
reporters: [
{
type: "json",
subdir: ".",
file: "coverage.json"
}
{ type: "json", subdir: ".", file: "coverage.json" },
{ type: "lcovonly", subdir: ".", file: "lcov.info" },
{ type: "html", subdir: "html" },
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }
]
},

remapIstanbulReporter: {
src: "coverage-browser/coverage.json",
reports: {
lcovonly: "coverage-browser/lcov.info",
html: "coverage-browser/html/report",
"text-summary": null,
cobertura: "./coverage-browser/cobertura-coverage.xml"
}
},

junitReporter: {
outputDir: "", // results will be saved as $outputDir/$browserName.xml
outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"karma-junit-reporter": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-mocha": "^2.0.1",
"karma-remap-istanbul": "^0.6.0",
"karma-sourcemap-loader": "^0.3.8",
"karma": "^5.1.0",
"mocha-junit-reporter": "^1.18.0",
"mocha": "^7.1.1",
Expand Down
25 changes: 7 additions & 18 deletions sdk/communication/communication-chat/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = function(config) {
"karma-ie-launcher",
"karma-env-preprocessor",
"karma-coverage",
"karma-remap-istanbul",
"karma-sourcemap-loader",
"karma-junit-reporter",
"karma-json-to-file-reporter",
"karma-json-preprocessor"
Expand All @@ -46,7 +46,7 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"**/*.js": ["env"],
"**/*.js": ["sourcemap", "env"],
"recordings/browsers/**/*.json": ["json"]
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
// Preprocess source file to calculate code coverage, however this will make source file unreadable
Expand All @@ -61,30 +61,19 @@ module.exports = function(config) {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["mocha", "coverage", "karma-remap-istanbul", "junit", "json-to-file"],
reporters: ["mocha", "coverage", "junit", "json-to-file"],

coverageReporter: {
// specify a common output directory
dir: "coverage-browser/",
reporters: [
{
type: "json",
subdir: ".",
file: "coverage.json"
}
{ type: "json", subdir: ".", file: "coverage.json" },
{ type: "lcovonly", subdir: ".", file: "lcov.info" },
{ type: "html", subdir: "html" },
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }
]
},

remapIstanbulReporter: {
src: "coverage-browser/coverage.json",
reports: {
lcovonly: "coverage-browser/lcov.info",
html: "coverage-browser/html/report",
"text-summary": null,
cobertura: "./coverage-browser/cobertura-coverage.xml"
}
},

junitReporter: {
outputDir: "", // results will be saved as $outputDir/$browserName.xml
outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile
Expand Down
2 changes: 1 addition & 1 deletion sdk/communication/communication-chat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"karma-junit-reporter": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-mocha": "^2.0.1",
"karma-remap-istanbul": "^0.6.0",
"karma-sourcemap-loader": "^0.3.8",
"karma": "^5.1.0",
"mocha-junit-reporter": "^1.18.0",
"mocha": "^7.1.1",
Expand Down
25 changes: 7 additions & 18 deletions sdk/communication/communication-sms/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = function(config) {
"karma-ie-launcher",
"karma-env-preprocessor",
"karma-coverage",
"karma-remap-istanbul",
"karma-sourcemap-loader",
"karma-junit-reporter",
"karma-json-to-file-reporter",
"karma-json-preprocessor"
Expand All @@ -46,7 +46,7 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"**/*.js": ["env"],
"**/*.js": ["sourcemap", "env"],
"recordings/browsers/**/*.json": ["json"]
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
// Preprocess source file to calculate code coverage, however this will make source file unreadable
Expand All @@ -69,30 +69,19 @@ module.exports = function(config) {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["mocha", "coverage", "karma-remap-istanbul", "junit", "json-to-file"],
reporters: ["mocha", "coverage", "junit", "json-to-file"],

coverageReporter: {
// specify a common output directory
dir: "coverage-browser/",
reporters: [
{
type: "json",
subdir: ".",
file: "coverage.json"
}
{ type: "json", subdir: ".", file: "coverage.json" },
{ type: "lcovonly", subdir: ".", file: "lcov.info" },
{ type: "html", subdir: "html" },
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }
]
},

remapIstanbulReporter: {
src: "coverage-browser/coverage.json",
reports: {
lcovonly: "coverage-browser/lcov.info",
html: "coverage-browser/html/report",
"text-summary": null,
cobertura: "./coverage-browser/cobertura-coverage.xml"
}
},

junitReporter: {
outputDir: "", // results will be saved as $outputDir/$browserName.xml
outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile
Expand Down
2 changes: 1 addition & 1 deletion sdk/communication/communication-sms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"karma-junit-reporter": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-mocha": "^2.0.1",
"karma-remap-istanbul": "^0.6.0",
"karma-sourcemap-loader": "^0.3.8",
"karma": "^5.1.0",
"mocha-junit-reporter": "^1.18.0",
"mocha": "^7.1.1",
Expand Down
29 changes: 12 additions & 17 deletions sdk/core/abort-controller/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
process.env.CHROME_BIN = require("puppeteer").executablePath();
require("dotenv").config({ path: "../.env" });

module.exports = function(config) {
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "./",
Expand All @@ -20,8 +20,8 @@ module.exports = function(config) {
"karma-ie-launcher",
"karma-env-preprocessor",
"karma-coverage",
"karma-remap-istanbul",
"karma-junit-reporter"
"karma-junit-reporter",
"karma-sourcemap-loader"
],

// list of files / patterns to load in the browser
Expand All @@ -36,31 +36,26 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"**/*.js": ["env"]
"**/*.js": ["sourcemap", "env"],
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
// Preprocess source file to calculate code coverage, however this will make source file unreadable
// "test-browser/index.js": ["coverage"]
"test-browser/index.js": ["coverage"]
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["mocha", "coverage", "karma-remap-istanbul", "junit"],
reporters: ["mocha", "coverage", "junit"],

coverageReporter: {
// specify a common output directory
dir: "coverage-browser/",
reporters: [{ type: "json", subdir: ".", file: "coverage.json" }]
},

remapIstanbulReporter: {
src: "coverage-browser/coverage.json",
reports: {
lcovonly: "coverage-browser/lcov.info",
html: "coverage-browser/html/report",
"text-summary": null,
cobertura: "./coverage-browser/cobertura-coverage.xml"
}
reporters: [
{ type: "json", subdir: ".", file: "coverage.json" },
{ type: "lcovonly", subdir: ".", file: "lcov.info" },
{ type: "html", subdir: "html" },
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }
]
},

junitReporter: {
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/abort-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"karma-junit-reporter": "^2.0.1",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-remap-istanbul": "^0.6.0",
"karma-sourcemap-loader": "^0.3.8",
"mocha": "^7.1.1",
"mocha-junit-reporter": "^1.18.0",
"nyc": "^14.0.0",
Expand Down
Loading