File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5454 "@commitlint/config-conventional" : " 19.2.2" ,
5555 "@eslint/js" : " 9.5.0" ,
5656 "@types/eslint__js" : " 8.42.3" ,
57- "@types/random-seed" : " 0.3.5" ,
5857 "@wdio/browserstack-service" : " 8.39.0" ,
5958 "@wdio/cli" : " 8.39.0" ,
6059 "@wdio/jasmine-framework" : " 8.39.0" ,
7372 "npm-run-all" : " 4.1.5" ,
7473 "optional-dev-dependency" : " 2.0.1" ,
7574 "prettier" : " 3.3.2" ,
76- "random-seed" : " 0.3.0" ,
7775 "runmd" : " 1.3.9" ,
7876 "standard-version" : " 9.5.0" ,
7977 "typescript" : " 5.4.5" ,
Original file line number Diff line number Diff line change 11import * as assert from 'assert' ;
22import test , { describe } from 'node:test' ;
3- // @ts -expect-error random-seed is an old CJS module. we should update an ESM seeded
4- // RNG at some point, but keeping this for now to ensure the TS port works with
5- // the legacy tests here.
6- import gen from 'random-seed' ;
73import parse from '../parse.js' ;
84import stringify from '../stringify.js' ;
95import uuidv4 from '../v4.js' ;
106
11- // Use deterministic PRNG for reproducible tests
12- const rand = gen . create ( 'He who wonders discovers that this in itself is wonder.' ) ;
7+ // Deterministic PRNG for reproducible tests
8+ // See https://stackoverflow.com/a/47593316/109538
9+ function splitmix32 ( a : number ) {
10+ return function ( ) {
11+ a |= 0 ;
12+ a = ( a + 0x9e3779b9 ) | 0 ;
13+ let t = a ^ ( a >>> 16 ) ;
14+ t = Math . imul ( t , 0x21f0aaad ) ;
15+ t = t ^ ( t >>> 15 ) ;
16+ t = Math . imul ( t , 0x735a2d97 ) ;
17+ return ( ( t = t ^ ( t >>> 15 ) ) >>> 0 ) / 4294967296 ;
18+ } ;
19+ }
20+ const rand = splitmix32 ( 0x12345678 ) ;
1321
1422function rng ( bytes = new Uint8Array ( 16 ) ) {
1523 for ( let i = 0 ; i < 16 ; i ++ ) {
16- bytes [ i ] = rand ( 256 ) ;
24+ bytes [ i ] = rand ( ) * 256 ;
1725 }
26+
1827 return bytes ;
1928}
2029
Original file line number Diff line number Diff line change 11{
22 "extends" : " ./tsconfig.base.json" ,
33 "compilerOptions" : {
4- "module" : " ESNext " ,
5- "moduleResolution" : " Node " ,
4+ "module" : " NodeNext " ,
5+ "moduleResolution" : " NodeNext " ,
66 "outDir" : " ./dist/esm"
77 }
88}
You can’t perform that action at this time.
0 commit comments