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: docs/user/config/diagnostics.md
+47-6Lines changed: 47 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,22 +9,23 @@ A diagnostic can be:
9
9
- syntax errors in some of your TypeScript files (source or tests)
10
10
- type/semantic errors, what TypeScript has actually been made for 😁
11
11
12
-
If a diagnostic is not filtered out, it'll fail the compilatin within TSJest, and so will your related test.
12
+
If a diagnostic is not filtered out, it'll fail the compilation within TSJest, and so will your related test.
13
13
14
14
### Disabling/enabling
15
15
16
-
By default all diagnostic are enabled. This is the same as setting the `diagnostics` option to `true`. To disable all diagnostics, set `diagnostics` to `false` (you might experience slightly better performence as well, especially if you disabled Jest cache).
16
+
By default all diagnostic are enabled. This is the same as setting the `diagnostics` option to `true`. To disable all diagnostics, set `diagnostics` to `false` (you might experience slightly better performance as well, especially if you disabled Jest cache).
17
17
18
18
### Advanced configuration
19
19
20
-
The option's value can also accpet an object for more advanced configuration. Each config. key is optional:
20
+
The option's value can also accept an object for more advanced configuration. Each config. key is optional:
21
21
22
-
-**`pretty`**: Enables/disable colorful and pretty output of errors (default: _enabled_).
22
+
-**`warnOnly`**: If specified and `true`, diagnostics will be reported but won't stop compilation (default: _disabled_).
23
23
-**`ignoreCodes`**: List of TypeScript error codes to ignore. Complete list can be found [there](https://github.com/Microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json). By default here are the ones ignored:
24
24
-`6059`: _'rootDir' is expected to contain all source files._
25
-
-`18002`: _The 'files' list in config file is empty._ (it is strongly recommanded to include this one)
25
+
-`18002`: _The 'files' list in config file is empty._ (it is strongly recommended to include this one)
26
26
-`18003`: _No inputs were found in config file._
27
27
-**`pathRegex`**: If specified, diagnostics of source files which path does **not** match will be ignored.
28
+
-**`pretty`**: Enables/disables colorful and pretty output of errors (default: _enabled_).
28
29
29
30
### Examples
30
31
@@ -77,7 +78,7 @@ module.exports = {
77
78
globals: {
78
79
'ts-jest': {
79
80
diagnostics: {
80
-
pathRegex:/\.(spec|test).ts$/
81
+
pathRegex:/\.(spec|test)\.ts$/
81
82
}
82
83
}
83
84
}
@@ -104,6 +105,46 @@ module.exports = {
104
105
105
106
</div></div>
106
107
108
+
##### Do not fail on first error
109
+
110
+
While some diagnostics are stop-blockers for the compilation, most of them are not. If you want the compilation (and so your tests) to continue when encountering those, set the `warnOnly` to `true`:
All TypeScript error codes can be found [there](https://github.com/Microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json). The `ignoreCodes` option accepts this values:
0 commit comments