Code Whisperer
Code Whisperer

Reputation: 23662

Jest Not Mocking Anything?

Here is an actual application running Jest 12.1.1:

main.js

console.log("Main log");

__tests__/main.spec.js

describe("thing",function(){
  it('should',function(){
    require('./../main.js')
  })
})`

When you run, jest, It outputs main log

Shouldn't main.js be mocked here? What am I missing?

Upvotes: 1

Views: 160

Answers (1)

Code Whisperer
Code Whisperer

Reputation: 23662

The reason for this is the Module Ignore patterns.

I had express in my ignore patterns, and my project was in a folder called express-rest-api

Upvotes: 1

Related Questions