remove test-node.js, use Function constructor to preserve whitespace

This commit is contained in:
Tim Griesser 2025-10-31 11:04:37 -04:00
parent e5991b561e
commit b2aad37462
4 changed files with 6 additions and 17 deletions

View file

@ -1,15 +0,0 @@
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);
});
});

View file

@ -1086,9 +1086,13 @@ test('is.asyncIterable', t => {
test('is.class', t => {
class Foo {} // eslint-disable-line @typescript-eslint/no-extraneous-class
// Note: Using new Function to prevent whitespace modifications in tsimp
const minifiedClass = new Function('return class{};'); // eslint-disable-line no-new-func
const classDeclarations = [
Foo,
class Bar extends Foo {},
minifiedClass(),
];
for (const classDeclaration of classDeclarations) {