I am running e2e tests with Playwright within a Docker container. I am mounting my host machine to the container and then running the tests inside the container.
// npm script to run container in interactive mode and mount current folder to /app
"e2e-container-it": "docker run -it --name e2e-container-it -v $(pwd):/app e2e-image /bin/bash"
The problem I've encountered is that when I run my tests on Windows with Docker container running on Ubuntu, everything works perfectly fine...
But when I run my tests on Mac (M3) with Docker container running on Ubuntu, the following error is thrown:
Running 6 tests using 5 workers
Error: ENOENT: no such file or directory, stat '/Users/{path-to-repository}' at hasJSComponents (/app/node_modules/@playwright/experimental-ct-core/lib/viteUtils.js:145:51) at buildBundle (/app/node_modules/@playwright/experimental-ct-core/lib/vitePlugin.js:134:50) at Object.begin (/app/node_modules/@playwright/experimental-ct-core/lib/vitePlugin.js:47:22)
6 did not run
Does anybody know why this happens on mac? It seems like docker cannot access/find the path to the repository. I have a feeling it must be something related to accessing Mac's folder structure... like missing permissions?
What I have tried so far:
This problem turned out to be something similar like in this discussion: mac docker volume mount using osxfs not working
In Docker Desktop > Preferences > General there is an option "Virtio FS" for file sharing which is by default checked. Unchecking then checking that option and restarting solved my issue.