I have a problem and I cannot find any solution that works. I want to be able to have all my react unit-tests outside my delivery project, so whenever we create a delivery it only contains the source code and not the tests. All the code are written in Typescript.
- root
delivery_project
client (React Application)
- src
server (NodeJS)
- src
tests
client
test1.test.tsx
test2.test.tsx
server
- ...
So if I have a React component in the test:
import SomeComponent from "./delivery_project/client/src/pages/components"
test(“Some test”, async() => {
const testComponent = renderWithProviders(<SomeComponent />);
// Do something with testComponent
});
For testing I have jest:
// package.json:
"scripts": {
"test": "jest --forceExit --detectOpenHandles --no-cache"
}
Anyone can help me to accomplish this?
Best regards.
I have tried to use react-app-rewired and I could not get that to work.