Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit 1a08d7a

Browse files
committed
Second attempt at fixing flaky cookie test on Edge
1 parent 51ecb87 commit 1a08d7a

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

test/cookie.test.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ describe('cookie', function() {
88
// Just to make sure that
99
// URIError is never thrown here.
1010
document.cookie = 'bad=%';
11-
12-
// enable debugging for cookie package so we can better
13-
// observe flaky tests on IE/Edge.
14-
window.localStorage.setItem('debug', 'cookie');
1511
});
1612

1713
afterEach(function() {
@@ -38,11 +34,18 @@ describe('cookie', function() {
3834

3935
describe('#set', function() {
4036
it('should set a cookie', function() {
41-
// Logging so we can better observe flaky tests on IE/Edge.
42-
console.log('setting cookie. document.cookie is', document.cookie);
43-
cookie.set('x', { a: 'b' });
44-
console.log('cookie set. document.cookie is', document.cookie);
45-
assert.deepEqual(cookie.get('x'), { a: 'b' });
37+
// Use a random key for the cookie
38+
// Workaround for flaky concurrent tests on Edge
39+
var key = Math.random()
40+
.toString(36)
41+
.slice(2);
42+
43+
try {
44+
cookie.set(key, { a: 'b' });
45+
assert.deepEqual(cookie.get(key), { a: 'b' });
46+
} finally {
47+
cookie.remove(key);
48+
}
4649
});
4750
});
4851

0 commit comments

Comments
 (0)