Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jest error TypeError: undefined is not an object (evaluating '_global.hasOwnProperty("queueMicrotask")') #11075

Open
sirenkovladd opened this issue May 14, 2024 · 0 comments
Labels
bug Something isn't working node.js Compatibility with Node.js APIs

Comments

@sirenkovladd
Copy link
Contributor

What version of Bun is running?

1.1.8+89d25807f

What platform is your computer?

Darwin 23.4.0 arm64 arm

What steps can reproduce the bug?

❯ bunx --bun jest
 FAIL  test/timer.test.ts
  ● Test suite failed to run

    TypeError: undefined is not an object (evaluating '_global.hasOwnProperty("queueMicrotask")')
        at hasOwnProperty (native)

      at withGlobal (node_modules/@sinonjs/fake-timers/src/fake-timers-src.js:183:23)
      at processTicksAndRejections (:12:39)



Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.028 s
Ran all test suites.

shorter

const vm = require('node:vm');

this.context = vm.createContext();
const global = vm.runInContext('this', this.context);

console.log(global.hasOwnProperty)
console.log(global.hasOwnProperty('parseInt'))

What is the expected behavior?

❯ node index.js 
[Function: hasOwnProperty]
true

What do you see instead?

❯ bun index.js 
[Function: hasOwnProperty]
3 | 
4 | this.context = vm.createContext();
5 | const global = vm.runInContext('this', this.context);
6 | 
7 | console.log(global.hasOwnProperty)
                ^
TypeError: undefined is not an object (evaluating 'global.hasOwnProperty("parseInt")')
      at /Users/vlad/programming/bun-jest/index.js:7:13

Bun v1.1.8 (macOS arm64)

Additional information

Related to

@sirenkovladd sirenkovladd added the bug Something isn't working label May 14, 2024
@Electroid Electroid added the node.js Compatibility with Node.js APIs label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node.js Compatibility with Node.js APIs
Projects
None yet
Development

No branches or pull requests

2 participants