Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML Reporter: Add basic ES6 Map fallback for fuzzysort.js #1471

Merged
merged 1 commit into from
Aug 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,20 @@ export const localSessionStorage = ( function() {
return undefined;
}
}() );

// Support IE 9-10: Fallback for fuzzysort.js used by /reporter/html.js
if ( !global.Map ) {
global.Map = function StringMap() {
var store = Object.create( null );
this.get = function( strKey ) {
return store[ strKey ];
};
this.set = function( strKey, val ) {
store[ strKey ] = val;
return this;
};
this.clear = function() {
store = Object.create( null );
};
};
}
4 changes: 3 additions & 1 deletion test/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": [ "plugin:qunit/two" ],
"env": {
"browser": true
"browser": true,
"es6": false
},
"plugins": [
"html",
Expand All @@ -12,6 +13,7 @@
},
"globals": {
"QUnit": false,
"Promise": false,
"console": false
},
"rules": {
Expand Down
3 changes: 2 additions & 1 deletion test/cli/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"ecmaVersion": 2017
},
"env": {
"node": true
"node": true,
"es6": true
}
}
2 changes: 1 addition & 1 deletion test/main/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ QUnit.test( "rejects", function( assert ) {
return this.message;
};

const rejectsReturnValue = assert.rejects(
var rejectsReturnValue = assert.rejects(
buildMockPromise( "my error" )
);

Expand Down
2 changes: 1 addition & 1 deletion test/main/assert/step.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ QUnit.module( "assert.verifySteps value reference", function() {
} );

QUnit.test( "steps array should not be reset in logging function", function( assert ) {
const result = loggedAssertions[ "verification-assertion" ].actual;
var result = loggedAssertions[ "verification-assertion" ].actual;
assert.deepEqual( result, [ "step one", "step two" ] );
} );

Expand Down
2 changes: 2 additions & 0 deletions test/main/utilities.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* globals Map, Set, Symbol */

QUnit.module( "QUnit.objectType" );

function Foo( ) { }
Expand Down
2 changes: 1 addition & 1 deletion test/only.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
QUnit.module( "QUnit.only", function( hooks ) {
let testsRun = 0;
var testsRun = 0;

hooks.after( function( assert ) {
assert.strictEqual( testsRun, 2 );
Expand Down
2 changes: 1 addition & 1 deletion test/reporter-html/unhandled-rejection.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if ( HAS_UNHANDLED_REJECTION_HANDLER ) {
} );

QUnit.test( "test passes just fine, but has a rejected promise", function( assert ) {
const done = assert.async();
var done = assert.async();

Promise.resolve().then( function() {
throw new Error( "Error thrown in non-returned promise!" );
Expand Down
2 changes: 1 addition & 1 deletion test/reporter-html/window-onerror.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ QUnit.module( "window.onerror (no preexisting handler)", function( hooks ) {
QUnit.test( "Should extract stacktrace if it is available", function( assert ) {
assert.expect( 1 );

const errorObj = {
var errorObj = {
stack: "dummy.js:1 top()\ndummy.js:2 middle()\ndummy.js:3 bottom()"
};

Expand Down
1 change: 1 addition & 0 deletions test/webWorker-worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* global importScripts */
/* eslint-env es6 */
importScripts(
"../dist/qunit.js",
"main/test.js",
Expand Down