-
-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
I've created a minimal example: https://github.com/JonasDoe/swc-node-issue
When I run a test in this example, I get this log:
> [email protected] test:swc-node
> node --import @swc-node/register/esm-register --test src/**/*.test.ts
▶ MyClass
✔ should not return an error after the assertion (0.5667ms)
✔ MyClass (1.3728ms)
✖ src\myClass.test.ts (507.915ms)
ℹ tests 2
ℹ suites 1
ℹ pass 1
ℹ fail 1
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 514.5506
✖ failing tests:
test at src\myClass.test.ts:1:1
✖ src\myClass.test.ts (507.915ms)
'test failed'
The tests does nothing more than creating an instance of myClass
(without that, it would succeed):
import * as assert from 'assert';
import {describe, it} from 'node:test';
import {MyClass} from "./myClass.js";
describe('MyClass', () => {
it('should not return an error after the assertion', () => {
new MyClass()
assert.ok(true)
})
})
MyClass
looks like this:
export class MyClass {
prop1?: string;
prop2?: string;
prop3?: string;
prop4?: string;
prop5?: string;
constructor() {}
get p1() {return this.prop1;}
get p2() {return this.prop2;}
method1() {}
method2() {}
method3() {}
method4() {}
}
So for some reason my tests is reported as failure besides everything was successful.
The curious thing is: when I remove even a single property or method in MyClass
, the test succeds, though.
I'm using @swc-node/[email protected]
and [email protected]
under Windows 11 with type: 'module'
.
thetutlage
Metadata
Metadata
Assignees
Labels
No labels