-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running tests in a separate Docker container #1008
Comments
Interesting use case... we could consider the customization for the dependency, but we also need to read output from the test run (we instruct jest to dump output to the tmp dir), how will that work with Docker? |
Reading the output from |
I should clarify that we use nodejs would it be easier if you mount the package folder directory to your developer host instead? Or run tests within the docker env instead of the development env? |
I am not quite sure what you mean by that. What is the package folder, are you talking about |
I've used this script as jest.jestCommandLine to run tests and transfer results For some reason I have both local and container paths in Test Explorer (local ones getting marked green/red).
|
I think it will be easier to mount this path from the host onto the container using volumes and allowing user's to pass a custom path to the reporter, which in this case will be the mount path on the container. services:
web-test:
volumes:
- '~/.vscode/extensions/orta.vscode-jest-5.2.3/out/reporter.js:/root/.vscode/extensions/orta.vscode-jest-5.2.3/out/reporter.js' |
That didn't work for me due to the full path being passed on mac which contains /Users |
Environment
vscode-jest version
: v5.2.3node -v
: 19.0.0npm -v
oryarn --version
: 8.19.2npm ls jest
ornpm ls react-scripts
(if you haven’t ejected):@ek/[email protected] /app
+-- @ek/[email protected]
| `-- [email protected] deduped
+-- [email protected]
| `-- [email protected] deduped
`-- [email protected]
docker exec -t nodejs-generator-test-unittest_app_1 npx jest --coverage --runInBand
node:current-alpine
Prerequisite
npm run test
ornode_modules/.bin/jest
)docker exec -t nodejs-generator-test-unittest_app_1 npx jest --coverage --runInBand
(the command that is also passed to vscode-jest)Steps to Reproduce
I do not belive this the be necessary, see error description below.
Relevant Debug Info
None
Expected Behavior
The tests should run.
Actual Behavior
I get the error
Als mentioned in the title, all of my unittests are run inside of a separate container. This makes the error message quite clear: The extension is looking for a file inside of the container that is actually on the host. My question is wether there is a good possibility to provide this required file in the container. My preferred way would be by installing an addional NPM package, ore some other command that installs the required files inside of the container and can be executed in the
Dockerfile
. I have full access to theDockerfile
, so it can be changed in any way I like.I could also mount the file into the container using Docker but this is impractical to the point that I would abstrain from using the extension, since mounting the file directly would depend on where VS Code (or VS Code Server) is installed on the host. That makes this solution rather suboptimal considering that a bunch of people at my company are supposed to use the setup, so VS Code installations vary quite a bit.
The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...
The text was updated successfully, but these errors were encountered: