Skip to content

Commit

Permalink
Update README and make the tests actually execute and pass
Browse files Browse the repository at this point in the history
  • Loading branch information
mseaton committed Mar 15, 2024
1 parent 1c89948 commit 353975c
Show file tree
Hide file tree
Showing 5 changed files with 1,073 additions and 75 deletions.
55 changes: 13 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,36 @@
# This is the PIH monorepo for OpenMRS 3.x.

## TODO:
- set up release workflows (and update package.json)
## Developer Setup

// enable these when we figure out
// "ci:publish": "yarn workspaces foreach --all --topological --exclude @openmrs/esm-patient-management npm publish --access public --tag latest",
// "ci:prepublish": "yarn workspaces foreach --all --topological --exclude @openmrs/esm-patient-management npm publish --access public --tag next",
// "release": "yarn workspaces foreach --all --topological version",
Check out the O3 developer documentation [here](http://o3-dev.docs.openmrs.org).

- review the dependencies and devDependencies in package.json and clean it up
- add github actions. List of removed files under .github/workflows:
- bundle-size.yml
- ci.yml
- e2e.yml
- tx-pull.yml
- tx-push.yml
- re-setup github actions in old esm-referral-queues
This monorepo uses [yarn](https://yarnpkg.com). To install the dependancies, run:

## Setup

Check out the developer documentation [here](http://o3-dev.docs.openmrs.org).

This monorepo uses [yarn](https://yarnpkg.com).

To install the dependancies, run:
```bash
yarn install
```

To set up environment variables for the project, follow these steps:

1. Create a copy of the .env.example file by running the following command:

```bash
cp example.env .env
```

2. Open the newly created .env file in the root of the project.

3. Add the environment variables you need.

Note: These variables are currently only used for end-to-end tests.

To start a dev server for a specific module, run:

```bash
yarn start --sources 'packages/esm-<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-management` as well as the specified module.
To do this with specific configuration, run:

```bash
yarn start --backend "http://localhost:8080/" --config-url "site/base-config.json" --config-url "site/config.json" --sources 'packages/esm-<insert-package-name>-app' --port 8081
```

You could provide `yarn start` with as many `sources` arguments as you require. For example, to run the patient registration and patient search modules only, use:
You could provide `yarn start` with as many `sources` arguments as you require. For example:

```bash
yarn start --sources 'packages/esm-patient-search-app' --sources 'packages/esm-patient-registration-app'
yarn start --sources 'packages/esm-xxx-app' --sources 'packages/esm-yyy-app'
```

## 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 the reference application, you likely have outdated versions of core libraries. To update core libraries, run the following commands:
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 expected, you likely have outdated versions of core libraries. To update core libraries, run the following commands:

```bash
# Upgrade core libraries
Expand All @@ -71,10 +43,9 @@ git checkout package.json
yarn
```


## Contributing

Please read our [contributing](http://o3-dev.docs.openmrs.org/#/getting_started/contributing) guide.
Please read the OpenMRS [contributing](http://o3-dev.docs.openmrs.org/#/getting_started/contributing) guide.

## Running tests

Expand Down Expand Up @@ -182,4 +153,4 @@ The tag should be prefixed with `v` (e.g., `v3.2.1`), while the release title
should just be the version number (e.g., `3.2.1`). The creation of the GitHub release
will cause GitHub Actions to publish the packages, completing the release process.

> Don't run `npm publish` or `yarn publish`. Use the above process.
> Don't run `npm publish` or `yarn publish`. Use the above process.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
"@playwright/test": "^1.42.1",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.3",
"i18next": "^21.10.0",
"i18next-parser": "^6.6.0",
"openmrs": "^5.4.0",
"prettier": "^3.2.5",
"turbo": "^1.12.5",
Expand Down
11 changes: 6 additions & 5 deletions packages/esm-referrals-queue-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
"scripts": {
"start": "openmrs develop",
"serve": "webpack serve --mode=development",
"debug": "npm run serve",
"build": "webpack --mode production",
"analyze": "webpack --mode=production --env.analyze=true",
"lint": "eslint src --ext js,jsx,ts,tsx",
"prettier": "prettier --write \"src/**/*.{ts,tsx}\"",
"lint": "cross-env eslint src --ext ts,tsx",
"test": "cross-env TZ=UTC jest --config jest.config.js --verbose false --passWithNoTests --color",
"test:watch": "cross-env TZ=UTC jest --watch --config jest.config.js --color",
"coverage": "yarn test --coverage",
"typescript": "tsc",
"verify": "turbo lint typescript test --color --concurrency=2",
"coverage": "yarn test -- --coverage",
"prepare": "husky install"
"extract-translations": "i18next 'src/**/*.component.tsx'"
},
"browserslist": [
"extends browserslist-config-openmrs"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { defineConfigSchema } from '@openmrs/esm-framework';
import React from 'react';
import { of } from 'rxjs';
import { render, fireEvent, screen, within, waitFor } from '@testing-library/react';
import MockDate from 'mockdate';
import ReferralsQueue from './referrals-queue.component';
import { getReferrals } from './referrals-queue.resource';
import { configSchema } from '../config-schema';

jest.mock('./referrals-queue.resource');
const mockedGetReferrals = getReferrals as jest.Mock;
Expand Down Expand Up @@ -55,6 +57,9 @@ window.location = { href: '/referrals-queue' };

describe('referrals queue', () => {
const todayString = '2020-10-31';
beforeAll(() => {
defineConfigSchema('@pih/esm-referral-queues-app', configSchema);
});
beforeEach(() => {
MockDate.set(todayString + 'T10:00:00.000-0400');
mockedGetReferrals.mockReset();
Expand Down
Loading

0 comments on commit 353975c

Please sign in to comment.