Skip to content

Commit

Permalink
test: prefix imports of built-in modules
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed May 18, 2024
1 parent 4eeb394 commit 8c7fa02
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions test/basic.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { deepStrictEqual, throws } from 'assert';
import { deepStrictEqual, throws } from 'node:assert';
import { should, describe } from 'micro-should';
import * as fc from 'fast-check';
import * as mod from '../esm/abstract/modular.js';
Expand Down Expand Up @@ -807,7 +807,7 @@ should('validate generator point is on curve', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
6 changes: 3 additions & 3 deletions test/bls12-381.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deepStrictEqual, notDeepStrictEqual, throws } from 'assert';
import { deepStrictEqual, notDeepStrictEqual, throws } from 'node:assert';
import * as fc from 'fast-check';
import { readFileSync } from 'fs';
import { readFileSync } from 'node:fs';
import { describe, should } from 'micro-should';
import { wNAF } from '../esm/abstract/curve.js';
import { bytesToHex, utf8ToBytes } from '../esm/abstract/utils.js';
Expand Down Expand Up @@ -1481,7 +1481,7 @@ describe('bls12-381 deterministic', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
Expand Down
4 changes: 2 additions & 2 deletions test/ed25519-addons.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sha512 } from '@noble/hashes/sha512';
import { bytesToHex as hex, hexToBytes } from '@noble/hashes/utils';
import { deepStrictEqual, throws } from 'assert';
import { deepStrictEqual, throws } from 'node:assert';
import { describe, should } from 'micro-should';
import { bytesToNumberLE, numberToBytesLE } from '../esm/abstract/utils.js';
import { default as x25519vectors } from './wycheproof/x25519_test.json' with { type: 'json' };
Expand Down Expand Up @@ -355,7 +355,7 @@ describe('ristretto255', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';

if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
Expand Down
6 changes: 3 additions & 3 deletions test/ed25519.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { deepStrictEqual, strictEqual, throws } from 'assert';
import { readFileSync } from 'fs';
import { deepStrictEqual, strictEqual, throws } from 'node:assert';
import { readFileSync } from 'node:fs';
import { bytesToHex, concatBytes, hexToBytes, utf8ToBytes, randomBytes } from '@noble/hashes/utils';
import * as fc from 'fast-check';
import { describe, should } from 'micro-should';
Expand Down Expand Up @@ -448,7 +448,7 @@ describe('ed25519', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
4 changes: 2 additions & 2 deletions test/ed448-addons.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { bytesToHex as hex, hexToBytes } from '@noble/hashes/utils';
import { deepStrictEqual, throws } from 'assert';
import { deepStrictEqual, throws } from 'node:assert';
import { describe, should } from 'micro-should';
import { bytesToNumberLE } from '../esm/abstract/utils.js';
import { ed448, DecafPoint } from '../esm/ed448.js';
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('decaf448', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';

if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
Expand Down
4 changes: 2 additions & 2 deletions test/ed448.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { deepStrictEqual, throws } from 'assert';
import { deepStrictEqual, throws } from 'node:assert';
import { describe, should } from 'micro-should';
import * as fc from 'fast-check';
import { ed448, ed448ph, x448 } from '../esm/ed448.js';
Expand Down Expand Up @@ -735,7 +735,7 @@ describe('ed448', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
4 changes: 2 additions & 2 deletions test/hash-to-curve.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { deepStrictEqual } from 'assert';
import { deepStrictEqual } from 'node:assert';
import { describe, should } from 'micro-should';
import { bytesToHex } from '@noble/hashes/utils';
// Generic tests for all curves in package
Expand Down Expand Up @@ -144,7 +144,7 @@ testCurve(ed25519, ed25519_ro, ed25519_nu);
testCurve(ed448, ed448_ro, ed448_nu);

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
4 changes: 2 additions & 2 deletions test/jubjub.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { jubjub, findGroupHash } from '../esm/jubjub.js';
import { describe, should } from 'micro-should';
import { deepStrictEqual, throws } from 'assert';
import { deepStrictEqual, throws } from 'node:assert';
const Point = jubjub.ExtendedPoint;

const G_SPEND = new Point(
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('jubjub', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
4 changes: 2 additions & 2 deletions test/nist.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { deepStrictEqual, throws } from 'assert';
import { deepStrictEqual, throws } from 'node:assert';
import { describe, should } from 'micro-should';
import { secp192r1, secp224r1, p192, p224 } from './_more-curves.helpers.js';
import { DER } from '../esm/abstract/weierstrass.js';
Expand Down Expand Up @@ -479,7 +479,7 @@ should('have proper GLV endomorphism logic in secp256k1', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
4 changes: 2 additions & 2 deletions test/poseidon.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { deepStrictEqual, throws } from 'assert';
import { deepStrictEqual, throws } from 'node:assert';
import { should, describe } from 'micro-should';
import * as poseidon from '../esm/abstract/poseidon.js';
import * as stark from './_poseidon.helpers.js';
Expand Down Expand Up @@ -375,7 +375,7 @@ should('poseidonperm_x5_254_5', () => {
// Startadperm is unsupported, since it is non prime field

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
6 changes: 3 additions & 3 deletions test/secp256k1-schnorr.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { deepStrictEqual, throws } from 'assert';
import { readFileSync } from 'fs';
import { deepStrictEqual, throws } from 'node:assert';
import { readFileSync } from 'node:fs';
import { should, describe } from 'micro-should';
import { bytesToHex as hex } from '@noble/hashes/utils';
import { schnorr } from '../esm/secp256k1.js';
Expand Down Expand Up @@ -28,7 +28,7 @@ describe('schnorr.sign()', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
6 changes: 3 additions & 3 deletions test/secp256k1.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { hexToBytes, bytesToHex as hex } from '@noble/hashes/utils';
import { deepStrictEqual, throws } from 'assert';
import { deepStrictEqual, throws } from 'node:assert';
import * as fc from 'fast-check';
import { readFileSync } from 'fs';
import { readFileSync } from 'node:fs';
import { should, describe } from 'micro-should';
// prettier-ignore
import {
Expand Down Expand Up @@ -570,7 +570,7 @@ describe('secp256k1', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}

0 comments on commit 8c7fa02

Please sign in to comment.