bun icon indicating copy to clipboard operation
bun copied to clipboard

Methods beforeEach, beforeAll of bun:test is not working

Open paveltretyakovru opened this issue 2 years ago • 1 comments

Version

0.1.13

Platform

Linux WIN-KNU6MIAGFN4 5.15.57.1-microsoft-standard-WSL2 #1 SMP Wed Jul 27 02:20:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

What steps will reproduce the bug?

  1. Touch a file index.test.ts with next content:
import { it, describe, beforeAll, expect } from 'bun:test';

describe("check someObjct", () => {
  let someObject: { use(): void };
  
  beforeAll(() => {
    someObject = { use: () => console.log('Test use function') };
  });

  it('should have "use" method', () => {
    expect(typeof someObject.use).toBe("function");
  });
});
  1. Run bun test
bun wiptest

How often does it reproduce? Is there a required condition?

Everytime

What is the expected behavior?

No response

What do you see instead?

Exception:

 undefined is not an object (evaluating 'someObject.use')

image

The issue have same behaviro for beforeEach() function

image

Additional information

No response

paveltretyakovru avatar Sep 26 '22 06:09 paveltretyakovru

Running into this issue too, going to take a crack at it

ethanburrell avatar Dec 21 '22 08:12 ethanburrell

This was fixed in #1639

Electroid avatar Feb 09 '23 22:02 Electroid