Closed deanrih closed 12 hours ago
Well... after I moved the "emitDecoratorMetadata": true
and "experimentalDecorators": true
(only the "emitDecoratorMetadata"
is important for the test to work) from my tsconfig.test.json
and tsconfig.build.json
into my main tsconfig.json
... it worked...
What version of Bun is running?
1.1.36
What platform is your computer?
Linux 6.11.2-4-MANJARO x86_64 unknown
What steps can reproduce the bug?
spec
file should already be generated, I'm not referring totest
directory, although tests file in thetest
directory were not detected since it uses-spec
instead of_spec
and it has a problem that I think is not related to Bun (it requires platform-express despite the main program uses fastify)bun test
spec
file*.spec.ts
expect(appController.getHello()).toBe("Hello World");
due to Bun failing to resolve the inner expression ofreturn this.appService.getHello()
:src/module/app/app.spec.ts: 9 | constructor(private readonly appService: AppService) {} 10 | 11 | @Get() 12 | getHello(): string { 13 | this.logger.log("Incoming request."); 14 | return this.appService.getHello(); ^ TypeError: undefined is not an object (evaluating 'this.appService.getHello') at getHello (//src/module/app/app.controller.ts:14:15) at //src/module/app/app.spec.ts:20:25 ✗ AppModule > root > should return "Hello World!" [0.17ms]
0 pass 1 fail Ran 1 tests across 1 files. [237.00ms]
when I add some manual code to get AppService manually like:
it logs the result of
appService.getHello()
just fine, which is"Hello World!"
but still fail the evaluation and test