Skip to content

Commit

Permalink
ci: make e2e tests run on a production-like install
Browse files Browse the repository at this point in the history
to reproduce exact dependency versions
  • Loading branch information
thomvaill committed Dec 16, 2024
1 parent 0d79876 commit fe9a9dc
Show file tree
Hide file tree
Showing 7 changed files with 460 additions and 51 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/reusable-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,8 @@ jobs:
cache: yarn
cache-dependency-path: yarn.lock

# We install project dependencies to be able to run e2e-launcher.js
- run: yarn install --frozen-lockfile

# But we do install log4brains from the registry
- run: npm install -g ${{ inputs.npm-package-fullname }}

# We don't use "yarn e2e" directly so we are sure that we are using the global version of log4brains
- name: E2E Tests on the registry version
run: node e2e-launcher.js
working-directory: e2e-tests
run: yarn e2e
2 changes: 2 additions & 0 deletions .github/workflows/reusable-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@ jobs:
run: |
yarn link-cli
echo "$(yarn global bin)" >> $GITHUB_PATH
rm -rf node_modules
yarn install --production --no-lockfile
yarn e2e
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ Log4brains follows a **simplified Git Flow** model. Here’s how the process wor
yarn format:fix # enforced automatically before every commit with husky+lint-staged
yarn typescript # enforced automatically before every commit with husky
yarn test:changed # (or `yarn test` to run all the tests)

# Simulate the execution on a fresh install:
yarn link-cli
yarn build
rm -rf node_modules
yarn install --production --no-lockfile
yarn e2e
```

If applicable, a pull request without tests will be rejected.
Expand Down
11 changes: 11 additions & 0 deletions e2e-tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "e2e-tests",
"description": "Log4brains E2E tests sub-package",
"private": true,
"devDependencies": {
"chai": "^4.2.0",
"chalk": "^4.1.0",
"execa": "^4.1.0",
"rimraf": "^6.0.1"
}
}
Loading

0 comments on commit fe9a9dc

Please sign in to comment.