Skip to content

Commit

Permalink
(chore) Update test scripts and their related documentation (#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen authored Sep 12, 2023
1 parent b7e3085 commit 9ea8ae1
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 37 deletions.
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"
```

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

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": {}
}
}

0 comments on commit 9ea8ae1

Please sign in to comment.