Skip to content

Commit

Permalink
🔀 Applied changes from alex-cannon pr jestjs#9109
Browse files Browse the repository at this point in the history
  • Loading branch information
kaffarell committed Jul 11, 2022
1 parent c44de55 commit 788af24
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Reference: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Exclude node_modules
node_modules
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
### Chore & Maintenance

- `[*]` Replace internal usage of `pretty-format/ConvertAnsi` with `jest-serializer-ansi-escapes` ([#12935](https://github.com/facebook/jest/pull/12935), [#13004](https://github.com/facebook/jest/pull/13004))
- `[*]` Added Dockerfile for Jest Development ([#9109](https://github.com/facebook/jest/pull/9109))


### Performance

Expand Down
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,28 @@ _Before_ submitting a pull request, please make sure the following is done…
```

Note: Replace `<your_username>` with your GitHub username
1. Run Jest with [Docker](https://docs.docker.com/engine/docker-overview/) (Optional) or continue reading for manual instructions.

1. If you haven't already, [Install Docker](https://docs.docker.com/install/).

1. Navigate to the `/jest` directory. You should be able to see the `Dockerfile` file when you run `ls`.

1. Build the Jest image (may take a few minutes):

```sh
docker build -t jest .
```

1. Run the Jest image:

```sh
docker run --volume="YOUR_PATH_TO_JEST:/usr/src/app" --rm jest:latest
```

1. The `yarn run watch` command will watch the `/packages` directory for file changes. See `package.json` for a full list of commands. [Learn how to run commands in a container](https://docs.docker.com/engine/reference/commandline/exec/) or visit the [official Docker docs](https://docs.docker.com/) for other Docker related questions.

1. **Skip to step #8 and continue reading.**


1. Jest uses [Yarn](https://code.facebook.com/posts/1840075619545360) for running development scripts. If you haven't already done so, please [install yarn](https://yarnpkg.com/en/docs/install).

Expand Down
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#Build: docker build -t jest .
#Run: docker run --volume="$PWD:/usr/src/app" --rm jest:latest

#Use Node 12.13.0 image
#Includes Python2.7
FROM node:12

#Setup basic environment
ENV DEBIAN_FRONTEND=noninteractive \
LANG=en_US.UTF-8 \
LC_ALL=C.UTF-8 \
LANGUAGE=en_US.UTF-8

WORKDIR /usr/src/app

#Copy entire directory
COPY . ./

#Install dependencies
RUN yarn

#Build && Watch for changes
ENTRYPOINT ["yarn"]
CMD ["watch"]

0 comments on commit 788af24

Please sign in to comment.