You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+13-14
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,8 @@ You can run each group separately or all together thanks to [jest-runner-groups]
65
65
66
66
Unit tests, under `tests/unit` folder are standard [Jest](https://jestjs.io) tests.
67
67
68
-
End-to-end tests, under `tests/e2e` folder, will test the module features by deploying AWS Lambda functions into your AWS Account. We use CDK lib for Typescript for creating infrastructure, and `aws sdk` for invoking the functions and assert on the expected behaviors. All steps are also executed by Jest.
68
+
End-to-end tests, under `tests/e2e` folder, will test the module features by deploying AWS Lambda functions into your AWS Account. We use [aws-cdk](https://docs.aws.amazon.com/cdk/v1/guide/getting_started.html) v1 library (not v2 due to [this cdk issue](https://github.com/aws/aws-cdk/issues/18211)) for Typescript for creating infrastructure, and [aws-sdk-js v2](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/) for invoking the functions and assert on the expected behaviors. All steps are also executed by Jest.
69
+
69
70
70
71
Running end-to-end tests will deploy AWS resources. You will need an AWS account and the tests might incur costs. The cost from **some services** are covered by the [AWS Free Tier](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all) but not all of them. If you don't have an AWS Account follow [these instructions to create one](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/).
71
72
@@ -88,11 +89,10 @@ As mentioned before, tests are split into groups thanks to [jest-runner-groups](
88
89
89
90
**Run**
90
91
91
-
Run the following command in your terminal, in the folder of a utility package (for example: `packages/metrics`):
92
-
93
-
`npm run test`
94
-
95
-
You can run selective tests by restricting the group to the one you want. For instance `npx jest --group=unit/metrics/all`.
92
+
To run unit tests you can either use
93
+
* npm task `lerna-test:unit` (`npm run lerna-test:unit`) in root folder to run them all
94
+
* npm task `test:e2e` (`npm run test:unit`) in module folder to run the module specific one
95
+
* jest directly `npx jest --group=unit` in module folder to run the module specific one (You can run selective tests by restricting the group to the one you want. For instance `npx jest --group=unit/metrics/class`)
96
96
97
97
**e2e tests**
98
98
@@ -108,22 +108,21 @@ As mentioned in the previous section, tests are split into groups thanks to [jes
108
108
*/
109
109
```
110
110
111
-
and leverage [aws-cdk](https://docs.aws.amazon.com/cdk/v1/guide/getting_started.html) V1 package (not v2 due to [this cdk issue](https://github.com/aws/aws-cdk/issues/18211)) to programatically deploy and destroy stacks. See `metrics/tests/e2e/decorator.test.ts` as an example.
111
+
See `metrics/tests/e2e/decorator.test.ts` as an example.
112
112
113
113
114
114
**Run**
115
115
116
-
To run unit tests you can either use projen task
117
-
*`npm run test:e2e` which will only run jest integ tests
118
-
* or jest directly `npx jest --group=e2e`
119
-
120
-
You can run selective tests by restricting the group to the one you want. For instance `npx jest --group=e2e/other/example`.
116
+
To run e2e tests you can either use
117
+
* npm task `lerna-test:e2e` (`npm run lerna-test:e2e`) in root folder
118
+
* npm task `test:e2e` (`npm run test:e2e`) in module folder
119
+
* jest directly `npx jest --group=e2e` in module folder. (You can run selective tests by restricting the group to the one you want. For instance `npx jest --group=e2e/metrics/decorator`)
121
120
122
121
Two important env variable can be used:
123
-
*`AWS_PROFILE` to use the right credentials
122
+
*`AWS_PROFILE` to use the right AWS credentials
124
123
*`DISABLE_TEARDOWN` if you don't want your stack to be destroyed at the end of the test (useful in dev mode when iterating over your code).
125
124
126
-
Example: `DISABLE_TEARDOWN=true AWS_PROFILE=ara npx jest --group=integ/other/example`
125
+
Example: `DISABLE_TEARDOWN=true AWS_PROFILE=dev-account npx jest --group=e2e/metrics/decorator`
0 commit comments