Skip to content

Commit 828277d

Browse files
Updated tests to work on GitHub Actions
1 parent 88def15 commit 828277d

File tree

4 files changed

+28
-21
lines changed

4 files changed

+28
-21
lines changed

karma.conf.js

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,37 @@
33
// https://jstools.dev/karma-config/
44

55
"use strict";
6+
67
const { karmaConfig } = require("@jsdevtools/karma-config");
7-
let exclude = [];
8+
const { host } = require("@jsdevtools/host-environment");
9+
10+
// let exclude = [];
811

9-
if (process.env.WINDOWS && process.env.CI) {
10-
// We're running in a Windows CI/CD environment, so Karma-Config will use SauceLabs.
11-
// The following tests tend to fail on SauceLabs, probably due to zero-byte files
12-
// and special characters in the paths. So, exclude them.
13-
exclude.push(
14-
"test/specs/__*/**",
15-
"test/specs/blank/**/*.spec.js",
16-
"test/specs/circular*/**/*.spec.js",
17-
"test/specs/empty/**/*.spec.js",
18-
"test/specs/invalid/**/*.spec.js",
19-
"test/specs/parsers/**/*.spec.js"
20-
);
21-
}
12+
// if (host.os.windows && host.ci) {
13+
// // We're running in a Windows CI/CD environment, so Karma-Config will use SauceLabs.
14+
// // The following tests tend to fail on SauceLabs, probably due to zero-byte files
15+
// // and special characters in the paths. So, exclude them.
16+
// exclude.push(
17+
// "test/specs/__*/**",
18+
// "test/specs/blank/**/*.spec.js",
19+
// "test/specs/circular*/**/*.spec.js",
20+
// "test/specs/empty/**/*.spec.js",
21+
// "test/specs/invalid/**/*.spec.js",
22+
// "test/specs/parsers/**/*.spec.js"
23+
// );
24+
// }
2225

2326
module.exports = karmaConfig({
2427
sourceDir: "lib",
2528
fixtures: "test/fixtures/**/*.js",
2629
browsers: {
27-
ie: true,
30+
chrome: !host.os.windows,
31+
firefox: host.os.linux,
32+
safari: host.os.linux, // SauceLabs
33+
edge: host.os.linux, // SauceLabs
34+
ie: host.os.windows,
2835
},
29-
config: {
30-
exclude,
31-
}
36+
// config: {
37+
// exclude,
38+
// }
3239
});

test/fixtures/mocha.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if (host.browser) {
1313

1414
beforeEach(function () {
1515
// Flag TravisCI and SauceLabs as being very slow environments
16-
let isSlowEnvironment = host.env.CI || host.karma;
16+
let isSlowEnvironment = host.ci || host.karma;
1717

1818
// Most of our tests perform multiple AJAX requests,
1919
// so we need to increase the timeouts to allow for that

test/fixtures/polyfill.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const { host } = require("@jsdevtools/host-environment");
55
// Load the Babel Polyfills for old browsers.
66
// NOTE: It's important that we ONLY do this when needed,
77
// to ensure that our code works _without_ polyfills everywhere else
8-
if (host.os.windows) {
8+
if (host.browser.IE) {
99
require("@babel/polyfill");
1010
}

test/specs/http.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe("HTTP options", () => {
5050
});
5151

5252
describe("http.redirect", () => {
53-
if (host.karma && host.env.CI) {
53+
if (host.browser.safari && host.karma && host.karma.ci) {
5454
// These tests fail in Safari when running on Sauce Labs (they pass when running on Safari locally).
5555
// It gets an XHR error when trying to reach httpbin.org.
5656
// TODO: Only skip these tests on Safari on Sauce Labs

0 commit comments

Comments
 (0)