Files
pezkuwi-wasm/packages/wasm-crypto/test/deno.ts
T
Satoshi Qazi Muhammed 72bb42bdb5 Move to @pezkuwi/dev 0.86 (eslint 10, typescript-eslint 8)
What the new toolchain asked for here:

- test/deno.ts: the import/* rules are import-x/* now, so the file-wide
  disable for .ts imports names import-x/extensions. The test runner's `it`
  was typed by redeclaring the global globalThis, which eslint 10 reports as
  shadowing a restricted name; it is read through a typed alias instead,
  the same object at runtime. A note duplicated in that file is gone.
- Two disable comments that no longer suppress anything were removed by the
  linter (camelcase in wasm-crypto-init types, ban-ts-comment above a
  described @ts-ignore, which typescript-eslint 8 allows).
2026-10-09 09:41:08 +04:00

41 lines
1.2 KiB
TypeScript

// Copyright 2019-2026 @pezkuwi/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
// This is a Deno file, so we can allow .ts imports
/* eslint-disable import-x/extensions */
// NOTE We don't use ts-expect-error here since the build folder may or may
// not exist (so the error may or may not be there)
//
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore This should only run against the compiled ouput, where this should exist
import * as wasm from '../build-deno/mod.ts';
import { initRun, tests } from './all/index.js';
type Tests = Record<string, (wasm: unknown) => void>;
// The test runner's `it`, read through a typed alias rather than by
// redeclaring the global.
const testGlobal = globalThis as unknown as {
it: (name: string, fn: () => void) => unknown;
};
declare const Deno: {
test: (name: string, test: () => unknown) => unknown;
};
await initRun('wasm', wasm);
// We use it to denote the tests
testGlobal.it = (name: string, fn: () => void) => Deno.test(name, () => fn());
Object
.entries<Tests>(tests)
.forEach(([describeName, tests]) => {
console.log('***', describeName);
Object
.values(tests)
.forEach((test) => test(wasm));
});