Open pizzaisdavid opened 2 months ago
An addition:
In the description, I was running npm run test ci prod
locally, and that is wrong, because it isn't the CI.
But running yarn test
also results in a similar error:
$ yarn test
'C:\Users\David' is not recognized as an internal or external command,
operable program or batch file.
I am trying to fix this by adding the option to run the e2e tests inside of a docker container, this way avoiding any problems with my Windows username.
Currently, I have hit a bug when trying to use the cypress docker container:
e2e-test-runner:
# https://www.cypress.io/blog/2019/05/02/run-cypress-with-a-single-docker-command
image: cypress/included:13.6.6
depends_on:
frontend:
condition: service_healthy
environment:
- CYPRESS_baseUrl=http://frontend:3000
working_dir: /e2e
volumes:
- ./packages/cypress:/e2e
links:
- frontend
Error:
e2e-test-runner-1 | Your configFile is invalid: /e2e/cypress.config.ts
e2e-test-runner-1 |
e2e-test-runner-1 | It threw an error when required, check the stack trace below:
e2e-test-runner-1 |
e2e-test-runner-1 | TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for
/e2e/cypress.config.ts
e2e-test-runner-1 | at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9)
e2e-test-runner-1 | at defaultGetFormat (node:internal/modules/esm/get_format:203:36)
e2e-test-runner-1 | at defaultLoad (node:internal/modules/esm/load:143:22)
e2e-test-runner-1 | at async ModuleLoader.load (node:internal/modules/esm/loader:409:7)
e2e-test-runner-1 | at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:45)
e2e-test-runner-1 | at async link (node:internal/modules/esm/module_job:76:21)
e2e-test-runner-1 exited with code 1
My branch if anyone wants to investigate: https://github.com/ONEARMY/community-platform/compare/master...pizzaisdavid:community-platform:feat/e2e-tests-in-docker?expand=1
I think this might be windows specific as well? yarn test
is what I'm running fine all day on mac.
✅ works:
$ pwd
/c/Users/test/Documents/community-platform
$ yarn test
❌ doesn't work:
$ pwd
/c/Users/test/Documents/lol lol lol/community-platform
$ yarn test
'C:\Users\test\Documents\lol' is not recognized as an internal or external command,
operable program or batch file.
I think it is because there is a space in the path.
On my normal account, my username is David - temp
To me, the ideal fix is introduce a way where cypress is ran inside of docker but still allowing the developer to see the Cypress user interface.
I am a software developer using Windows and my username has a space.
How to reproduce: Execute
npm run test ci prod
Output:
I guess I don't know for sure it is because of the space, but I would start with that assumption.