tstyche 1.0.0-beta.9 → 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.0-rc.1] - 2024-02-10
4
+
5
+ ### Changed
6
+
7
+ - **Breaking!** Remove the `disableTestFileLookup` option in favor of `testFileMatch: []` ([#121](https://github.com/tstyche/tstyche/pull/121))
8
+
9
+ ### Added
10
+
11
+ - **New!** Set `module: "preserve"` in the default compiler options for inferred project that are using TypeScript 5.4 and up ([#111](https://github.com/tstyche/tstyche/pull/111))
12
+
13
+ ### Fixed
14
+
15
+ - Do not select test files, if `testFileMatch` is an empty list ([#120](https://github.com/tstyche/tstyche/pull/120))
16
+
17
+ ## [1.0.0-rc] - 2024-01-28
18
+
19
+ ### Changed
20
+
21
+ - **Breaking!** Replace the `allowNoTestFiles` option with `disableTestFileLookup` ([#104](https://github.com/tstyche/tstyche/pull/104))
22
+
23
+ ### Added
24
+
25
+ - **New!** Set default compiler options for inferred (e.g. JavaScript) projects ([#93](https://github.com/tstyche/tstyche/pull/93))
26
+ - Add the `TSTYCHE_NO_INTERACTIVE` environment variable ([#88](https://github.com/tstyche/tstyche/pull/88))
27
+ - Add the `TSTYCHE_TYPESCRIPT_PATH` environment variable ([#84](https://github.com/tstyche/tstyche/pull/84))
28
+
29
+ ### Fixed
30
+
31
+ - Only select TypeScript and JavaScript files for test run ([#105](https://github.com/tstyche/tstyche/pull/105))
32
+
3
33
  ## [1.0.0-beta.9] - 2024-01-05
4
34
 
5
35
  ### Fixed
@@ -100,6 +130,8 @@
100
130
 
101
131
  _First pre-release._
102
132
 
133
+ [1.0.0-rc.1]: https://github.com/tstyche/tstyche/releases/tag/v1.0.0-rc.1
134
+ [1.0.0-rc]: https://github.com/tstyche/tstyche/releases/tag/v1.0.0-rc
103
135
  [1.0.0-beta.9]: https://github.com/tstyche/tstyche/releases/tag/v1.0.0-beta.9
104
136
  [1.0.0-beta.8]: https://github.com/tstyche/tstyche/releases/tag/v1.0.0-beta.8
105
137
  [1.0.0-beta.7]: https://github.com/tstyche/tstyche/releases/tag/v1.0.0-beta.7
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # TSTyche
2
2
 
3
- [![version][version-src]][version-href]
4
- [![license][license-src]][license-href]
5
- [![packagephobia][packagephobia-src]][packagephobia-href]
6
- [![coverage][coverage-src]][coverage-href]
3
+ [![version][version-badge]][version-url]
4
+ [![license][license-badge]][license-url]
5
+ [![packagephobia][packagephobia-badge]][packagephobia-url]
6
+ [![coverage][coverage-badge]][coverage-url]
7
7
 
8
8
  The Essential Type Testing Tool.
9
9
 
@@ -77,13 +77,13 @@ Visit [https://tstyche.org](https://tstyche.org) to view the full documentation.
77
77
 
78
78
  ## License
79
79
 
80
- [MIT][license-href] © TSTyche
80
+ [MIT][license-url] © TSTyche
81
81
 
82
- [version-src]: https://badgen.net/npm/v/tstyche
83
- [version-href]: https://npmjs.com/package/tstyche
84
- [license-src]: https://badgen.net/github/license/tstyche/tstyche
85
- [license-href]: https://github.com/tstyche/tstyche/blob/main/LICENSE.md
86
- [packagephobia-src]: https://badgen.net/packagephobia/install/tstyche
87
- [packagephobia-href]: https://packagephobia.com/result?p=tstyche
88
- [coverage-src]: https://badgen.net/codecov/c/github/tstyche/tstyche
89
- [coverage-href]: https://app.codecov.io/gh/tstyche/tstyche
82
+ [version-badge]: https://badgen.net/npm/v/tstyche
83
+ [version-url]: https://npmjs.com/package/tstyche
84
+ [license-badge]: https://badgen.net/github/license/tstyche/tstyche
85
+ [license-url]: https://github.com/tstyche/tstyche/blob/main/LICENSE.md
86
+ [packagephobia-badge]: https://badgen.net/packagephobia/install/tstyche
87
+ [packagephobia-url]: https://packagephobia.com/result?p=tstyche
88
+ [coverage-badge]: https://badgen.net/codacy/coverage/a581ca5c323a455886b7bdd9623c4ec8
89
+ [coverage-url]: https://app.codacy.com/gh/tstyche/tstyche/coverage/dashboard
package/build/bin.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import process from 'node:process';
2
3
  import { Cli } from './tstyche.js';
3
4
 
4
- const cli = new Cli(process);
5
+ const cli = new Cli();
5
6
  await cli.run(process.argv.slice(2));
package/build/index.d.cts CHANGED
@@ -170,7 +170,7 @@ interface Expect {
170
170
  /**
171
171
  * Builds an assertion.
172
172
  *
173
- * @typeParam Source - The type against which the assertion will be made.
173
+ * @template Source - The type against which the assertion will be made.
174
174
  */
175
175
  <Source>(): Modifier;
176
176
  /**
@@ -183,7 +183,7 @@ interface Expect {
183
183
  /**
184
184
  * Mark an assertion as supposed to fail.
185
185
  *
186
- * @typeParam Source - The type against which the assertion will be made.
186
+ * @template Source - The type against which the assertion will be made.
187
187
  */
188
188
  <Source>(): Modifier;
189
189
  /**
@@ -200,7 +200,7 @@ interface Expect {
200
200
  /**
201
201
  * Marks an assertion as focused.
202
202
  *
203
- * @typeParam Source - The type against which the assertion will be made.
203
+ * @template Source - The type against which the assertion will be made.
204
204
  */
205
205
  <Source>(): Modifier;
206
206
  /**
@@ -213,7 +213,7 @@ interface Expect {
213
213
  /**
214
214
  * Mark an assertion as supposed to fail.
215
215
  *
216
- * @typeParam Source - The type against which the assertion will be made.
216
+ * @template Source - The type against which the assertion will be made.
217
217
  */
218
218
  <Source>(): Modifier;
219
219
  /**
@@ -231,7 +231,7 @@ interface Expect {
231
231
  /**
232
232
  * Marks an assertion as skipped.
233
233
  *
234
- * @typeParam Source - The type against which the assertion will be made.
234
+ * @template Source - The type against which the assertion will be made.
235
235
  */
236
236
  <Source>(): Modifier;
237
237
  /**
@@ -244,7 +244,7 @@ interface Expect {
244
244
  /**
245
245
  * Marks an assertion as supposed to fail.
246
246
  *
247
- * @typeParam Source - The type against which the assertion will be made.
247
+ * @template Source - The type against which the assertion will be made.
248
248
  */
249
249
  <Source>(): Modifier;
250
250
  /**
package/build/index.d.ts CHANGED
@@ -170,7 +170,7 @@ interface Expect {
170
170
  /**
171
171
  * Builds an assertion.
172
172
  *
173
- * @typeParam Source - The type against which the assertion will be made.
173
+ * @template Source - The type against which the assertion will be made.
174
174
  */
175
175
  <Source>(): Modifier;
176
176
  /**
@@ -183,7 +183,7 @@ interface Expect {
183
183
  /**
184
184
  * Mark an assertion as supposed to fail.
185
185
  *
186
- * @typeParam Source - The type against which the assertion will be made.
186
+ * @template Source - The type against which the assertion will be made.
187
187
  */
188
188
  <Source>(): Modifier;
189
189
  /**
@@ -200,7 +200,7 @@ interface Expect {
200
200
  /**
201
201
  * Marks an assertion as focused.
202
202
  *
203
- * @typeParam Source - The type against which the assertion will be made.
203
+ * @template Source - The type against which the assertion will be made.
204
204
  */
205
205
  <Source>(): Modifier;
206
206
  /**
@@ -213,7 +213,7 @@ interface Expect {
213
213
  /**
214
214
  * Mark an assertion as supposed to fail.
215
215
  *
216
- * @typeParam Source - The type against which the assertion will be made.
216
+ * @template Source - The type against which the assertion will be made.
217
217
  */
218
218
  <Source>(): Modifier;
219
219
  /**
@@ -231,7 +231,7 @@ interface Expect {
231
231
  /**
232
232
  * Marks an assertion as skipped.
233
233
  *
234
- * @typeParam Source - The type against which the assertion will be made.
234
+ * @template Source - The type against which the assertion will be made.
235
235
  */
236
236
  <Source>(): Modifier;
237
237
  /**
@@ -244,7 +244,7 @@ interface Expect {
244
244
  /**
245
245
  * Marks an assertion as supposed to fail.
246
246
  *
247
- * @typeParam Source - The type against which the assertion will be made.
247
+ * @template Source - The type against which the assertion will be made.
248
248
  */
249
249
  <Source>(): Modifier;
250
250
  /**
@@ -1,5 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
-
3
1
  import type ts from 'typescript';
4
2
 
5
3
  declare enum DiagnosticCategory {
@@ -51,8 +49,7 @@ declare enum OptionBrand {
51
49
  Number = "number",
52
50
  Boolean = "boolean",
53
51
  True = "true",// an option which does not take a value
54
- List = "list",
55
- Object = "object"
52
+ List = "list"
56
53
  }
57
54
 
58
55
  declare enum OptionGroup {
@@ -61,21 +58,16 @@ declare enum OptionGroup {
61
58
  }
62
59
 
63
60
  interface ItemDefinition {
64
- brand: OptionBrand.String | OptionBrand.Object;
65
- getDefinition?: (optionGroup: OptionGroup) => Map<string, OptionDefinition>;
61
+ brand: OptionBrand.String;
66
62
  name: string;
67
- nullable?: boolean;
68
63
  pattern?: string;
69
- properties?: Array<OptionDefinition>;
70
64
  }
71
- type OptionDefinition = PrimitiveTypeOptionDefinition | ListTypeOptionDefinition | ObjectTypeOptionDefinition;
65
+ type OptionDefinition = PrimitiveTypeOptionDefinition | ListTypeOptionDefinition;
72
66
  interface BaseOptionDefinition {
73
67
  brand: OptionBrand;
74
68
  description: string;
75
69
  group: OptionGroup;
76
70
  name: string;
77
- nullable?: boolean;
78
- required?: boolean;
79
71
  }
80
72
  interface PrimitiveTypeOptionDefinition extends BaseOptionDefinition {
81
73
  brand: OptionBrand.String | OptionBrand.Number | OptionBrand.Boolean | OptionBrand.True;
@@ -84,11 +76,6 @@ interface ListTypeOptionDefinition extends BaseOptionDefinition {
84
76
  brand: OptionBrand.List;
85
77
  items: ItemDefinition;
86
78
  }
87
- interface ObjectTypeOptionDefinition extends BaseOptionDefinition {
88
- brand: OptionBrand.Object;
89
- getDefinition: (optionGroup: OptionGroup) => Map<string, OptionDefinition>;
90
- properties: Array<OptionDefinition>;
91
- }
92
79
  declare class OptionDefinitionsMap {
93
80
  #private;
94
81
  static for(optionGroup: OptionGroup): Map<string, OptionDefinition>;
@@ -98,10 +85,6 @@ declare class OptionDefinitionsMap {
98
85
  * Options passed through the command line.
99
86
  */
100
87
  interface CommandLineOptions {
101
- /**
102
- * Do not raise an error, if no test files are selected.
103
- */
104
- allowNoTestFiles?: boolean;
105
88
  /**
106
89
  * The path to a TSTyche configuration file.
107
90
  */
@@ -156,10 +139,6 @@ interface CommandLineOptions {
156
139
  * Options loaded from the configuration file.
157
140
  */
158
141
  interface ConfigFileOptions {
159
- /**
160
- * Do not raise an error, if no test files are selected.
161
- */
162
- allowNoTestFiles?: boolean;
163
142
  /**
164
143
  * Stop running tests after the first failed assertion.
165
144
  */
@@ -192,8 +171,7 @@ declare class ConfigService {
192
171
  get configFileOptions(): ConfigFileOptions;
193
172
  static get defaultOptions(): Required<ConfigFileOptions>;
194
173
  parseCommandLine(commandLineArgs: Array<string>): Promise<void>;
195
- readConfigFile(filePath?: string, // TODO take URL as well
196
- sourceText?: string): Promise<void>;
174
+ readConfigFile(): Promise<void>;
197
175
  resolveConfig(): ResolvedConfig;
198
176
  selectTestFiles(): Array<string>;
199
177
  }
@@ -208,7 +186,7 @@ declare class TSTyche {
208
186
 
209
187
  declare class Cli {
210
188
  #private;
211
- constructor(process: NodeJS.Process);
189
+ constructor();
212
190
  run(commandLineArguments: Array<string>): Promise<void>;
213
191
  }
214
192
 
@@ -276,14 +254,14 @@ declare class CollectService {
276
254
 
277
255
  declare class Environment {
278
256
  #private;
279
- /**
280
- * Is `true` if the TypeScript package is installed.
281
- */
282
- static get isTypeScriptInstalled(): boolean;
283
257
  /**
284
258
  * Specifies whether color should be disabled in the output.
285
259
  */
286
260
  static get noColor(): boolean;
261
+ /**
262
+ * Specifies whether interactive elements should be disabled in the output.
263
+ */
264
+ static get noInteractive(): boolean;
287
265
  /**
288
266
  * The directory where to store the 'typescript' packages.
289
267
  */
@@ -292,6 +270,10 @@ declare class Environment {
292
270
  * The number of seconds to wait before giving up stale operations.
293
271
  */
294
272
  static get timeout(): number;
273
+ /**
274
+ * The path to the currently installed TypeScript module.
275
+ */
276
+ static get typescriptPath(): string | undefined;
295
277
  }
296
278
 
297
279
  declare class ResultTiming {
@@ -538,6 +520,15 @@ declare class Expect {
538
520
  match(assertion: Assertion, expectResult: ExpectResult): MatchResult | undefined;
539
521
  }
540
522
 
523
+ /**
524
+ * A stream to output messages.
525
+ */
526
+ interface WriteStream {
527
+ /**
528
+ * @param log - Message to write to the stream.
529
+ */
530
+ write: (log: string) => void;
531
+ }
541
532
  /**
542
533
  * Options to configure an instance of the {@link Logger}.
543
534
  */
@@ -547,13 +538,13 @@ interface LoggerOptions {
547
538
  */
548
539
  noColor?: boolean;
549
540
  /**
550
- * A stream to write warnings and errors. Default: `process.stdout`.
541
+ * A stream to write warnings and errors. Default: `process.stderr`.
551
542
  */
552
- stderr?: NodeJS.WritableStream;
543
+ stderr?: WriteStream;
553
544
  /**
554
- * A stream to write informational messages. Default: `process.stderr`.
545
+ * A stream to write informational messages. Default: `process.stdout`.
555
546
  */
556
- stdout?: NodeJS.WritableStream;
547
+ stdout?: WriteStream;
557
548
  }
558
549
  /**
559
550
  * Wraps the provided streams with a set of convenience methods.
@@ -565,14 +556,9 @@ declare class Logger {
565
556
  */
566
557
  constructor(options?: LoggerOptions);
567
558
  /**
568
- * Moves the cursor one line up and erases the line when the `stdout` stream
569
- * is interactive. Otherwise does nothing.
559
+ * Moves the cursor one line up in the `stdout` stream and erases that line.
570
560
  */
571
561
  eraseLastLine(): void;
572
- /**
573
- * Returns `true` if the `stdout` stream is interactive.
574
- */
575
- isInteractive(): boolean;
576
562
  writeError(body: JSX.Element | Array<JSX.Element>): void;
577
563
  writeMessage(body: JSX.Element | Array<JSX.Element>): void;
578
564
  writeWarning(body: JSX.Element | Array<JSX.Element>): void;
@@ -610,7 +596,6 @@ declare function usesCompilerStepText(compilerVersion: string, tsconfigFilePath:
610
596
  }): JSX.Element;
611
597
 
612
598
  declare class Path {
613
- static basename(filePath: string): string;
614
599
  static dirname(filePath: string): string;
615
600
  static join(...filePaths: Array<string>): string;
616
601
  static normalizeSlashes(filePath: string): string;
@@ -697,7 +682,7 @@ declare global {
697
682
  children?: never;
698
683
  escapes: Color | Array<Color>;
699
684
  };
700
- newline: {
685
+ newLine: {
701
686
  children?: never;
702
687
  };
703
688
  text: {
@@ -711,10 +696,14 @@ declare global {
711
696
  * Options to configure an instance of the {@link Scribbler}.
712
697
  */
713
698
  interface ScribblerOptions {
699
+ /**
700
+ * The end of line sequence to be used in the output. Default: `"\n"`.
701
+ */
702
+ newLine?: string;
714
703
  /**
715
704
  * Do not include ANSI color escape codes in the output. Default: `false`.
716
705
  */
717
- noColors?: boolean;
706
+ noColor?: boolean;
718
707
  }
719
708
  /**
720
709
  * Provides the JSX factory function and renderer.
@@ -746,4 +735,11 @@ declare class Text implements JSX.ElementClass {
746
735
  render(): JSX.Element;
747
736
  }
748
737
 
749
- export { Assertion, Cli, CollectService, Color, type CommandLineOptions, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, type DiagnosticOrigin, Environment, type Event, EventEmitter, type EventHandler, Expect, ExpectResult, FileResult, type FileResultStatus, type ItemDefinition, Line, Logger, type LoggerOptions, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionGroup, Path, ProjectResult, ProjectService, Reporter, type ResolvedConfig, Result, ResultCount, ResultManager, ResultStatus, ResultTiming, Scribbler, type ScribblerOptions, StoreService, SummaryReporter, TSTyche, TargetResult, TaskRunner, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, ThoroughReporter, type TypeChecker, addsPackageStepText, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText };
738
+ declare class Version {
739
+ #private;
740
+ static isGreaterThan(source: string, target: string): boolean;
741
+ static isSatisfiedWith(source: string, target: string): boolean;
742
+ static isVersionTag(target: string): boolean;
743
+ }
744
+
745
+ export { Assertion, Cli, CollectService, Color, type CommandLineOptions, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, type DiagnosticOrigin, Environment, type Event, EventEmitter, type EventHandler, Expect, ExpectResult, FileResult, type FileResultStatus, type ItemDefinition, Line, Logger, type LoggerOptions, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionGroup, Path, ProjectResult, ProjectService, Reporter, type ResolvedConfig, Result, ResultCount, ResultManager, ResultStatus, ResultTiming, Scribbler, type ScribblerOptions, StoreService, SummaryReporter, TSTyche, TargetResult, TaskRunner, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, ThoroughReporter, type TypeChecker, Version, type WriteStream, addsPackageStepText, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText };