diff --git a/.eslintrc.json b/.eslintrc.json index c4a67231b..e0e705f21 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -42,7 +42,7 @@ "no-console": "error", "compat/compat": [ "error", - "android >= 4.3, firefox >= 45, ie >= 11, safari >= 9.1, ios_saf >= 7, chrome >= 58" + "android >= 4.3, firefox >= 45, ie >= 9, safari >= 9.1, ios_saf >= 7, chrome >= 58" ] } }, @@ -61,7 +61,7 @@ "rules": { "compat/compat": [ "error", - "android >= 4.3, firefox >= 45, ie >= 11, safari >= 9.1, chrome >= 58" + "android >= 4.3, firefox >= 45, ie >= 9, safari >= 9.1, chrome >= 58" ], "max-len": "off", "no-throw-literal": "off", diff --git a/History.md b/History.md index bc3c09ddc..cafeb5241 100644 --- a/History.md +++ b/History.md @@ -48,8 +48,7 @@ QUnit 3.0 Roadmap and feedback: https://github.com/qunitjs/qunit/issues/1498 ### Removed * Core: Remove support for Node.js 10-16. Node.js 18 or later is required. [#1727](https://github.com/qunitjs/qunit/issues/1727) -* Core: Remove support for IE 9 and IE 10. IE 11 remains supported. [#1725](https://github.com/qunitjs/qunit/issues/1725) -* Core: Remove support for PhantomJS. +* Core: Remove support for PhantomJS. (Steve McClure) [#1505](https://github.com/qunitjs/qunit/pull/1505) * Core: Remove built-in export for AMD. You can still load your application and your QUnit tests with AMD/RequireJS. This only affects the loading of the qunit.js file itself. [Example: Loading with RequireJS](https://qunitjs.com/api/config/autostart/#loading-with-requirejs). (NullVoxPopuli) [#1729](https://github.com/qunitjs/qunit/issues/1729) * Core: Remove deprecated [`QUnit.load()`](https://qunitjs.com/api/QUnit/load/). [#1084](https://github.com/qunitjs/qunit/issues/1084) * Core: Remove deprecated `QUnit.onError()` and `QUnit.onUnhandledRejection()` in favor of [QUnit.onUncaughtException()](https://qunitjs.com/api/extension/QUnit.onUncaughtException/). @@ -355,7 +354,7 @@ QUnit 3.0 Roadmap and feedback: https://github.com/qunitjs/qunit/issues/1498 ### Deprecated -* HTML Reporter: Deprecate PhantomJS. (Steve McClure) +* HTML Reporter: Deprecate PhantomJS. (Steve McClure) [#1505](https://github.com/qunitjs/qunit/pull/1505) ### Fixed diff --git a/build/browserstack-full.json b/build/browserstack-full.json index de4ad9aaf..87cd3583c 100644 --- a/build/browserstack-full.json +++ b/build/browserstack-full.json @@ -9,6 +9,8 @@ "firefox_78", "firefox_previous", "firefox_current", + "ie_9", + "ie_10", "ie_11", "edge_15", "edge_18", diff --git a/build/browserstack-quick.json b/build/browserstack-quick.json index 580d60b35..f74dc4f8d 100644 --- a/build/browserstack-quick.json +++ b/build/browserstack-quick.json @@ -7,7 +7,7 @@ "browsers": [ "firefox_45", "firefox_current", - "ie_11", + "ie_9", "safari_9.1", "safari_current", "opera_current", diff --git a/src/core/globals.js b/src/core/globals.js index be1b24bba..c0fc7a83a 100644 --- a/src/core/globals.js +++ b/src/core/globals.js @@ -65,7 +65,7 @@ export const sessionStorage = (function () { // Fallback for ES6 Map, `new Map(iterable)`, and ES7 Map#keys // -// Support: Safari 7; Map is undefined +// Support: IE 9-11, iOS 7; Map is undefined // Support: iOS 8; `new Map(iterable)` is not supported // Support: IE 11; Map#keys is undefined export const StringMap = typeof g.Map === 'function' diff --git a/src/core/logger.js b/src/core/logger.js index 0ab042d3b..6bef60b7b 100644 --- a/src/core/logger.js +++ b/src/core/logger.js @@ -1,10 +1,14 @@ import { console } from './globals.js'; +// Support IE 9: No console object, unless the developer tools are not open. + +// Support IE 9: Function#bind is supported, but no console.log.bind(). + // Support: SpiderMonkey (mozjs 68+) // The console object has a log method, but no warn method. export default { warn: console - ? (console.warn || console.log).bind(console) + ? Function.prototype.bind.call(console.warn || console.log, console) : function () {} }; diff --git a/src/core/reporters/ConsoleReporter.js b/src/core/reporters/ConsoleReporter.js index edf00ce3a..1e22678cb 100644 --- a/src/core/reporters/ConsoleReporter.js +++ b/src/core/reporters/ConsoleReporter.js @@ -5,7 +5,8 @@ export default class ConsoleReporter { // Cache references to console methods to ensure we can report failures // from tests tests that mock the console object itself. // https://github.com/qunitjs/qunit/issues/1340 - this.log = options.log || console.log.bind(console); + // Support IE 9: Function#bind is supported, but no console.log.bind(). + this.log = options.log || Function.prototype.bind.call(console.log, console); runner.on('error', this.onError.bind(this)); runner.on('runStart', this.onRunStart.bind(this)); diff --git a/src/core/reporters/HtmlReporter.js b/src/core/reporters/HtmlReporter.js index 0d96e7b5e..7793f8a40 100644 --- a/src/core/reporters/HtmlReporter.js +++ b/src/core/reporters/HtmlReporter.js @@ -47,10 +47,18 @@ const DOM = { } // Trim for prettiness - elem.className = set.trim(); + elem.className = trim(set); } }; +function trim (string) { + if (typeof string.trim === 'function') { + return string.trim(); + } else { + return string.replace(/^\s+|\s+$/g, ''); + } +} + function stripHtml (string) { // Strip tags, html entity and whitespaces return string @@ -177,7 +185,7 @@ export default class HtmlReporter { onFilterSubmit (ev) { // Trim potential accidental whitespace so that QUnit doesn't throw an error about no tests matching the filter. const filterInputElem = this.element.querySelector('#qunit-filter-input'); - filterInputElem.value = filterInputElem.value.trim(); + filterInputElem.value = trim(filterInputElem.value); this.applyUrlParams(); diff --git a/src/core/reporters/TapReporter.js b/src/core/reporters/TapReporter.js index e4f3aa183..dbce65ee6 100644 --- a/src/core/reporters/TapReporter.js +++ b/src/core/reporters/TapReporter.js @@ -42,7 +42,7 @@ function prettyYamlValue (value, indent = 4) { value = String(value); } - // Support IE 11: Use isFinite instead of ES6 Number.isFinite + // Support IE 9-11: Use isFinite instead of ES6 Number.isFinite if (typeof value === 'number' && !isFinite(value)) { // Turn NaN and Infinity into simple strings. // Paranoia: Don't return directly just in case there's @@ -93,7 +93,7 @@ function prettyYamlValue (value, indent = 4) { } // See also - // Support IE 11: Avoid ES6 String#repeat + // Support IE 9-11: Avoid ES6 String#repeat const prefix = (new Array(indent + 1)).join(' '); const trailingLinebreakMatch = value.match(/\n+$/); @@ -174,7 +174,8 @@ export default class TapReporter { // Cache references to console methods to ensure we can report failures // from tests tests that mock the console object itself. // https://github.com/qunitjs/qunit/issues/1340 - this.log = options.log || console.log.bind(console); + // Support IE 9: Function#bind is supported, but no console.log.bind(). + this.log = options.log || Function.prototype.bind.call(console.log, console); this.testCount = 0; this.started = false; diff --git a/src/core/stacktrace.js b/src/core/stacktrace.js index 4dfac41dd..0e33a0dd5 100644 --- a/src/core/stacktrace.js +++ b/src/core/stacktrace.js @@ -36,7 +36,7 @@ function qunitFileName () { let error = new Error(); if (!error.stack) { // Copy of sourceFromStacktrace() to avoid circular dependency - // Support: IE 11 + // Support: IE 9-11 try { throw error; } catch (err) { @@ -83,7 +83,7 @@ export function annotateStacktrace (stack, formatInternal, eToString = null) { let initialInternal = true; for (let i = 0; i < frames.length; i++) { const frame = frames[i]; - const isInternal = (frame.indexOf(fileName) !== -1 || frame.indexOf('node:internal/') !== -1); + const isInternal = ((fileName && frame.indexOf(fileName) !== -1) || frame.indexOf('node:internal/') !== -1); if (!isInternal) { initialInternal = false; } @@ -127,7 +127,7 @@ export function extractStacktrace (e, offset) { export function sourceFromStacktrace (offset) { let error = new Error(); - // Support: IE 11, iOS 7 + // Support: IE 9-11, iOS 7 // Not all browsers generate the `stack` property for `new Error()` // See also https://github.com/qunitjs/qunit/issues/636 if (!error.stack) { diff --git a/test/main/promise.js b/test/main/promise.js index 0c16ef996..1d39e8e6a 100644 --- a/test/main/promise.js +++ b/test/main/promise.js @@ -1,3 +1,4 @@ +// Support IE 9: Promise not supported. // Support SpiderMonkey: setTimeout is not supported, but native Promise is. var defer = typeof setTimeout !== 'undefined' // eslint-disable-next-line no-undef diff --git a/test/webWorker.js b/test/webWorker.js index e49f3c597..58bf41a9e 100644 --- a/test/webWorker.js +++ b/test/webWorker.js @@ -4,6 +4,7 @@ QUnit.module('Web Worker'); QUnit.test('main tests', function (assert) { assert.timeout(10000); var done = assert.async(); + // eslint-disable-next-line compat/compat -- Test skipped in IE9 var worker = new Worker('webWorker-worker.js'); worker.onmessage = function (event) {