Description
Hi,
my test command looks like that:
"test": "cross-env CI=true FORCE_COLOR=true react-app-rewired test --scripts-version @jpavon/react-scripts-ts --env=jsdom",
without CI=true i get:
Error: `fsevents` unavailable (this watcher can only be used on Darwin) at new FSEventsWatcher (/Users/mjl/Projects/flipper-frontend/node_modules/sane/src/fsevents_watcher.js:41:11) at createWatcher (/Users/mjl/Projects/flipper-frontend/node_modules/jest-haste-map/build/index.js:780:23) at Array.map (<anonymous>) at HasteMap._watch (/Users/mjl/Projects/flipper-frontend/node_modules/jest-haste-map/build/index.js:936:44) at _buildPromise._buildFileMap.then.then.hasteMap (/Users/mjl/Projects/flipper-frontend/node_modules/jest-haste-map/build/index.js:355:23) at processTicksAndRejections (internal/process/next_tick.js:81:5)
so I added CI variable, than it was screeming at me about lack of ```tsconfig.test.json``
ok - I've created one:
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
}
}
now the error say:
Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
... bla bla bla...
Details:
/Users/mjl/Projects/flipper-frontend/src/components/basic/Button.test.tsx:11
var _a = react_testing_library_1.render(<Button_1.Button />), getByText = _a.getByText, getByTestId = _a.getByTestId, container = _a.container, asFragment = _a.asFragment;
^
SyntaxError: Unexpected token <
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17)
so ..ok I've changed ```tsconfig.test.json``
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"jsx": "react"
}
}
and now he have problem with paths:
1 | import React from 'react'
2 | import style from './Button.module.css'
> 3 | import { Icon } from '#basic/Icon'```
ts.config.json have paths configured like that:
``` "baseUrl": ".",
"paths": {
"#src/*": ["src/*"],
"#components/*": ["src/components/*"],
"#redux/*": ["src/redux/*"],
"#ducks/*": ["src/redux/ducks/*"],
"#basic/*": ["src/components/basic/*"],
"#style/*": ["src/style/*"]
}```
and it is working when i call run
Thx
Mike