Skip to content

Commit 29f4af1

Browse files
author
Luca Forstner
authored
test(e2e): Allow lockfiles in E2E tests (#5871)
1 parent f5cbc4c commit 29f4af1

File tree

5 files changed

+9104
-27
lines changed

5 files changed

+9104
-27
lines changed

packages/e2e-tests/README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ cat > test-applications/my-new-test-application/.npmrc << EOF
4040
@sentry-internal:registry=http://localhost:4873
4141
EOF
4242

43-
# Add a gitignore that ignores lockfiles
44-
cat > test-applications/my-new-test-application/.gitignore << EOF
45-
yarn.lock
46-
package-lock.json
47-
EOF
48-
4943
# Add a test recipe file to the test application
5044
touch test-applications/my-new-test-application/test-recipe.json
5145
```
@@ -56,7 +50,7 @@ To get you started with the recipe, you can copy the following into `test-recipe
5650
{
5751
"$schema": "../../test-recipe-schema.json",
5852
"testApplicationName": "My New Test Application",
59-
"buildCommand": "yarn install --no-lockfile",
53+
"buildCommand": "yarn install --pure-lockfile",
6054
"tests": [
6155
{
6256
"testName": "My new test",
@@ -71,7 +65,9 @@ The `test-recipe.json` files follow a schema (`e2e-tests/test-recipe-schema.json
7165
fields:
7266

7367
- The `buildCommand` command runs only once before any of the tests and is supposed to build the test application. If
74-
this command returns a non-zero exit code, it counts as a failed test and the test application's tests are not run.
68+
this command returns a non-zero exit code, it counts as a failed test and the test application's tests are not run. In
69+
the example above, we use the `--pure-lockfile` flag to install depencies without modifiying the lockfile so that
70+
there aren't any changes in the git worktree after running the tests.
7571
- The `testCommand` command is supposed to run tests on the test application. If the configured command returns a
7672
non-zero exit code, it counts as a failed test.
7773
- A test timeout can be configured via `timeoutSeconds`, it defaults to `60`.

packages/e2e-tests/test-applications/create-react-app/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ yarn-debug.log*
2323
yarn-error.log*
2424

2525
!*.d.ts
26-
yarn.lock
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "../../test-recipe-schema.json",
33
"testApplicationName": "create-react-app",
4-
"buildCommand": "yarn install && yarn build",
4+
"buildCommand": "yarn install --pure-lockfile && yarn build",
55
"tests": []
66
}

0 commit comments

Comments
 (0)