jestjs/jest

Import should be case sensitive

Open

#10,398 opened on 2020幎8月12日

GitHub で芋る
 (19 comments) (0 reactions) (0 assignees)TypeScript (6,653 forks)batch import
:bug: BugHelp WantedPinned

Repository metrics

Stars
 (45,361 stars)
PR merge metrics
 (平均マヌゞ 11d 22h) (30d で 11 merged PRs)

説明

🐛 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.

コントリビュヌタヌガむド