Skip to content

Commit

Permalink
[Anomaly Detector] Enable CI and add tests (#23725)
Browse files Browse the repository at this point in the history
* Enable CI

* Add changelog

* Fix format

* Fix package pipeline name

* Set correct version

* Fix env variable name

* Re-record
  • Loading branch information
joheredi authored Nov 5, 2022
1 parent 526926a commit 9158f92
Show file tree
Hide file tree
Showing 14 changed files with 1,005 additions and 39 deletions.
5 changes: 5 additions & 0 deletions sdk/anomalydetector/ai-anomaly-detector-rest/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release History

## 1.0.0-beta.1 (2022-11-08)

- First release of package, see README.md for details.
34 changes: 16 additions & 18 deletions sdk/anomalydetector/ai-anomaly-detector-rest/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require("dotenv").config();
const { relativeRecordingsPath } = require("@azure-tools/test-recorder");
process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();

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 @@ -27,7 +27,7 @@ module.exports = function(config) {
"karma-coverage",
"karma-sourcemap-loader",
"karma-junit-reporter",
"karma-source-map-support"
"karma-source-map-support",
],

// list of files / patterns to load in the browser
Expand All @@ -37,8 +37,8 @@ module.exports = function(config) {
pattern: "dist-test/index.browser.js.map",
type: "html",
included: false,
served: true
}
served: true,
},
],

// list of files / patterns to exclude
Expand All @@ -47,19 +47,17 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"**/*.js": ["sourcemap", "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
// "dist-test/index.js": ["coverage"]
},

envPreprocessor: [
"TEST_MODE",
"ENDPOINT",
"AZURE_CLIENT_SECRET",
"AZURE_CLIENT_ID",
"AZURE_TENANT_ID",
"SUBSCRIPTION_ID"
"ANOMALY_DETECTOR_API_KEY",
"ANOMALY_DETECTOR_ENDPOINT",
"RECORDINGS_RELATIVE_PATH",
],

// test results reporter to use
Expand All @@ -74,8 +72,8 @@ module.exports = function(config) {
{ type: "json", subdir: ".", file: "coverage.json" },
{ type: "lcovonly", subdir: ".", file: "lcov.info" },
{ type: "html", subdir: "html" },
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }
]
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" },
],
},

junitReporter: {
Expand All @@ -85,7 +83,7 @@ module.exports = function(config) {
useBrowserName: false, // add browser name to report and classes names
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
properties: {} // key value pair of properties to add to the <properties> section of the report
properties: {}, // key value pair of properties to add to the <properties> section of the report
},

// web server port
Expand All @@ -107,8 +105,8 @@ module.exports = function(config) {
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: "ChromeHeadless",
flags: ["--no-sandbox", "--disable-web-security"]
}
flags: ["--no-sandbox", "--disable-web-security"],
},
},

// Continuous Integration mode
Expand All @@ -127,8 +125,8 @@ module.exports = function(config) {
mocha: {
// change Karma's debug.html to the mocha web reporter
reporter: "html",
timeout: "600000"
}
}
timeout: "600000",
},
},
});
};
Loading

0 comments on commit 9158f92

Please sign in to comment.