Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Commit

Permalink
Breaking: drop support of Safari 11
Browse files Browse the repository at this point in the history
So that we can use async generators (in a future release).
  • Loading branch information
vweevers committed Apr 8, 2021
1 parent 895a0a5 commit e0d59c4
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .airtap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ providers:
browsers:
- name: chrome
- name: firefox
- name: safari
version: 11
platform: Mac 10.13 # https://github.com/airtap/sauce-browsers/issues/3
- name: safari
version: 12..latest
- name: ios_saf
version: 11..latest
version: 12..latest
- name: chrome for android
version: 6..latest
- name: msedge
Expand Down
47 changes: 47 additions & 0 deletions test/self.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,53 @@ function implement (ctor, methods) {
return Test
}

// Temporary test for browsers
// Not supported on Safari < 12 and Safari iOS < 12
test('async generator', async function (t) {
let ended = false

const end = async () => {
await new Promise((resolve) => setTimeout(resolve, 100))
ended = true
}

async function * generator () {
try {
yield 1
yield 2
yield 3
yield 4
} finally {
// Test that we're always able to cleanup resources
await end()
}
}

const res = []

for await (const x of generator()) {
res.push(x)
if (x === 2) break
}

t.same(res, [1, 2])
t.is(ended, true)

ended = false

try {
for await (const x of generator()) {
res.push(x)
if (x === 2) throw new Error('userland error')
}
} catch (err) {
t.is(err.message, 'userland error')
}

t.same(res, [1, 2, 1, 2])
t.is(ended, true)
})

/**
* Extensibility
*/
Expand Down

0 comments on commit e0d59c4

Please sign in to comment.