-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KeyVault-Certificates] Rollup and test utils (#4749)
- Loading branch information
Showing
16 changed files
with
1,827 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
// https://github.com/karma-runner/karma-chrome-launcher | ||
process.env.CHROME_BIN = require("puppeteer").executablePath(); | ||
require("dotenv").config({ path: "../.env" }); | ||
|
||
module.exports = function(config) { | ||
config.set({ | ||
basePath: "./", | ||
frameworks: ["mocha"], | ||
|
||
plugins: [ | ||
"karma-mocha", | ||
"karma-mocha-reporter", | ||
"karma-chrome-launcher", | ||
"karma-edge-launcher", | ||
"karma-firefox-launcher", | ||
"karma-ie-launcher", | ||
"karma-env-preprocessor", | ||
"karma-coverage", | ||
"karma-remap-coverage", | ||
"karma-junit-reporter", | ||
"karma-json-to-file-reporter", | ||
"karma-json-preprocessor" | ||
], | ||
|
||
files: [ | ||
// polyfill service supporting IE11 missing features | ||
// Promise,String.prototype.startsWith,String.prototype.endsWith,String.prototype.repeat,String.prototype.includes,Array.prototype.includes,Object.keys | ||
"https://cdn.polyfill.io/v2/polyfill.js?features=Promise,String.prototype.startsWith,String.prototype.endsWith,String.prototype.repeat,String.prototype.includes,Array.prototype.includes,Object.keys|always", | ||
"dist-test/index.browser.js", | ||
"recordings/browsers/**/*.json" | ||
], | ||
|
||
exclude: [], | ||
|
||
preprocessors: { | ||
"**/*.js": ["env"], | ||
"dist-test/index.browser.js": ["coverage"], | ||
"recordings/browsers/**/*.json": ["json"] | ||
}, | ||
|
||
envPreprocessor: [ | ||
"AZURE_CLIENT_ID", | ||
"AZURE_CLIENT_SECRET", | ||
"AZURE_TENANT_ID", | ||
"KEYVAULT_NAME", | ||
"TEST_MODE" | ||
], | ||
|
||
reporters: ["mocha", "coverage", "remap-coverage", "junit", "json-to-file"], | ||
|
||
coverageReporter: { type: "in-memory" }, | ||
|
||
remapCoverageReporter: { | ||
"text-summary": null, | ||
html: "./coverage-browser", | ||
cobertura: "./coverage-browser/cobertura-coverage.xml" | ||
}, | ||
|
||
remapOptions: { | ||
exclude: /node_modules|tests/g | ||
}, | ||
|
||
junitReporter: { | ||
outputDir: "", | ||
outputFile: "test-results.browser.xml", | ||
suite: "", | ||
useBrowserName: false, | ||
nameFormatter: undefined, | ||
classNameFormatter: undefined, | ||
properties: {} | ||
}, | ||
|
||
jsonToFileReporter: { | ||
filter: function(obj) { | ||
if (obj.writeFile) { | ||
const fs = require("fs-extra"); | ||
try { | ||
// Stripping away the filename from the file path and retaining the directory structure | ||
fs.ensureDirSync(obj.path.substring(0, obj.path.lastIndexOf("/") + 1)); | ||
} catch (err) { | ||
if (err.code !== "EEXIST") throw err; | ||
} | ||
fs.writeFile(obj.path, JSON.stringify(obj.content, null, " "), (err) => { | ||
if (err) { | ||
throw err; | ||
} | ||
}); | ||
} | ||
return false; | ||
}, | ||
outputPath: "." | ||
}, | ||
|
||
port: 9328, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: false, | ||
|
||
// --no-sandbox allows our tests to run in Linux without having to change the system. | ||
// --disable-web-security allows us to authenticate from the browser without having to write tests using interactive auth, which would be far more complex. | ||
browsers: ["ChromeHeadlessNoSandbox"], | ||
customLaunchers: { | ||
ChromeHeadlessNoSandbox: { | ||
base: "ChromeHeadless", | ||
flags: ["--no-sandbox", "--disable-web-security"] | ||
} | ||
}, | ||
|
||
singleRun: false, | ||
concurrency: 1, | ||
|
||
browserNoActivityTimeout: 600000, | ||
browserDisconnectTimeout: 10000, | ||
browserDisconnectTolerance: 3, | ||
browserConsoleLogOptions: { | ||
// IMPORTANT: COMMENT the following line if you want to print debug logs in your browsers in record mode!! | ||
terminal: process.env.TEST_MODE !== "record" | ||
}, | ||
|
||
client: { | ||
mocha: { | ||
// change Karma's debug.html to the mocha web reporter | ||
reporter: "html", | ||
timeout: "600000" | ||
} | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.