playwright
playwright copied to clipboard
Module not found with component testing
I have this project structure:
project_root
node_modules
src
layouts
Header.tsx
playwright-ct-test
layouts
Header.test.tsx
In playwright-ct.config.ts
testDir
is set to ./playwright-ct-test
. When I run npx run test-ct
I get
Error: Cannot find module 'geojson'
Require stack:
- <project_root>\src\measurement\types.ts
- <project_root>\src\user\types.ts
- <project_root>\src\user\userReducer.ts
- <project_root>\src\rootReducers.ts
- <project_root>\src\configureStore.ts
- <project_root>\playwright-ct-test\layouts\Header.spec.tsx
- <project_root>\node_modules\@playwright\test\lib\loader.js
- <project_root>\node_modules\@playwright\test\lib\runner.js
- <project_root>\node_modules\@playwright\test\lib\cli.js
- <project_root>\node_modules\playwright-core\lib\cli\cli.js
- <project_root>\node_modules\playwright-core\cli.js
- <project_root>\node_modules\@playwright\test\cli.js
at ..\src\measurement\types.ts:1
> 1 | import { Feature, Point } from 'geojson'
| ^
Now of course geojson
and @types/geojson
are installed (the application works fine). Why cannot Playwright or Vite resolve this module?