Skip to content

Commit

Permalink
Add Node.js 19 to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Dec 8, 2022
1 parent ca71e1e commit e473cc6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 19
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
Expand All @@ -33,6 +33,7 @@ jobs:
strategy:
matrix:
node-version:
- 18
- 16
- 14
name: Node.js ${{ matrix.node-version }} Quick
Expand Down
14 changes: 8 additions & 6 deletions test/async.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import { urlAlphabet } from '../index.js'
import * as browser from '../async/index.browser.js'
import * as node from '../async/index.js'

global.crypto = {
getRandomValues(array) {
for (let i = 0; i < array.length; i++) {
array[i] = Math.floor(Math.random() * 256)
Object.defineProperty(global, 'crypto', {
value: {
getRandomValues(array) {
for (let i = 0; i < array.length; i++) {
array[i] = Math.floor(Math.random() * 256)
}
return array
}
return array
}
}
})

function times(size, callback) {
let array = []
Expand Down
14 changes: 8 additions & 6 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import * as browser from '../index.browser.js'
import * as node from '../index.js'

test.before(() => {
global.crypto = {
getRandomValues(array) {
for (let i = 0; i < array.length; i++) {
array[i] = Math.floor(Math.random() * 256)
Object.defineProperty(global, 'crypto', {
value: {
getRandomValues(array) {
for (let i = 0; i < array.length; i++) {
array[i] = Math.floor(Math.random() * 256)
}
return array
}
return array
}
}
})
})

test.after(() => {
Expand Down
15 changes: 8 additions & 7 deletions test/react-native-polyfill.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ test.before(() => {
product: 'ReactNative'
}

global.crypto = {
getRandomValues(array) {
for (let i = 0; i < array.length; i++) {
array[i] = Math.floor(Math.random() * 256)
Object.defineProperty(global, 'crypto', {
value: {
getRandomValues(array) {
for (let i = 0; i < array.length; i++) {
array[i] = Math.floor(Math.random() * 256)
}
return array
}
return array
}
}
})
})

test.after(() => {
delete global.navigator
delete global.crypto
})

test('works with polyfill', () => {
Expand Down

0 comments on commit e473cc6

Please sign in to comment.