From 788af246c55a97be4bae42e06e69a0c36fc33e2b Mon Sep 17 00:00:00 2001 From: kaffarell Date: Mon, 11 Jul 2022 23:25:23 +0200 Subject: [PATCH] :twisted_rightwards_arrows: Applied changes from alex-cannon pr #9109 --- .dockerignore | 3 +++ CHANGELOG.md | 2 ++ CONTRIBUTING.md | 22 ++++++++++++++++++++++ Dockerfile | 24 ++++++++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000000..e25a73be14f7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +# Reference: https://docs.docker.com/engine/reference/builder/#dockerignore-file +# Exclude node_modules +node_modules \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 670867b065e9..45acc50900c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aa0ccdb5b328..c4fd4fe76f66 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,6 +33,28 @@ _Before_ submitting a pull request, please make sure the following is doneā€¦ ``` Note: Replace `` 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). diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000000..72a300808d2e --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file