Skip to content

Commit

Permalink
(refactor) Refactor test setup to leverage caching by turbo (#1289)
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen authored Jul 24, 2023
1 parent 483b93d commit 35a1dec
Show file tree
Hide file tree
Showing 181 changed files with 2,862 additions and 2,109 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,13 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
server-token: ${{ env.TURBO_TOKEN }}


- name: Run tests
run: yarn run test

- name: Run lint and typecheck
run: yarn turbo run lint typescript --color
- name: Run lint, type checks and tests
run: yarn verify

- name: Run build
run: yarn turbo run build --color --concurrency=5
run: yarn turbo build --color --concurrency=5

pre_release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -89,7 +87,7 @@ jobs:
run: yarn lerna version "$(node -e "console.log(require('semver').inc(require('./lerna.json').version, 'patch'))")-pre.${{ github.run_number }}" --no-git-tag-version --no-push --yes

- name: Build
run: yarn turbo run build --color --concurrency=5
run: yarn turbo build --color --concurrency=5

- run: git config user.email "[email protected]" && git config user.name "OpenMRS CI"
- run: git add . && git commit -m "Prerelease version" --no-verify
Expand Down Expand Up @@ -154,7 +152,7 @@ jobs:
server-token: ${{ env.TURBO_TOKEN }}

- name: Build
run: yarn turbo run build --color --concurrency=5
run: yarn turbo build --color --concurrency=5

- name: Publish
run: yarn run ci:publish
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
set -e # die on error

yarn pretty-quick --staged
yarn run verify
yarn verify
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:wave: *New to our project? Be sure to review the [OpenMRS 3 Frontend Developer Documentation](https://openmrs.github.io/openmrs-esm-core/#/). You may find the [Map of the Project](https://openmrs.github.io/openmrs-esm-core/#/main/map) especially helpful.* :teacher:
:wave: *New to our project? Be sure to review the [OpenMRS 3 Frontend Developer Documentation](https://openmrs.github.io/openmrs-esm-core/#/). You may find the [Map of the Project](https://openmrs.github.io/openmrs-esm-core/#/main/map) especially helpful.* :teacher:

![OpenMRS CI](https://github.com/openmrs/openmrs-esm-patient-chart/actions/workflows/ci.yml/badge.svg)

Expand Down Expand Up @@ -45,7 +45,6 @@ yarn start --sources 'packages/esm-patient-<insert-package-name>-app'

This command uses the [openmrs](https://www.npmjs.com/package/openmrs) tooling to fire up a dev server running `esm-patient-chart` as well as the specified microfrontend.


There are two approaches for working on multiple microfrontends simultaneously.

You could run `yarn start` with as many `sources` arguments as you require. For example, to run the biometrics and vitals microfrontends simultaneously, you'd use:
Expand All @@ -56,6 +55,48 @@ yarn start --sources 'packages/esm-patient-biometrics-app' --sources 'packages/e

Alternatively, you could run `yarn serve` from within the individual packages and then use [import map overrides](http://o3-dev.docs.openmrs.org/#/getting_started/setup?id=import-map-overrides).

## Running tests

To run tests for all packages, run:

```bash
yarn turbo test
```

To run tests in `watch` mode, run:

```bash
yarn turbo test:watch
```

To run tests for a specific package, run:

```bash
yarn turbo test --filter="<package-name>"
# For example, to run tests for just the Conditions app, run:
yarn turbo test --filter="esm-patient-conditions-app"
```

To generate a `coverage` report, run:

```bash
yarn turbo coverage
```

By default, `turbo` will cache test runs. This means that re-running tests wihout changing any of the related files will return the cached logs from the last run. To bypass the cache, run tests with the `force` flag, as follows:

```bash
yarn turbo test --force
```

To run end-to-end tests, run:

```bash
yarn test-e2e
```

Read the [e2e testing guide](/e2e/README.md) to learn more about End-to-End tests in this project.

## Troubleshooting

If you notice that your local version of the application is not working or that there's a mismatch between what you see locally versus what's in [dev3](https://dev3.openmrs.org/openmrs/spa), you likely have outdated versions of core libraries. To update core libraries, run the following commands:
Expand Down
8 changes: 0 additions & 8 deletions __mocks__/carbon-interface.ts

This file was deleted.

275 changes: 0 additions & 275 deletions __mocks__/dimensions.mock.ts

This file was deleted.

Loading

0 comments on commit 35a1dec

Please sign in to comment.