isolatedModules error on Jest test with Create React App and TypeScript?

后端 未结 1 1785
青春惊慌失措
青春惊慌失措 2021-02-13 01:48

I\'ve started a Create React App project with --typescript. When I write a test Im getting a compiler error:

// something-test.tsx
test(\'something\', ()=>{
          


        
1条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-13 02:26

    You do not have any import statements in your code. This basically means you are not testing anything outside of the test file.

    If you test something that is not in the test code (and therefore import something), the test file will become a module and the error will go away

    0 讨论(0)
提交回复
热议问题