Skip to content

Commit

Permalink
fix: tsconfig module type (#778)
Browse files Browse the repository at this point in the history
  • Loading branch information
broofa committed Jul 17, 2024
1 parent 1e0f987 commit 7eff835
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"@commitlint/config-conventional": "19.2.2",
"@eslint/js": "9.5.0",
"@types/eslint__js": "8.42.3",
"@types/random-seed": "0.3.5",
"@wdio/browserstack-service": "8.39.0",
"@wdio/cli": "8.39.0",
"@wdio/jasmine-framework": "8.39.0",
Expand All @@ -73,7 +72,6 @@
"npm-run-all": "4.1.5",
"optional-dev-dependency": "2.0.1",
"prettier": "3.3.2",
"random-seed": "0.3.0",
"runmd": "1.3.9",
"standard-version": "9.5.0",
"typescript": "5.4.5",
Expand Down
23 changes: 16 additions & 7 deletions src/test/parse.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
import * as assert from 'assert';
import test, { describe } from 'node:test';
// @ts-expect-error random-seed is an old CJS module. we should update an ESM seeded
// RNG at some point, but keeping this for now to ensure the TS port works with
// the legacy tests here.
import gen from 'random-seed';
import parse from '../parse.js';
import stringify from '../stringify.js';
import uuidv4 from '../v4.js';

// Use deterministic PRNG for reproducible tests
const rand = gen.create('He who wonders discovers that this in itself is wonder.');
// Deterministic PRNG for reproducible tests
// See https://stackoverflow.com/a/47593316/109538
function splitmix32(a: number) {
return function () {
a |= 0;
a = (a + 0x9e3779b9) | 0;
let t = a ^ (a >>> 16);
t = Math.imul(t, 0x21f0aaad);
t = t ^ (t >>> 15);
t = Math.imul(t, 0x735a2d97);
return ((t = t ^ (t >>> 15)) >>> 0) / 4294967296;
};
}
const rand = splitmix32(0x12345678);

function rng(bytes = new Uint8Array(16)) {
for (let i = 0; i < 16; i++) {
bytes[i] = rand(256);
bytes[i] = rand() * 256;
}

return bytes;
}

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Node",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "./dist/esm"
}
}

0 comments on commit 7eff835

Please sign in to comment.