From 979eb763fc01788809af95c2856af89e664df6f9 Mon Sep 17 00:00:00 2001 From: Tim Griesser Date: Fri, 31 Oct 2025 09:35:47 -0400 Subject: [PATCH] add failing test for is.class bug --- package.json | 2 +- test/test-node.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 test/test-node.js diff --git a/package.json b/package.json index feacdd1..0ab2c2a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "scripts": { "build": "del distribution && tsc", - "test": "tsc --noEmit && xo && ava", + "test": "tsc --noEmit && xo && ava && node test/test-node.js", "prepare": "npm run build" }, "files": [ diff --git a/test/test-node.js b/test/test-node.js new file mode 100644 index 0000000..e742b87 --- /dev/null +++ b/test/test-node.js @@ -0,0 +1,15 @@ +import assert from 'node:assert'; +import {test} from 'node:test'; +import is, {assert as isAssert} from '../distribution/index.js'; + +// Note: this test is separate from the rest of the tests, as it requires +// preserving whitespace. The tsimp modifies the source and does not +// properly preserve the intended test case +test('is.class', () => { + const minifiedClass = class{}; // eslint-disable-line keyword-spacing + assert.ok(is.class(minifiedClass)); + + assert.doesNotThrow(() => { + isAssert.class(minifiedClass); + }); +});