From 17ab526b168ac07f0775cba150408f24a3245116 Mon Sep 17 00:00:00 2001 From: James Prevett Date: Wed, 2 Oct 2024 21:52:10 -0500 Subject: [PATCH] Change to using `assert` --- package.json | 2 +- tests/zip.test.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index bd48a8a..9cd89e2 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "format": "prettier --write .", "format:check": "prettier --check .", "lint": "eslint src", - "test": "tsx --test tests/zip.test.ts", + "test": "tsx --test --experimental-test-coverage", "build": "npx build --package=@zenfs/core --globalName ZenFS_ZIP --entry src/index.ts", "build:docs": "typedoc --out docs --name 'ZenFS Zip' src/index.ts", "prepublishOnly": "npm run build" diff --git a/tests/zip.test.ts b/tests/zip.test.ts index 732d977..8a7dada 100644 --- a/tests/zip.test.ts +++ b/tests/zip.test.ts @@ -1,10 +1,10 @@ import { configureSingle, fs } from '@zenfs/core'; import { readFileSync } from 'fs'; +import assert from 'node:assert'; +import { suite, test } from 'node:test'; import { dirname } from 'path'; import { fileURLToPath } from 'url'; import { Zip } from '../src/ZipFS.js'; -import { test, suite } from 'node:test'; -import { equal } from 'node:assert'; suite('Basic ZIP operations', () => { test('Configure', async () => { @@ -14,22 +14,22 @@ suite('Basic ZIP operations', () => { }); test('readdir /', () => { - equal(fs.readdirSync('/').length, 3); + assert(fs.readdirSync('/').length == 3); }); test('read /one.txt', () => { - equal(fs.readFileSync('/one.txt', 'utf8'), '1'); + assert(fs.readFileSync('/one.txt', 'utf8') == '1'); }); test('read /two.txt', () => { - equal(fs.readFileSync('/two.txt', 'utf8'), 'two'); + assert(fs.readFileSync('/two.txt', 'utf8') == 'two'); }); test('readdir /nested', () => { - equal(fs.readdirSync('/nested').length, 1); + assert(fs.readdirSync('/nested').length == 1); }); test('readdir /nested/omg.txt', () => { - equal(fs.readFileSync('/nested/omg.txt', 'utf8'), 'This is a nested file!'); + assert(fs.readFileSync('/nested/omg.txt', 'utf8') == 'This is a nested file!'); }); });