I have a simple project with 2 tests.
test.jsx
test.tsx
When I run mocha with the following presets
"presets": ["@babel/preset-env", "@babel/preset-react"]
The jsx test works but the tsx has a problem parsing...
(function (exports, require, module, __filename, __dirname) { import React from
'react';
^^^^^
SyntaxError: Unexpected identifier
When I change to...
"presets": ["@babel/preset-typescript", "@babel/preset-react"],
I get
I:\...\enzyme-example-mocha\test\.setup.js:1
(function (exports, require, module, __filename, __dirname) { import { JSDOM } f
rom 'jsdom';
^
SyntaxError: Unexpected token {
Is there a way I can get both to work? My project is based off of
https://github.com/airbnb/enzyme/tree/master/packages/enzyme-example-mocha
I also tried
["@babel/preset-typescript", "@babel/preset-env", "@babel/preset-react"]
But I get the same...
I:\...\enzyme-example-mocha\test\.setup.js:1
(function (exports, require, module, __filename, __dirname) { import { JSDOM } f
rom 'jsdom';
If I switch around ["@babel/preset-env", "@babel/preset-typescript", "@babel/preset-react"] I get
(function (exports, require, module, __filename, __dirname) { import React from
'react';
^^^^^
SyntaxError: Unexpected identifier