简体   繁体   中英

Setup jest multi projects with create-react-app and node

My projects uses a /server folder for my backend code and /react-ui for my client side code. There's a package.json in each folder. I can run test separately in the cmd line, but I would like to run both at the same time. I know about the multi projects feature of jest, but it doesn't seem to work with create-react-app. I'm trying to setup jest with babel as if I was not using create-react-app, but it seems like the wrong approach considering jest is already setup in CRA.

My current setup runs from the /server jest installation. With projects: ['<rootDir>', '<rootDir>/../react-ui'] . The jest documentation isn't clear how I could direct it to run npm test in /react-ui

My only goal is to be able to watch both at the same time and I would like to not eject from CRA.

您可以在主级别上使用 (gulp) 脚本来分别运行每个测试,但使用相同的配置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM