Show errors from Karma (#2545)
This commit is contained in:
parent
93cfdeb572
commit
bc8aae5d50
|
|
@ -1,12 +1,13 @@
|
|||
const path = require("path");
|
||||
try {
|
||||
const path = require("path");
|
||||
|
||||
let defaultReporters = ["progress", "summary"];
|
||||
let defaultReporters = ["progress", "summary"];
|
||||
|
||||
/** Creates the Karma config function based on the provided options
|
||||
/** Creates the Karma config function based on the provided options
|
||||
*
|
||||
* @param {object} config Configuration options to override on/add to the base config.
|
||||
*/
|
||||
function createKarmaConfig(config) {
|
||||
function createKarmaConfig(config) {
|
||||
return function (karmaConfig) {
|
||||
karmaConfig.set({
|
||||
basePath: path.resolve(__dirname, ".."),
|
||||
|
|
@ -46,6 +47,9 @@ function createKarmaConfig(config) {
|
|||
reporters: [...defaultReporters, ...(config.reporters || [])],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = createKarmaConfig;
|
||||
module.exports = createKarmaConfig;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
|
@ -1,28 +1,29 @@
|
|||
// Karma configuration for a local run (the default)
|
||||
const createKarmaConfig = require("./karma.base.conf");
|
||||
const fs = require("fs");
|
||||
const which = require("which");
|
||||
try {
|
||||
// Karma configuration for a local run (the default)
|
||||
const createKarmaConfig = require("./karma.base.conf");
|
||||
const fs = require("fs");
|
||||
const which = require("which");
|
||||
|
||||
// Bring in the launchers directly to detect browsers
|
||||
const ChromeHeadlessBrowser = require("karma-chrome-launcher")["launcher:ChromeHeadless"][1];
|
||||
const ChromiumHeadlessBrowser = require("karma-chrome-launcher")["launcher:ChromiumHeadless"][1];
|
||||
const FirefoxHeadlessBrowser = require("karma-firefox-launcher")["launcher:FirefoxHeadless"][1];
|
||||
const EdgeBrowser = require("karma-edge-launcher")["launcher:Edge"][1];
|
||||
const SafariBrowser = require("karma-safari-launcher")["launcher:Safari"][1];
|
||||
const IEBrowser = require("karma-ie-launcher")["launcher:IE"][1];
|
||||
// Bring in the launchers directly to detect browsers
|
||||
const ChromeHeadlessBrowser = require("karma-chrome-launcher")["launcher:ChromeHeadless"][1];
|
||||
const ChromiumHeadlessBrowser = require("karma-chrome-launcher")["launcher:ChromiumHeadless"][1];
|
||||
const FirefoxHeadlessBrowser = require("karma-firefox-launcher")["launcher:FirefoxHeadless"][1];
|
||||
const EdgeBrowser = require("karma-edge-launcher")["launcher:Edge"][1];
|
||||
const SafariBrowser = require("karma-safari-launcher")["launcher:Safari"][1];
|
||||
const IEBrowser = require("karma-ie-launcher")["launcher:IE"][1];
|
||||
|
||||
let browsers = [];
|
||||
let browsers = [];
|
||||
|
||||
function browserExists(path) {
|
||||
function browserExists(path) {
|
||||
// On linux, the browsers just return the command, not a path, so we need to check if it exists.
|
||||
if (process.platform === "linux") {
|
||||
return !!which.sync(path, { nothrow: true });
|
||||
} else {
|
||||
return fs.existsSync(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function tryAddBrowser(name, b) {
|
||||
function tryAddBrowser(name, b) {
|
||||
var path = b.DEFAULT_CMD[process.platform];
|
||||
if (b.ENV_CMD && process.env[b.ENV_CMD]) {
|
||||
path = process.env[b.ENV_CMD];
|
||||
|
|
@ -36,20 +37,23 @@ function tryAddBrowser(name, b) {
|
|||
else {
|
||||
console.log(`Unable to locate ${name}. Skipping.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We use the launchers themselves to figure out if the browser exists. It's a bit sneaky, but it works.
|
||||
tryAddBrowser("ChromeHeadless", new ChromeHeadlessBrowser(() => { }, {}));
|
||||
tryAddBrowser("ChromiumHeadless", new ChromiumHeadlessBrowser(() => { }, {}));
|
||||
tryAddBrowser("FirefoxHeadless", new FirefoxHeadlessBrowser(0, () => { }, {}));
|
||||
// We use the launchers themselves to figure out if the browser exists. It's a bit sneaky, but it works.
|
||||
tryAddBrowser("ChromeHeadless", new ChromeHeadlessBrowser(() => { }, {}));
|
||||
tryAddBrowser("ChromiumHeadless", new ChromiumHeadlessBrowser(() => { }, {}));
|
||||
tryAddBrowser("FirefoxHeadless", new FirefoxHeadlessBrowser(0, () => { }, {}));
|
||||
|
||||
// We need to receive an argument from the caller, but globals don't seem to work, so we use an environment variable.
|
||||
if (process.env.ASPNETCORE_SIGNALR_TEST_ALL_BROWSERS === "true") {
|
||||
// We need to receive an argument from the caller, but globals don't seem to work, so we use an environment variable.
|
||||
if (process.env.ASPNETCORE_SIGNALR_TEST_ALL_BROWSERS === "true") {
|
||||
tryAddBrowser("Edge", new EdgeBrowser(() => { }, { create() { } }));
|
||||
tryAddBrowser("IE", new IEBrowser(() => { }, { create() { } }, {}));
|
||||
tryAddBrowser("Safari", new SafariBrowser(() => { }, {}));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = createKarmaConfig({
|
||||
module.exports = createKarmaConfig({
|
||||
browsers,
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
// Karma configuration for a SauceLabs-based CI run.
|
||||
const createKarmaConfig = require("./karma.base.conf");
|
||||
try {
|
||||
// Karma configuration for a SauceLabs-based CI run.
|
||||
const createKarmaConfig = require("./karma.base.conf");
|
||||
|
||||
// "Evergreen" Desktop Browsers
|
||||
var evergreenBrowsers = {
|
||||
// "Evergreen" Desktop Browsers
|
||||
var evergreenBrowsers = {
|
||||
// Microsoft Edge Latest, Windows 10
|
||||
sl_edge_win10: {
|
||||
base: "SauceLabs",
|
||||
|
|
@ -31,10 +32,10 @@ var evergreenBrowsers = {
|
|||
browserName: "firefox",
|
||||
version: "latest",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Legacy Browsers
|
||||
var legacyBrowsers = {
|
||||
// Legacy Browsers
|
||||
var legacyBrowsers = {
|
||||
// Microsoft Internet Explorer 11, Windows 7
|
||||
sl_ie11_win7: {
|
||||
base: "SauceLabs",
|
||||
|
|
@ -42,19 +43,19 @@ var legacyBrowsers = {
|
|||
version: "11",
|
||||
platform: "Windows 7",
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
// Mobile Browsers
|
||||
// TODO: Fill this in.
|
||||
var mobileBrowsers = {};
|
||||
// Mobile Browsers
|
||||
// TODO: Fill this in.
|
||||
var mobileBrowsers = {};
|
||||
|
||||
var customLaunchers = {
|
||||
var customLaunchers = {
|
||||
...evergreenBrowsers,
|
||||
...legacyBrowsers,
|
||||
...mobileBrowsers,
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = createKarmaConfig({
|
||||
module.exports = createKarmaConfig({
|
||||
customLaunchers,
|
||||
browsers: Object.keys(customLaunchers),
|
||||
reporters: ["saucelabs"],
|
||||
|
|
@ -65,4 +66,7 @@ module.exports = createKarmaConfig({
|
|||
noSslBumpDomains: ["all"]
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
Loading…
Reference in New Issue