Skip to content

Commit b435904

Browse files
committed
check.sh.md
1 parent e2e0816 commit b435904

File tree

4 files changed

+100
-2
lines changed

4 files changed

+100
-2
lines changed

scripts/check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ while [ $# -gt 0 ]; do
2929
fi
3030
echo "Usage:"
3131
echo
32-
echo "$0 [tc] [lint] [licensing] [lib-check]"
32+
echo "$0 [tc] [lint] [licensing] [lib-check] [test-exts] [test-names]"
3333
echo
3434
echo "* tc: runs the type-checker"
3535
echo "* lint: checks for linting errors"

scripts/docs/check.sh.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# `check.sh` (The custom checker script)
2+
3+
A script that checks various aspects of the project to ensure that it is in a good state, including:
4+
- Type-checking,
5+
- Linting
6+
- Compilation
7+
- Enforcement of various project conventions.
8+
9+
This script should be run, at the very least, before merging any changes into the main branch or releasing, but ideally,
10+
much more often than just that.
11+
12+
## Contents
13+
14+
- [Check script usage](#check-script-usage)
15+
- [Available checks](#available-checks)
16+
- [See also](#see-also)
17+
18+
## Check script usage
19+
20+
The API for the check script is as follows, where all checks are run by default if no arguments are provided:
21+
22+
```fortran
23+
scripts/check.sh [tc] [lint] [licensing] [lib-check] [test-exts] [test-names]
24+
```
25+
26+
One or more of the above checks may be specified otherwise, to run only the specified checks in the order they are provided.
27+
28+
The check script will return a non-zero exit code if any of the checks fail, and will print out the results of each check as it runs.
29+
30+
## Available checks
31+
32+
### Run type-checker (`tc`)
33+
34+
If set, `tsc` will be run with `--noEmit` to ensure that the `src` and `test` folders type-check correctly.
35+
36+
### Run linter (`lint`)
37+
38+
If set, `eslint` will be run over the `src` and `test` folders to ensure that the code follows proper conventions.
39+
40+
### Check licensing headers (`licensing`)
41+
42+
If set, the script will check that all files in the `src` and `test` folders have the correct apache 2.0 licensing headers.
43+
44+
```
45+
// Copyright DataStax, Inc.
46+
//
47+
// Licensed under the Apache License, Version 2.0 (the "License");
48+
// you may not use this file except in compliance with the License.
49+
// You may obtain a copy of the License at
50+
//
51+
// http://www.apache.org/licenses/LICENSE-2.0
52+
//
53+
// Unless required by applicable law or agreed to in writing, software
54+
// distributed under the License is distributed on an "AS IS" BASIS,
55+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56+
// See the License for the specific language governing permissions and
57+
// limitations under the License.
58+
```
59+
60+
### Check library compilation (`lib-check`)
61+
62+
If set, the script will build the library, and set it as the dependency of a newly created TS project with `skipLibCheck: false`
63+
to ensure that the library compiles correctly, and may be used in other projects without issue.
64+
65+
### Check test extension conventions (`test-exts`)
66+
67+
If set, the script will check that all test files in the `test` folder have the `.test.ts` extension.
68+
69+
### Check test naming conventions (`test-names`)
70+
71+
If set, the script will check that all file-level test suites in the `test` folder have the correct naming convention.
72+
73+
It is expected that each file-level test suite will have a name that matches the file path relative to the `tests/` directory,
74+
with slashes replaced by dots, and the `.test.ts` extension removed.
75+
76+
For example, the file `tests/unit/documents/cursor.test.ts` should have a file-level test suite named `unit.documents.cursor`.
77+
78+
```ts
79+
describe('unit.documents.cursor', () => {
80+
// Tests here
81+
});
82+
```
83+
84+
This works even if the root-level suite is a `parallel` or `background` block.
85+
86+
## See also
87+
88+
- [The custom test script](./test.sh.md)

scripts/docs/startgate.md renamed to scripts/docs/startgate.sh.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ scripts/startgate.sh
1111
# Main terminal window after waiting for stargate to start-gate (heh)
1212
scripts/test.sh -local
1313
```
14+
15+
## See also
16+
17+
- [The custom test script](./test.sh.md)

scripts/docs/test.sh.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ You can read more about the custom wrapper and why it exists [here](https://gith
3535
7. [Running tests on local stargate](#running-tests-on-local-stargate)
3636
8. [Running tests without a specific test tag](#running-tests-without-a-specific-test-tag)
3737
9. [Running tests with logging](#running-tests-with-logging)
38+
5. [See also](#see-also)
3839

3940
## Prerequisites
4041

@@ -182,7 +183,7 @@ If you're running the tests on a local Stargate instance, you can use this flag
182183

183184
It'll also automatically set the environment to `dse`.
184185

185-
Note that you'll still need to run stargate yourself. See [startgate.sh.md](./startgate) for more info.
186+
Note that you'll still need to run stargate yourself. See [startgate.sh.md](./startgate.sh.md) for more info.
186187

187188
### 10. Enable verbose logging for tests (`[(-l | -logging) | (-L | -logging-with-pred <predicate>)]`)
188189

@@ -325,3 +326,8 @@ scripts/test.sh -l
325326
# Though sometimes I want something more specific
326327
scripts/test.sh -L '!isGlobal && e.commandName === "find"'
327328
```
329+
330+
## See also
331+
332+
- [The custom checker script](./check.sh.md)
333+
- [Local Data API spawning script](./startgate.sh.md)

0 commit comments

Comments
 (0)