Skip to content

Commit d8039ab

Browse files
committed
a whole lot more documentation
1 parent f716d06 commit d8039ab

36 files changed

+804
-422
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ APPLICATION_TOKEN=AstraCS:<rest_of_token>
88
ASTRA_RUN_VECTORIZE_TESTS=
99

1010
# Set this to some value to enable running long-running tests
11-
ASTRA_RUN_LONG_TESTS=
11+
ASTRA_RUN_LONG_TESTS`=
1212

1313
# Set this to some value to enable running admin tests
1414
ASTRA_RUN_ADMIN_TESTS=

.np-config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"testScript": "test:types",
3+
"anyBranch": true
4+
}

DEVGUIDE.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Contents
22
1. [Running the tests](#running-the-tests)
33
2. [Linting](#linting)
4-
3. [Building API Reference Documentation](#building-api-reference-documentation)
4+
3. [Building the library](#building-the-library)
55

66
## Running the tests
77
Prerequisites:
@@ -14,13 +14,10 @@ Prerequisites:
1414
npm run test
1515

1616
# Run only unit tests
17-
npm run test:unit
17+
npm run test -- -f 'unit.'
1818

1919
# 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.'
2421

2522
# Run tsc with the noEmit flag to check for type errors
2623
npm run test:types
@@ -31,10 +28,12 @@ Tests can be given certain tags to allow for more granular control over which te
3128
- `[long]`/`'LONG'`: Longer running tests that take more than a few seconds to run
3229
- `[admin]`/`'ADMIN'`: Tests that require admin permissions to run
3330
- `[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
3433

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`
3837
- `ASTRA_RUN_LONG_TESTS`
3938
- `ASTRA_RUN_ADMIN_TESTS`
4039

@@ -43,6 +42,13 @@ Or you can run the tests by doing something like
4342
env ASTRA_RUN_LONG_TESTS=1 npm run test
4443
```
4544

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+
4652
### Adding your own tagged tests
4753
To enforce the tags, use the `assertTestsEnabled` function from `test/fixtures.ts`, which will skip the function if the
4854
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
6571
format, and updating the `assertTestsEnabled` function. However, this should be done sparingly, as it can make the
6672
test suite harder to manage.
6773

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+
6884
## 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.
7286

7387
## Building the library
7488
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:
8094
- Runs `tsc` to compile the TypeScript files & resolves path aliases w/ `tsc-alias`
8195
- Uses `api-extractor` to generate the API report & generate a rolled-up `.d.ts` file
8296
- 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.
88-
89-
```shell
90-
# Generate API documentation
91-
npm run build:docs
92-
93-
# Optionally serve docs locally
94-
npx markserv APIReference.md
95-
```

0 commit comments

Comments
 (0)