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: DEVGUIDE.md
+26-25Lines changed: 26 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# Contents
2
2
1.[Running the tests](#running-the-tests)
3
3
2.[Linting](#linting)
4
-
3.[Building API Reference Documentation](#building-api-reference-documentation)
4
+
3.[Building the library](#building-the-library)
5
5
6
6
## Running the tests
7
7
Prerequisites:
@@ -14,13 +14,10 @@ Prerequisites:
14
14
npm run test
15
15
16
16
# Run only unit tests
17
-
npm run test:unit
17
+
npm run test -- -f 'unit.'
18
18
19
19
# Run only integration tests
20
-
npm run test:integration
21
-
22
-
# Run both unit and integration tests with coverage check
23
-
npm run test:coverage
20
+
npm run test -- -f 'integration.'
24
21
25
22
# Run tsc with the noEmit flag to check for type errors
26
23
npm run test:types
@@ -31,10 +28,12 @@ Tests can be given certain tags to allow for more granular control over which te
31
28
-`[long]`/`'LONG'`: Longer running tests that take more than a few seconds to run
32
29
-`[admin]`/`'ADMIN'`: Tests that require admin permissions to run
33
30
-`[dev]`/`'DEV'`: Tests that require the dev environment to run
31
+
-`[prod]`/`'PROD'`: Tests that require the dev environment to run
32
+
-`[vectorize]`/`'VECTORIZE'`: Tests that require a specific vectorize-enabled kube to run
34
33
35
-
To enable these tags, you can set the corresponding environment variables to some values. The env variables are in the
36
-
`env.example` file, but they're repeated here for convenience:
37
-
-`ASTRA_RUN_DEV_TESTS`
34
+
To enable these some of these tags, you can set the corresponding environment variables to some values. The env
35
+
variables are in the `env.example` file, but they're repeated here for convenience:
36
+
-`ASTRA_RUN_VECTORIZE_TESTS`
38
37
-`ASTRA_RUN_LONG_TESTS`
39
38
-`ASTRA_RUN_ADMIN_TESTS`
40
39
@@ -43,6 +42,13 @@ Or you can run the tests by doing something like
43
42
env ASTRA_RUN_LONG_TESTS=1 npm run test
44
43
```
45
44
45
+
The `PROD` and `DEV` tags are enabled/disabled automatically, inferred from the astra endpoint URL.
46
+
47
+
Use the following to run tests with ADMIN and LONG tags automatically enabled (note that doesn't include vectorize tests):
48
+
```shell
49
+
npm run test:all
50
+
```
51
+
46
52
### Adding your own tagged tests
47
53
To enforce the tags, use the `assertTestsEnabled` function from `test/fixtures.ts`, which will skip the function if the
48
54
given tag is not enabled.
@@ -65,10 +71,18 @@ If a new tag really, really, needs to be added, it can be done by adding a new e
65
71
format, and updating the `assertTestsEnabled` function. However, this should be done sparingly, as it can make the
66
72
test suite harder to manage.
67
73
74
+
### Coverage testing
75
+
76
+
To run coverage testing, run the following command:
77
+
```shell
78
+
npm run test:coverage
79
+
```
80
+
81
+
This uses `test:all` under the hood, as well as a "bail early" flag as there's not really a point continuing to run
82
+
tests if one of them fails, as the coverage report will be impacted.
83
+
68
84
## Linting
69
-
Run `npm run lint` to run ESLint.
70
-
ESLint will point out any formatting and code quality issues it finds.
71
-
You should try to run `npm run lint` before committing to minimize risk of regressions.
85
+
Run `npm run lint` to run ESLint. ESLint will point out any formatting and code quality issues it finds.
72
86
73
87
## Building the library
74
88
At the moment, you need to be using a unix-like system to build the library, as it uses a small shell script,
@@ -80,16 +94,3 @@ To build it, just run `npm run build`, which does the following:
80
94
- Runs `tsc` to compile the TypeScript files & resolves path aliases w/ `tsc-alias`
81
95
- Uses `api-extractor` to generate the API report & generate a rolled-up `.d.ts` file
82
96
- Deletes any extraneous `.d.ts` files
83
-
84
-
## Building API Reference Documentation
85
-
API Documentation of this library is generated using [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown)
86
-
87
-
Run the following to generate API documentation. This takes the `APIReference.hbs` and the library code as input and generates and `APIReference.md` file.
0 commit comments