score:0
how about "testregex": ["test/.*.[jt]s"],
in your jest config so it doesn't try and find shared files, if you're using shared files across multiple projects then no single project should test those files, they should only test their own files.
however i'm not so sure that symlinks are your problem, when using typescript like this and trying to use files outside of your project rootdir it will not find the types for it or it will complain that it can't find the types for it if you've added it to tsconfig include/exclude. right now i can only assume that you're using tsc --project with specific config files for each project.
// tsconfig.json
"include": ["projecta/**/*.ts"],
if you've done something like that then it won't find any types outside of projecta so anything in config.ts and utils.ts will not have any types or be able to find any modules, unless they're included in your tsconfig.
to show a simpler example if i have:
// tsconfig.json
...
includes: ["src/**/*.ts"]
...
along with a directory structure like this:
- tsconfig.json
- example.ts
- src
then anything in example.ts will not be able to find its types or module imports.
the way i get around this issue in my project is to use ts-jest along with specifying where to find tests, along with overriding the globals rootdir.
// .jestrc.json
"testregex": ["test/.*.[jt]s"],
...
"globals": {
"ts-jest": {
"tsconfig": {
"rootdir": "."
}
}
}
Source: stackoverflow.com
Related Query
- Jest doesn't follow files in a symlink folder and tries to use the main shared folder
- What is the difference between .ts and .tsx extensions. Both are used as extensions for typescript files in react. So where should we use them?
- Jest can't use the HOC from js files but works correctly with HOC from tsx files
- Trying to use jest with create-react-app and typescript. Get error: Jest: Failed to parse the TypeScript config file... Cannot find module 'ts-node'
- Why do some React Apps require files in the index.html folder and how to change this?
- How do I commit/push my build folder into another git repository and not into the main repository?
- React, How to use a menu in a seperate file to call an api and return data to a different section of the main file
- How to use Gatsby to display a folder of images and markdown files
- How do you test for the non-existence of an element using jest and react-testing-library?
- React functional stateless component, PureComponent, Component; what are the differences and when should we use what?
- How to test a className with the Jest and React testing library
- SyntaxError with Jest and React and importing CSS files
- What is the technical difference between .jsx and .js files
- Arrow functions and the use of parentheses () or {} or ({})
- What is the difference between Jest and enzyme?
- Is it possible to use Jest with multiple presets at the same time?
- How do I move jest tests to a /test folder and get them to run?
- got Can't resolve 'react/jsx-runtime' error while use try to create the shared component with storybook in react-typescript
- What is the main difference between using React-Redux Hooks and React-Redux Connect()?
- Warning: You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored
- What is the main difference between React Query and Redux?
- What is the best practice to use Oauth2, React, Node.js and Passport.js to authenticate user with Google sign on button?
- mock useDispatch in jest and test the params with using that dispatch action in functional component
- Reactjs: why use const {} = this.props and why put it inside the render function
- How to create a preview (Image and description) to the Url when shared link on Social media,Gmail and Skype using React JS?
- Error running adb: No Android device found. Please connect a device and follow the instructions here to enable USB debugging:
- babel 7 Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead
- Reactjs Warning: input is a void element tag and must not have `children` or use `props.dangerouslySetInnerHTML`. Check the render method of null
- how to import images via props in react and use the 'import' path
- Is the use of the <form> tag necessary in ReactJS that have HOC input tags that handle form-esque events and behaviour?
More Query from same tag
- Reactjs server side templates
- Uncaught SyntaxError: embedded: JSX value should be either an expression or a quoted JSX text (8:26)
- How to get the hostname of a url in react js
- ReactJS application passing state to multiple pages
- Communicate up component's initial state without useEffect warning
- React: how to fetch multiple API's
- Reactjs every time refreshing page on setState
- How to add data attribute without value in react create element?
- How to pass data in 'this.state' from one component to another in ReactJs
- Show/hide button based on state React
- implement an array of objects as attributes in one element in react jsx
- React-Redux Transform data to props
- How to redirect all routes to gatsby index
- Redux saga not dispatching action on live sockets
- How to get and pass deviceKey in social login using Cognito and AWS Amplify?
- context in componentDidMount appears as null
- How do I properly display a list of errors beneath my component?
- React: how do I use onSubmit to change state?
- Project is not pushed in Heroku
- NextJS and React: Cannot read property 'email' of undefined
- _.throttle executing API more than once
- Getting multiple objects inside json object to datagrid
- shouldComponentUpdate + deepEqual and arrays
- React + TypeScript usage of className prop
- how to hide a component in react js after a few second
- Retrieving user Id and language parameters to embedded web-component from the target site
- babel: polyfill Array.from for IE11 support
- How to use different icons for each tab with createBottomTabNavigator?
- Conditionally add/remove property from element with React
- Ag-grid checkbox render based on column data?