Skip to content

Commit

Permalink
build: refactor test run script / targets (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlj95 authored Jul 8, 2024
1 parent 17d4ffb commit 7c17cec
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ install:
lint:
pnpm run lint --format eslint-formatter-multiple --max-warnings 0

test:
unit-test:
pnpm run prebuild:font-subsets
pnpm run prebuild:simple-icons

# In CI, this file is not generated because should be mocked when testing
cp ../src/test/mocks/release.json ..

pnpm run test --browsers=ChromeHeadless \
pnpm run test:unit --browsers=ChromeHeadless \
--no-watch --no-progress --reporters junit,progress --code-coverage
2 changes: 1 addition & 1 deletion .github/workflows/reusable-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Setup
uses: ./.github/actions/setup
- name: Run tests
run: cd .ci && make test
run: cd .ci && make unit-test
- name: Report test results (as status check)
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # v1
if: (success() || failure()) && github.ref == 'refs/heads/main'
Expand Down
8 changes: 0 additions & 8 deletions .idea/runConfigurations/CI__Test.xml

This file was deleted.

8 changes: 8 additions & 0 deletions .idea/runConfigurations/CI__Unit_test.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations/Test__components_with_Cypress.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ commands that will be run in CI/CD pipelines. So you can test those locally easi
Just:

```shell
cd .ci && make test # for instance
cd .ci && make unit-test # for instance
```

And see how a command run in the CI/CD behaves locally. Notice your machine's state may differ from the CI/CD machine
one.
one. Not all commands are there, only the ones that differ from regular `package.json` run scripts.

## Further help

Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"build": "ng build",
"build:pullRequest": "pnpm run build --configuration pullRequest,production",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"test:coverage": "ng test --code-coverage --watch false",
"test": "pnpm run '/test:.*/'",
"test:unit": "ng test --code-coverage --watch false",
"//0": "👇 Can't be 'coverage:report', look for that run script comments for reason",
"coverage:report:all": "pnpm run coverage:move-to-nyc-output && nyc report --reporter lcov --report-dir coverage",
"coverage:move-to-nyc-output": "rm -rf .nyc_output && mkdir .nyc_output && cp -f coverage/*.json .nyc_output",
Expand All @@ -39,8 +39,7 @@
"serve:ssr:@davidlj95/website": "node dist/@davidlj95/website/server/server.mjs",
"e2e": "ng e2e",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"cypress:run:ct": "cypress run --component",
"test:components": "cypress run --component",
"//2": "👇 Cypress executes it to perform custom reporting. With this:",
"//3": " - **same filename for local/CI**: the 'mv' command is run in both local & CI, so JSON coverage filename is the same",
"//4": " - **.nycrc* config files avoided:** could be mistakenly used by other tools",
Expand Down

0 comments on commit 7c17cec

Please sign in to comment.