Skip to content
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

Create Dockerfile for contributing #9109

Closed
wants to merge 10 commits into from

Conversation

Alex-Cannon
Copy link

@Alex-Cannon Alex-Cannon commented Oct 29, 2019

Close #9105

To Do

  • Create functional Dockerfile for contributing
  • Add documentation for dockerfile *Should be reviewed
  • Update CHANGELOG.md in the root of the project if you have not done so.
  • Run prettier over CONTRIBUTING.md
  • Fix change log to say Chore && Maintainance
  • Verified yarn runs correctly
  • yarn test does NOT run correctly. Troubleshooting...

Summary

This PR adds a Dockerfile that contributors can use. This allows people to get Jest up and running without manual installation. See #9105 for more details.

I am by no means a Docker or Jest expert. I'm sure there are improvements to this file that can be made. Feel free to let me know any changes that are requested! 👍

Test plan

Simply run the following commands to test this (Tested on Ubuntu 18.04):

Build Jest

docker build -t jest .

Run Jest

  • You may need to replace $PWD with the path to your Jest clone.
docker run --volume="$PWD:/usr/src/app" --rm jest:latest

Expected Results

  1. Jest builds successfully
  2. Jest runs successfully (in watch mode)
  3. When you modify && save a .ts file in /packages, it should automatically re-compile.

@facebook-github-bot
Copy link
Contributor

Hi Alex-Cannon! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for starting this! can you add a .dockerignore as well that ignores node_modules?

Dockerfile Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should install all packages we need for tests to pass. Can you verify yarn && yarn test passes with this image?

@Alex-Cannon
Copy link
Author

@SimenB thanks for the feedback. I'll work on these changes. I'll keep a log of my work on my top comment.

@Alex-Cannon
Copy link
Author

Alex-Cannon commented Nov 4, 2019

@SimenB looks like all the tests are green. However, I ran yarn and got this error:
Investigating now.

Error: cannot find module '@babel/plugins-transform-modules-commonjs'...

Update: The error went away when I changed my volume mount from this:

  1. --volume="$PWD:/usr/src/app"
  2. To this: --volume="$PWD/packages:/usr/src/app/packages"

@SimenB I looked over scripts/watch.js and it appears that Jest only watches /packages? If this is the case, my solution will work, otherwise I'll have to troubleshoot more.

yarn

I ran yarn in the Jest container. It completed and there were no errors.

yarn test

I ran yarn test in the Jest container. There were several errors.

Inline snapshot errors

There were inline snapshot errors across the app. It looked like inline snapshots were broken. This may have been because I ran the command like so:

  1. Started a Jest container with yarn watch
  2. I opened a new CMD and ran yarn test in the Jest container

There also might be a missing package that is required? See the Dockerfile for more info. Below are two error logs for these errors:

watch error
snapshot errors

Additional Errors

I'm not sure what these errors mean or how to fix them. A possibility is that I didn't install the correct packages for Jest? For example, mercurial, etc.

more errors

@SimenB
Copy link
Member

SimenB commented Nov 6, 2019

I'm not sure if mounting the volume stuff will work properly at all since we need e.g. nested node_modules that differ between architectures... Will need to think that through a bit

Not sure about the snapshot failure, possibly related to the mounted volume thing?

The mercurial errors are expected (for now), see #8653.

@Alex-Cannon
Copy link
Author

@SimenB got it. So mercurial errors are expected, but not the snapshot errors. I have an idea of what might be going wrong with the snapshots. Troubleshooting now...

@SimenB
Copy link
Member

SimenB commented Feb 24, 2022

@Alex-Cannon hey! are you still interested in working on this? 🙂

kaffarell added a commit to kaffarell/jest that referenced this pull request Jul 11, 2022
@kaffarell
Copy link
Contributor

kaffarell commented Jul 13, 2022

This PR should be closed and the work should be continued on pr #13009.

@kaffarell
Copy link
Contributor

@SimenB @Alex-Cannon

Copy link

This PR is stale because it has been open 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Feb 29, 2024
Copy link

This PR was closed because it has been stalled for 30 days with no activity. Please open a new PR if the issue is still relevant, linking to this one.

@github-actions github-actions bot closed this Mar 30, 2024
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a Dockerfile for contributing
4 participants