"build": "rm -rf dist && tsc && esbuild main.min=dist/main.js global.min=dist/global.js --outdir=dist --target=es2022 --format=esm --platform=browser --bundle --minify --sourcemap",
"test": "npm run build -- --platform=node && node --test --test-force-exit --env-file .env",
"test:coverage": "npm run test -- --experimental-test-coverage",
- "test:coverage:report": "npm run test:coverage -- --test-reporter=lcov --test-reporter-destination=coverage.info && genhtml coverage.info --output-directory test/coverage && rm coverage.info && xdg-open test/coverage/index.html"
+ "test:coverage:report": "npm run test:coverage -- --test-reporter=lcov --test-reporter-destination=coverage.info && genhtml coverage.info --output-directory test/coverage && rm coverage.info && xdg-open test/coverage/index.html",
+ "test:performance": "npm run test perf/*"
},
"imports": {
"#*": "./*"
--- /dev/null
+// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+'use strict'
+
+import '#test/GLOBALS.mjs'
+import { test } from 'node:test'
+import { strict as assert } from 'assert'
+import { NANO_TEST_VECTORS } from '#test/TEST_VECTORS.js'
+import { Bip44Wallet, Blake2bWallet } from '#dist/main.js'
+
+console.log('child key derivation performance test')
+
+test('BIP-44 ckd', async () => {
+ const wallet = await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD)
+ await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)
+
+ const accounts = await wallet.accounts(0, 0x7fff)
+
+ assert.equal(accounts.length, 0x8000)
+})
+
+test('BLAKE2b ckd', async () => {
+ const wallet = await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD)
+ await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)
+
+ const accounts = await wallet.accounts(0, 0x7fff)
+
+ assert.equal(accounts.length, 0x8000)
+})
--- /dev/null
+// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+'use strict'
+
+import '#test/GLOBALS.mjs'
+import { test } from 'node:test'
+import { strict as assert } from 'assert'
+import { NANO_TEST_VECTORS } from '#test/TEST_VECTORS.js'
+import { Bip44Wallet, Blake2bWallet } from '#dist/main.js'
+
+console.log('wallet performance test')
+
+test('creating BIP-44 wallets', async () => {
+ const wallets = []
+ for (let i = 0x80; i > 0; i--) {
+ wallets.push(await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD))
+ }
+ assert.equal(wallets.length, 0x80)
+})
+
+test('creating BLAKE2b wallets', async () => {
+ const wallets = []
+ for (let i = 0x80; i > 0; i--) {
+ wallets.push(await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD))
+ }
+ assert.equal(wallets.length, 0x80)
+})
+++ /dev/null
-// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
-// SPDX-License-Identifier: GPL-3.0-or-later
-
-'use strict'
-
-import './GLOBALS.mjs'
-import { describe, it } from 'node:test'
-import { strict as assert } from 'assert'
-import { NANO_TEST_VECTORS } from './TEST_VECTORS.js'
-import { Bip44Wallet, Blake2bWallet } from '../dist/main.js'
-
-const skip = true
-
-describe('wallet generation performance', { skip }, async () => {
- it('performance test creating BIP-44 wallets', async () => {
- const wallets = []
- for (let i = 0x80; i > 0; i--) {
- wallets.push(await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD))
- }
- assert.equal(wallets.length, 0x80)
- })
-
- it('performance test creating BLAKE2b wallets', async () => {
- const wallets = []
- for (let i = 0x80; i > 0; i--) {
- wallets.push(await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD))
- }
- assert.equal(wallets.length, 0x80)
- })
-})
-
-describe('child key derivation performance', { skip }, async () => {
- it('performance test of BIP-44 ckd', async () => {
- const wallet = await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD)
- await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)
-
- const accounts = await wallet.accounts(0, 0x7fff)
-
- assert.equal(accounts.length, 0x8000)
- })
-
- it('performance test of BLAKE2b ckd', async () => {
- const wallet = await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD)
- await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)
-
- const accounts = await wallet.accounts(0, 0x7fff)
-
- assert.equal(accounts.length, 0x8000)
- })
-})