Skip to content

Commit 8541f2c

Browse files
authored
test: fix test:unit (#4989)
Running `npm run test:unit` results in loads of failures. After racking my brain about why, I remembered I had a similar problem in my [fixing `npm run test:debug` pr](#4769) where resetting the memoize functions results in them not being able to clear the cache between tests. Turns out that was the issue here. Note: this isn't a problem in our pr runs or nightly tests because we either call `npm run: test:unit:<name>` directly or run `npm test` which runs all the tests in turn. This only happens when running `npm run test:unit` since the browser doesn't close between test types.
1 parent a167eb9 commit 8541f2c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/core/utils/memoize.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ describe('axe.utils.memoize', function () {
22
'use strict';
33

44
it('should add the function to axe._memoizedFns', function () {
5-
axe._memoizedFns.length = 0;
5+
const length = axe._memoizedFns.length;
66

77
axe.utils.memoize(function myFn() {});
8-
assert.equal(axe._memoizedFns.length, 1);
8+
assert.equal(axe._memoizedFns.length, length + 1);
99
});
1010
});

0 commit comments

Comments
 (0)