I have a repository with yarn 3 workspaces and a CRA front end located in /packages/client
yarn workspace client start
successfully launches the development app on port 3000.
The test suite ran correctly before moving the client to the packages
folder and setting up the yarn workspace. I have made no changes to the client's package.json
.
Running yarn workspace client test
gives:
Error: Failed to initialize watch plugin "../../.yarn/__virtual__/jest-watch-typeahead-virtual-2d80f0ed7c/0/cache/jest-watch-typeahead-npm-1.0.0-0c228b0e38-388d518974.zip/node_modules/jest-watch-typeahead/build/file_name_plugin/plugin.js":
● Test suite failed to run
/Users/bob/monorepo/.yarn/__virtual__/jest-watch-typeahead-virtual-2d80f0ed7c/0/cache/jest-watch-typeahead-npm-1.0.0-0c228b0e38-388d518974.zip/node_modules/jest-watch-typeahead/build/file_name_plugin/plugin.js:1
import { Prompt } from 'jest-watcher';
^^^^^^
SyntaxError: Cannot use import statement outside a module
28077 | try {
28078 | module.isLoading = true;
> 28079 | module.load(modulePath);
| ^
28080 | hasThrown = false;
28081 | } finally {
28082 | module.isLoading = false;
at Function.external_module_.Module._load (../../.pnp.cjs:28079:14)