-
Notifications
You must be signed in to change notification settings - Fork 30.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: port flaky wpt/html/webappapis/timers tests to test/sequential
- Loading branch information
Showing
18 changed files
with
111 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
test/fixtures/wpt/html/webappapis/timers/cleartimeout-clearinterval.any.js
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
test/fixtures/wpt/html/webappapis/timers/evil-spec-example.html
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
test/fixtures/wpt/html/webappapis/timers/missing-timeout-setinterval.any.js
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
test/fixtures/wpt/html/webappapis/timers/negative-setinterval.any.js
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
test/fixtures/wpt/html/webappapis/timers/negative-settimeout.any.js
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
test/fixtures/wpt/html/webappapis/timers/type-long-setinterval.any.js
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
test/fixtures/wpt/html/webappapis/timers/type-long-settimeout.any.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
test/sequential/test-timers-clearinterval-from-callback.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
|
||
// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/clearinterval-from-callback.any.js | ||
|
||
let wasPreviouslyCalled = false; | ||
|
||
const handle = setInterval(() => { | ||
if (!wasPreviouslyCalled) { | ||
wasPreviouslyCalled = true; | ||
|
||
clearInterval(handle); | ||
|
||
setInterval(process.exit, 750); | ||
} else { | ||
common.mustNotCall()(); | ||
} | ||
}, 500); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
|
||
// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/cleartimeout-cleartinterval.any.js | ||
|
||
{ | ||
const handle = setTimeout(common.mustNotCall(), 0); | ||
clearInterval(handle); | ||
} | ||
|
||
{ | ||
const handle = setInterval(common.mustNotCall(), 0); | ||
clearTimeout(handle); | ||
} | ||
|
||
setTimeout(process.exit, 100); |
34 changes: 34 additions & 0 deletions
34
test/sequential/test-timers-missing-timeout-setinterval.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
|
||
// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/missing-timeout-setinterval.any.js | ||
|
||
// Calling setInterval with no interval should be the same as if called with 0 interval | ||
{ | ||
let ctr = 0; | ||
let doneHandle; | ||
// eslint-disable-next-line no-restricted-syntax | ||
const handle = setInterval(() => { | ||
if (++ctr === 2) { | ||
clearInterval(handle); | ||
clearTimeout(doneHandle); | ||
} | ||
}/* no interval */); | ||
|
||
doneHandle = setTimeout(common.mustNotCall(), 100); | ||
} | ||
|
||
// Calling setInterval with undefined interval should be the same as if called with 0 interval | ||
{ | ||
let ctr = 0; | ||
let doneHandle; | ||
const handle = setInterval(() => { | ||
if (++ctr === 2) { | ||
clearInterval(handle); | ||
clearTimeout(doneHandle); | ||
} | ||
}, undefined); | ||
|
||
doneHandle = setTimeout(common.mustNotCall(), 100); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
|
||
// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/negative-setinterval.any.js | ||
|
||
let i = 0; | ||
let interval; | ||
function next() { | ||
i++; | ||
if (i === 20) { | ||
clearInterval(interval); | ||
process.exit(); | ||
} | ||
} | ||
setTimeout(common.mustNotCall(), 1000); | ||
interval = setInterval(next, -100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
|
||
// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/negative-settimeout.any.js | ||
|
||
setTimeout(process.exit, -100); | ||
setTimeout(common.mustNotCall(), 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
|
||
// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/type-long-setinterval.any.js | ||
|
||
setInterval(process.exit, Math.pow(2, 32)); | ||
setTimeout(common.mustNotCall(), 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
|
||
// This is a port of https://github.com/web-platform-tests/wpt/blob/22ecfc9/html/webappapis/timers/type-long-settimeout.any.js | ||
|
||
setTimeout(process.exit, Math.pow(2, 32)); | ||
setTimeout(common.mustNotCall(), 100); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.