Jest not running testing files where npm is

Viewed 6

I'm running into an error in my testing environment for Typescript where jest <file-path> isn't working, but npm tests is. I have a sample file main.test.ts with the following test:

import * as main from './main';

test('is 1 + 1 = 2?', () => {    
  expect(1 + 1).toBe(2)  
})

Running npm test I have no issues running my tests , and all are said to pass. However, running jest main.test.ts (and similar issues for jest ./src/main.test.ts) I am getting the following error:

Test suite failed to run

    Jest encountered an unexpected token

To the best of my knowledge, npm is running jest so I don't see why this might be happening. Thanks

0 Answers
Related