Skip to content

Commit

Permalink
ci: add node 22. test: change imports to prefixed ones; change assert…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
paulmillr committed May 18, 2024
1 parent 98d0161 commit 4ba2084
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 29 deletions.
1 change: 1 addition & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
node:
- 18
- 20
- 22
steps:
- uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4
- name: Use Node.js ${{ matrix.node }}
Expand Down
2 changes: 1 addition & 1 deletion test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1864,7 +1864,7 @@ should('unspendable output (gh-66)', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
2 changes: 1 addition & 1 deletion test/bip174-psbt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ should('bip174-psbt: PSBT garbage', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
2 changes: 1 addition & 1 deletion test/bip340-schnorr.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ for (const v of v340) {
}

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
2 changes: 1 addition & 1 deletion test/bip341-taproot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ should('verify unspendable key', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
2 changes: 1 addition & 1 deletion test/bip67-multisig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ for (let i = 0; i < BIP67.length; i++) {
}

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
20 changes: 10 additions & 10 deletions test/bitcoinjs-test/btcjs-address.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { deepStrictEqual, throws } from 'node:assert';
import { should } from 'micro-should';
import { hex, base64 } from '@scure/base';
import * as btc from '../../lib/esm/index.js';
import { default as p2ms } from './fixtures/bitcoinjs/p2ms.json' assert { type: 'json' };
import { default as p2pk } from './fixtures/bitcoinjs/p2pk.json' assert { type: 'json' };
import { default as p2pkh } from './fixtures/bitcoinjs/p2pkh.json' assert { type: 'json' };
import { default as p2sh } from './fixtures/bitcoinjs/p2sh.json' assert { type: 'json' };
import { default as p2wpkh } from './fixtures/bitcoinjs/p2wpkh.json' assert { type: 'json' };
import { default as p2wsh } from './fixtures/bitcoinjs/p2wsh.json' assert { type: 'json' };
import { default as p2tr } from './fixtures/bitcoinjs-taproot/p2tr.json' assert { type: 'json' };
import { default as p2tr_ns } from './fixtures/bitcoinjs-taproot/p2tr_ns.json' assert { type: 'json' };
import { default as p2tr_bitgo } from './fixtures/bitcoinjs-taproot/p2tr_bitgo.json' assert { type: 'json' };
import { default as p2ms } from './fixtures/bitcoinjs/p2ms.json' with { type: 'json' };
import { default as p2pk } from './fixtures/bitcoinjs/p2pk.json' with { type: 'json' };
import { default as p2pkh } from './fixtures/bitcoinjs/p2pkh.json' with { type: 'json' };
import { default as p2sh } from './fixtures/bitcoinjs/p2sh.json' with { type: 'json' };
import { default as p2wpkh } from './fixtures/bitcoinjs/p2wpkh.json' with { type: 'json' };
import { default as p2wsh } from './fixtures/bitcoinjs/p2wsh.json' with { type: 'json' };
import { default as p2tr } from './fixtures/bitcoinjs-taproot/p2tr.json' with { type: 'json' };
import { default as p2tr_ns } from './fixtures/bitcoinjs-taproot/p2tr_ns.json' with { type: 'json' };
import { default as p2tr_bitgo } from './fixtures/bitcoinjs-taproot/p2tr_bitgo.json' with { type: 'json' };

import * as utils from './utils.js';

Expand Down Expand Up @@ -85,7 +85,7 @@ for (const type in payments) {
}

// 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/bitcoinjs-test/btcjs-taproot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { should } from 'micro-should';
import { hex, base64 } from '@scure/base';
import * as btc from '../../lib/esm/index.js';
import * as P from 'micro-packed';
import { default as p2tr } from './fixtures/bitcoinjs-taproot/p2tr.json' assert { type: 'json' };
import { default as tapPsbt } from './fixtures/bitcoinjs-taproot/psbt.json' assert { type: 'json' };
import { default as p2tr } from './fixtures/bitcoinjs-taproot/p2tr.json' with { type: 'json' };
import { default as tapPsbt } from './fixtures/bitcoinjs-taproot/psbt.json' with { type: 'json' };

// TODO: move to index.ts as compat layer for bitcoinjs-lib?
function fromASM(asm) {
Expand Down Expand Up @@ -66,7 +66,7 @@ for (let i = 0; i < tapPsbt.signInput.checks.length; i++) {
}

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
12 changes: 6 additions & 6 deletions test/bitcoinjs-test/btcjs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { should } from 'micro-should';
import { hex, base64 } from '@scure/base';
import * as btc from '../../lib/esm/index.js';
import * as bip32 from '@scure/bip32';
import { default as f_transaction } from './fixtures/bitcoinjs/transaction.json' assert { type: 'json' };
import { default as f_script } from './fixtures/bitcoinjs/script.json' assert { type: 'json' };
import { default as f_script_number } from './fixtures/bitcoinjs/script_number.json' assert { type: 'json' };
import { default as f_address } from './fixtures/bitcoinjs/address.json' assert { type: 'json' };
import { default as psbt } from './fixtures/bitcoinjs/psbt.json' assert { type: 'json' };
import { default as f_transaction } from './fixtures/bitcoinjs/transaction.json' with { type: 'json' };
import { default as f_script } from './fixtures/bitcoinjs/script.json' with { type: 'json' };
import { default as f_script_number } from './fixtures/bitcoinjs/script_number.json' with { type: 'json' };
import { default as f_address } from './fixtures/bitcoinjs/address.json' with { type: 'json' };
import { default as psbt } from './fixtures/bitcoinjs/psbt.json' with { type: 'json' };
import * as utils from './utils.js';

should('version is int32le', () => {
Expand Down Expand Up @@ -633,7 +633,7 @@ for (let i = 0; i < psbt.signInputHD.checks.length; i++) {
}

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
2 changes: 1 addition & 1 deletion test/psbt-test/bip174-psbt-extended.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('bip174-psbt-extended', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
2 changes: 1 addition & 1 deletion test/slow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ should('big multisig (ours)', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
2 changes: 1 addition & 1 deletion test/taproot-multisig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ describe('taproot-multisig', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
2 changes: 1 addition & 1 deletion test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ should('combinations', () => {
});

// ESM is broken.
import url from 'url';
import url from 'node:url';
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
should.run();
}
2 changes: 1 addition & 1 deletion test/utxo-select.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ describe('UTXO Select', () => {
});

// 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 4ba2084

Please sign in to comment.