Skip to content

Commit

Permalink
avoid using .finally()
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers committed Feb 11, 2022
1 parent ccabdda commit 8404433
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 26 deletions.
7 changes: 5 additions & 2 deletions lib/core/public/run-partial.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ export default function runPartial(...args) {
if (contextObj.initiator) {
environmentData = getEnvironmentData();
}

axe._running = false;
teardown();
return { results, frames, environmentData };
})
.finally(() => {
// Avoid .finally() to deal with Mocha 9 + IE issues
.catch((err) => {
axe._running = false;
teardown();
return Promise.reject(err);
});
}

Expand Down
4 changes: 1 addition & 3 deletions test/core/public/finish-run.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Mocha 9 + IE don't play well with promise.finally(), which runPartial uses
// This is a very specific problem in that test environment.
(axe.testUtils.isIE11 ? describe.skip : describe)('axe.finishRun', function() {
describe('axe.finishRun', function() {
var fixture = document.querySelector('#fixture');

afterEach(function() {
Expand Down
4 changes: 1 addition & 3 deletions test/core/public/run-partial.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Mocha 9 + IE don't play well with promise.finally(), which runPartial uses
// This is a very specific problem in that test environment.
(axe.testUtils.isIE11 ? describe.skip : describe)('axe.runPartial', function() {
describe('axe.runPartial', function() {
var fixture = document.getElementById('fixture');
var DqElement = axe.utils.DqElement;
var dqElementKeys = Object.keys(new DqElement(null).toJSON());
Expand Down
4 changes: 1 addition & 3 deletions test/integration/full/isolated-env/isolated-env.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* global chai */

// Mocha 9 + IE don't play well with promise.finally(), which runPartial uses
// This is a very specific problem in that test environment.
(axe.testUtils.isIE11 ? describe.skip : describe)('isolated-env test', function() {
describe('isolated-env test', function() {
'use strict';
var fixture = document.querySelector('#fixture');
var isIE11 = axe.testUtils.isIE11;
Expand Down
6 changes: 3 additions & 3 deletions test/integration/full/preload/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ describe('axe.utils.preload integration test', function() {
.catch(function(err) {
assert.isNotNull(err);
assert.isTrue(err.message.includes('Preload assets timed out'));

axe.utils.preloadCssom = origPreloadCssom;
done();
})
.catch(done)
.finally(function() {
.catch(e => {
axe.utils.preloadCssom = origPreloadCssom;
done(e)
});
});
});
Expand Down
4 changes: 1 addition & 3 deletions test/integration/full/run-partial/after-method.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Mocha 9 + IE don't play well with promise.finally(), which runPartial uses
// This is a very specific problem in that test environment.
(axe.testUtils.isIE11 ? describe.skip : describe)('run-partial, after-method', function() {
describe('run-partial, after-method', function() {
'use strict';
var ruleName = 'heading-order';
var runPartialRecursive = axe.testUtils.runPartialRecursive;
Expand Down
4 changes: 1 addition & 3 deletions test/integration/full/run-partial/context-size-focusable.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Mocha 9 + IE don't play well with promise.finally(), which runPartial uses
// This is a very specific problem in that test environment.
(axe.testUtils.isIE11 ? describe.skip : describe)('run-partial, context-size-focusable', function() {
describe('run-partial, context-size-focusable', function() {
'use strict';
var ruleName = 'frame-focusable-content';
var runPartialRecursive = axe.testUtils.runPartialRecursive;
Expand Down
4 changes: 1 addition & 3 deletions test/integration/full/run-partial/initiator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Mocha 9 + IE don't play well with promise.finally(), which runPartial uses
// This is a very specific problem in that test environment.
(axe.testUtils.isIE11 ? describe.skip : describe)('run-partial, initiator', function() {
describe('run-partial, initiator', function() {
'use strict';
var ruleName = 'document-title';
var runPartialRecursive = axe.testUtils.runPartialRecursive;
Expand Down
4 changes: 1 addition & 3 deletions test/integration/full/run-partial/page-level.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Mocha 9 + IE don't play well with promise.finally(), which runPartial uses
// This is a very specific problem in that test environment.
(axe.testUtils.isIE11 ? describe.skip : describe)('run-partial, page-level', function() {
describe('run-partial, page-level', function() {
'use strict';
var ruleName = 'bypass';
var runPartialRecursive = axe.testUtils.runPartialRecursive;
Expand Down

0 comments on commit 8404433

Please sign in to comment.