6
6
7
7
# tsd-lite-cli
8
8
9
- Test runner for testing TypeScript typings ( CLI over
10
- [ tsd-lite] [ intro_tsd-lite ] , a " per file" version of [ tsd] [ intro_tsd ] ) .
9
+ Test runner for testing TypeScript typings. CLI over
10
+ [ ` tsd-lite ` ] [ intro_tsd-lite ] , a per- file version of [ ` tsd ` ] [ intro_tsd ] .
11
11
12
12
- :mag : [ Glob] [ intro_fast-glob ] pattern matching
13
13
- :white_check_mark : [ TAP] [ intro_tap ] compatible output
14
14
15
- ![ tsd-lite-cli default colored tap output] ( docs/output-default.png " tsd-lite-cli default colored tap output ")
15
+ ![ tsd-lite-cli default colored tap output] (docs/output-default.png
16
+ "tsd-lite-cli default colored tap output")
16
17
17
18
[ intro_tsd ] : https://github.com/SamVerschueren/tsd
18
19
[ intro_tsd-lite ] : https://github.com/mrazauskas/tsd-lite
@@ -24,35 +25,31 @@ Test runner for testing TypeScript typings (CLI over
24
25
<!-- vim-markdown-toc GFM -->
25
26
26
27
- [ Install] ( #install )
28
+ - [ ` tsd-lite ` ] ( #tsd-lite )
29
+ - [ ` @tsd/typescript ` ] ( #tsdtypescript )
27
30
- [ Usage] ( #usage )
28
- - [ Example typing test file] ( #example-typing-test-file )
29
- - [ CLI interface] ( #cli-interface )
30
- - [ ` --color ` and ` --no-color ` ] ( #--color-and---no-color )
31
+ - [ CLI interface] ( #cli-interface )
31
32
- [ Similar projects] ( #similar-projects )
32
33
- [ Changelog] ( #changelog )
33
34
34
35
<!-- vim-markdown-toc -->
35
36
36
37
## Install
37
38
38
- ``` shell-session
39
- npm install --save-dev @tsd/typescript tsd-lite-cli
39
+ ``` console
40
+ npm install --save-dev @tsd/typescript tsd-lite tsd-lite -cli
40
41
```
41
42
42
- ## Usage
43
-
44
- Run ` tsd-lite ` with a glob pattern for matching test files (uses
45
- [ fast-glob] [ usage_fast-glob ] internally):
46
-
47
- ``` shell-session
48
- npx tsd-lite 'src/**/*.test-d.ts'
49
- ```
43
+ Besides ` tsd-lite-cli ` , you also need ` tsd-lite ` and ` @tsd/typescript ` which
44
+ are listed as peer dependencies.
50
45
51
- [ usage_fast-glob ] : https://github.com/mrmlnc/fast-glob
46
+ ### ` tsd-lite `
52
47
53
- ### Example typing test file
48
+ Contains the actual assertion functions. For more information, see
49
+ [ tsd-lite] [ install_tsd-lite ] .
54
50
55
51
``` typescript
52
+ // src/concat.test-d.ts
56
53
import { expectType , expectError } from " tsd-lite"
57
54
import concat from " ./concat.js"
58
55
@@ -61,13 +58,32 @@ expectType<string>(await concat("foo", "bar"))
61
58
expectError (await concat (true , false ))
62
59
```
63
60
64
- For more information, see [ tsd-lite] [ example_tsd-lite ] for assertion syntax.
61
+ [ install_tsd-lite ] : https://github.com/mrazauskas/tsd-lite
62
+
63
+ ### ` @tsd/typescript `
64
+
65
+ Compiles the TypeScript test files. It's version should be synced with the
66
+ ` typescript ` version in your project. For more information, see
67
+ [ ` @tsd/typescript ` ] [ install_tsd-typescript ] .
68
+
69
+ [ install_tsd-typescript ] : https://github.com/SamVerschueren/tsd-typescript
70
+
71
+ ## Usage
72
+
73
+ Run ` tsd-lite ` with a glob pattern for matching test files - uses
74
+ [ ` fast-glob ` ] [ usage_fast-glob ] internally:
75
+
76
+ ``` console
77
+ npx tsd-lite 'src/**/*.test-d.ts'
78
+ ```
79
+
80
+ [ usage_fast-glob ] : https://github.com/mrmlnc/fast-glob
65
81
66
- [ example_tsd-lite ] : https://github.com/mrazauskas/tsd-lite
82
+ ### CLI interface
67
83
68
- ## CLI interface
84
+ ``` console
85
+ $ npx tsd-lite --help
69
86
70
- ``` shell-session
71
87
Usage: tsd-lite [options] <patterns...>
72
88
73
89
Test runner for testing TypeScript typings (CLI over tsd-lite, a "per file"
@@ -84,23 +100,33 @@ Options:
84
100
-h, --help Print this help guide
85
101
```
86
102
87
- ### ` --color ` and ` --no-color `
103
+ #### ` --color ` and ` --no-color `
88
104
89
105
By default, ` tsd-lite-cli ` outputs a colored version of [ Test Anything
90
- Protocol] [ cli_tap ] for better readability. This can be disabled by setting
91
- ` --no-color ` when piping to other tools like ` tap-spec ` :
106
+ Protocol] [ cli_tap ] for better readability. Can be disabled by setting
107
+ ` --no-color ` when piping to other tools, e.g. [ ` tap-spec ` ] [ cli_tap-spec ] .
108
+
109
+ ``` console
110
+ npx tsd-lite 'src/**/*.test-d.ts' --no-color
111
+ ```
112
+
113
+ ![ tsd-lite-cli --no-color output] (docs/output-no-color.png "tsd-lite-cli
114
+ --no-color output")
92
115
93
- ``` shell-session
116
+ ``` console
94
117
npx tsd-lite 'src/**/*.test-d.ts' --no-color | npx tap-spec
95
118
```
96
119
97
- ![ tsd-lite-cli --no-color output piped to tap-spec] ( docs/output-no-color_tap-spec.png " tsd-lite-cli --no-color output piped to tap-spec ")
120
+ ![ tsd-lite-cli --no-color output piped to
121
+ tap-spec] (docs/output-no-color_tap-spec.png "tsd-lite-cli --no-color output
122
+ piped to tap-spec")
98
123
99
124
[ cli_tap ] : https://testanything.org
125
+ [ cli_tap-spec ] : https://github.com/scottcorgan/tap-spec
100
126
101
127
## Similar projects
102
128
103
- - [ jest-runner-tsd] [ similar_jest-runner-tsd ] - Jest runner to test TypeScript
129
+ - [ ` jest-runner-tsd ` ] [ similar_jest-runner-tsd ] - Jest runner to test TypeScript
104
130
typings
105
131
106
132
[ similar_jest-runner-tsd ] : https://github.com/jest-community/jest-runner-tsd
0 commit comments