Skip to content
Myr

Remove unnecessary import for modern Node.js

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Andrey Sitnik · committed by Andrey Sitnik · parent 6a73bf8 · Browse files · 3 files+3 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+3 added−7 removed

  • tests:+3 added−5 removed
  • other:+0 added−2 removed

3 files+3 added−7 removed

modified:test/benchmark.js-1 removed
modified:test/index.test.js+3 added-4 removed
1import { equal, match, notEqual, ok, throws } from 'node:assert'2import { webcrypto } from 'node:crypto'2import { after, before, describe, test } from 'node:test'34import * as browser from '../index.browser.js'5import * as node from '../index.js'
148 unmodified lines
154 })155156 test(`recovers from crypto errors`, () => {157 nanoid(1)159 let original = webcrypto.getRandomValues160 webcrypto.getRandomValues = () => {158 let original = crypto.getRandomValues159 crypto.getRandomValues = () => {160 throw new Error('Entropy failure')161 }162 try {163 throws(() => {
2 unmodified lines
166 throws(() => {167 random(131072)168 }, /Entropy failure/)169 } finally {171 webcrypto.getRandomValues = original170 crypto.getRandomValues = original171 }172 equal(nanoid().length, 21)173 equal(random(10).length, 10)174 })
171 unmodified lines
modified:index.js-2 removed
1import { webcrypto as crypto } from 'node:crypto'21import { urlAlphabet } from './url-alphabet/index.js'23export { urlAlphabet }4
176 unmodified lines