jestjs/jest

Import should be case sensitive

Open

#10398 opened on Aug 12, 2020

View on GitHub
 (19 comments) (0 reactions) (0 assignees)TypeScript (45,361 stars) (6,653 forks)batch import
:bug: BugHelp WantedPinned

Description

🐛 Bug Report :

let's say we have a module named: Autosuggest. and we want to mock it.

import AutoSuggest from './AutoSuggest' // the filename is Autosuggest.js (lower s)
jest.mock('./AutoSuggest', () => ({get : jest.fn(() => 1000)}));

if we import it with camel cases, like: AutoSuggest, it doesn't throw any error. it just let us to do it, and it allow us to mock it. but the mocking actually doesn't work this way.

Why it's important to fix : After one day of debugging about why mocking doesn't work, i fixed it with fixing the cases. so the problem is : it increases debug time.

Expected bahaviur :

jest.mock('./AutoSuggest') should throw an error when there is a module called ./Autosuggest, but there isn't any module called ./AutoSuggest.

Contributor guide