Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(chore) Update test scripts and their related documentation #754

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 43 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,51 @@ yarn build
./dist/cli.js
```

### Testing
### Running tests

Run `yarn test` in the directory containing the package you want to test.
To run tests for all packages, run:

Run `yarn lerna run test` to run all the tests in this repository.
```bash
yarn turbo test
```

To run tests in `watch` mode, run:

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

To run tests for a specific package, pass the package name to the `--filter` flag. For example, to run tests for `esm-patient-conditions-app`, run:

```bash
yarn turbo test --filter="esm-patient-conditions-app"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@openmrs/esm-patient-conditions-app

I know it matches, but I believe better to put the whole name in the md.

```

To run a specific test file, run:

```bash
yarn turbo test -- login
```

The above command will only run tests in the file or files that match the provided string.

You can also run the matching tests from above in watch mode by running:

```bash
yarn turbo test:watch -- login.test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above is login and here is login.test, can we keep it the same?
A beginner might confuse.

```

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
```

### Linking the framework

Expand Down
3 changes: 2 additions & 1 deletion packages/apps/esm-devtools-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"start": "openmrs develop",
"serve": "webpack serve --mode=development",
"debug": "npm run serve",
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode=development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/apps/esm-implementer-tools-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"start": "openmrs develop",
"serve": "webpack serve --mode=development",
"debug": "npm run serve",
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode=development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/apps/esm-login-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"start": "openmrs develop",
"serve": "webpack serve --mode=development",
"debug": "npm run serve",
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode=development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/apps/esm-offline-tools-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"start": "openmrs develop",
"serve": "webpack serve --mode=development",
"debug": "npm run serve",
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode=development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/apps/esm-primary-navigation-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"start": "openmrs develop",
"serve": "webpack serve --mode=development",
"debug": "npm run serve",
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode=development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/framework/esm-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"main": "src/index.ts",
"source": true,
"scripts": {
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/framework/esm-breadcrumbs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"main": "src/index.ts",
"source": true,
"scripts": {
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/framework/esm-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"main": "src/index.ts",
"source": true,
"scripts": {
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/framework/esm-dynamic-loading/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"source": true,
"sideEffects": false,
"scripts": {
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/framework/esm-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"main": "src/index.ts",
"source": true,
"scripts": {
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/framework/esm-feature-flags/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"main": "src/index.ts",
"source": true,
"scripts": {
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/framework/esm-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"source": true,
"scripts": {
"document": "../../../document.sh esm-framework",
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/framework/esm-offline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"main": "src/index.ts",
"source": true,
"scripts": {
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/framework/esm-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"main": "src/index.ts",
"source": true,
"scripts": {
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
3 changes: 2 additions & 1 deletion packages/framework/esm-styleguide/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"main": "src/index.ts",
"source": true,
"scripts": {
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"start:storybook": "start-storybook --port 7000",
"build:storybook": "build-storybook",
"build": "webpack --mode=production",
Expand Down
3 changes: 2 additions & 1 deletion packages/framework/esm-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"source": true,
"sideEffects": false,
"scripts": {
"test": "jest --config jest.config.js --passWithNoTests",
"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",
"build": "webpack --mode=production",
"build:development": "webpack --mode development",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down
24 changes: 6 additions & 18 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,15 @@
"dependsOn": ["^build:development"],
"outputs": ["dist/**"]
},
"test": {
"dependsOn": [],
"outputs": []
},
"watch": {
"dependsOn": [],
"outputs": []
},
"test": {},
"test:watch": {},
"watch": {},
"lint": {
"dependsOn": ["^lint"],
"outputs": []
"dependsOn": ["^lint"]
},
"typescript": {
"dependsOn": ["^typescript"],
"outputs": []
},
"extract-translations": {
"outputs": []
"dependsOn": ["^typescript"]
},
"dev": {
"cache": false
}
"extract-translations": {}
}
}
Loading