Skip to content

Commit

Permalink
docs: Update README to include text about Testing (#757)
Browse files Browse the repository at this point in the history
* Installed npm-run-all to create validate function in monitoring

* Update 01-development-instructions.md

* Update 01-development-instructions.md

* Update 01-development-instructions.md

* Added npm run all to devDependencies

* Changed to yarn

* Update 01-development-instructions.md

* Update 01-development-instructions.md

* Removed as it displayed under testing
  • Loading branch information
akinsola-guardian committed May 31, 2023
1 parent 52798c6 commit 33d874d
Show file tree
Hide file tree
Showing 3 changed files with 455 additions and 9 deletions.
62 changes: 58 additions & 4 deletions docs/01-development-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ $ yarn
$ yarn dev
```

## Code Quality
## IDE setup

We recommend using [VSCode](https://code.visualstudio.com/).

## Testing

### CMP App

You can ensure your code passes code quality tests by running:
1. In the base directory, Run yarn validate to check lint, test and build commands. The command below executes all the required commands to ensure your code passed code quality tests:

```
$ yarn validate
Expand All @@ -50,9 +56,57 @@ If you get lint errors, you can attempt to automatically fix them with:
$ yarn fix
```

## IDE setup
2. In the base directory, Run yarn start to serve the test-page.

We recommend using [VSCode](https://code.visualstudio.com/).
```
$ yarn start
```

### Monitoring Directory

1. Change directory to monitoring and run yarn validate to check lint, test and build commands

```
$ cd monitoring
$ yarn validate
```

2. Run yarn start and test against prod

```
$ yarn start --env=prod --jurisdiction=tcfv2
```

### Symlink

The yarn link command allows you to load a module from anywhere on your computer.

1. In the command line in your terminal, navigate to the base directory. Run:

```
yarn link
```

This will create a global link allowing consent-management-platform to be globally accessible by your other projects.

2. Navigate to the repo that will test your app. In the root of this folder, run

```
yarn link @guardian/consent-management-platform
```

This is where you link the repo to the dependent component. Note: The link name should be the dependency npm package name taken from the name property in package.json.

3. Once you’ve developed your changes and tested, you can unlink.

In your parent project terminal, go ahead and run npm unlink fancy-button to unlink the dependency.

```
yarn unlink @guardian/consent-management-platform
```

### Extensions

Expand Down
8 changes: 5 additions & 3 deletions monitoring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"lint": "eslint src/** localRun.ts --ext .ts --no-error-on-unmatched-pattern",
"start": "ts-node-dev localRun.ts",
"remote": "ts-node-dev remoteRun.ts",
"build": "ncc build src/index.ts -o dist -e aws-sdk"
"build": "ncc build src/index.ts -o dist -e aws-sdk",
"validate": "npm-run-all test lint build"
},
"dependencies": {
"@aws-sdk/client-cloudwatch": "^3.276.0",
Expand Down Expand Up @@ -41,13 +42,14 @@
"puppeteer": "^10.2.0",
"ts-jest": "^27.0.7",
"ts-node-dev": "^2.0.0",
"typescript": "4.3.5"
"typescript": "4.3.5",
"npm-run-all": "^4.1.5"
},
"prettier": "@guardian/prettier",
"overrides": {
"clone-deep": "4.0.1"
},
"resolutions":{
"resolutions": {
"//": "Once Jest upgrades its transitive dependency on json5 >=2.0.0, <2.2.2, remove this resolution",
"json5": "^2.2.2"
}
Expand Down
Loading

1 comment on commit 33d874d

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 92.12% 222/241
🟢 Branches 85.44% 88/103
🟢 Functions 88.71% 55/62
🟢 Lines 91.81% 213/232

Test suite run success

327 tests passing in 15 suites.

Report generated by 🧪jest coverage report action from 33d874d

Please sign in to comment.