tstyche 1.0.0-beta.9 → 1.0.0-rc

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,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.0-rc] - 2024-01-28
4
+
5
+ ### Changed
6
+
7
+ - **Breaking!** Replace the `allowNoTestFiles` option with `disableTestFileLookup` ([#104](https://github.com/tstyche/tstyche/pull/104))
8
+
9
+ ### Added
10
+
11
+ - **New!** Set default compiler options for inferred (e.g. JavaScript) projects ([#93](https://github.com/tstyche/tstyche/pull/93))
12
+ - Add the `TSTYCHE_NO_INTERACTIVE` environment variable ([#88](https://github.com/tstyche/tstyche/pull/88))
13
+ - Add the `TSTYCHE_TYPESCRIPT_PATH` environment variable ([#84](https://github.com/tstyche/tstyche/pull/84))
14
+
15
+ ### Fixed
16
+
17
+ - Only select TypeScript and JavaScript files for test run ([#105](https://github.com/tstyche/tstyche/pull/105))
18
+
3
19
  ## [1.0.0-beta.9] - 2024-01-05
4
20
 
5
21
  ### Fixed
@@ -100,6 +116,7 @@
100
116
 
101
117
  _First pre-release._
102
118
 
119
+ [1.0.0-rc]: https://github.com/tstyche/tstyche/releases/tag/v1.0.0-rc
103
120
  [1.0.0-beta.9]: https://github.com/tstyche/tstyche/releases/tag/v1.0.0-beta.9
104
121
  [1.0.0-beta.8]: https://github.com/tstyche/tstyche/releases/tag/v1.0.0-beta.8
105
122
  [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/codecov/c/github/tstyche/tstyche
89
+ [coverage-url]: https://app.codecov.io/gh/tstyche/tstyche
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
  */
@@ -157,9 +140,9 @@ interface CommandLineOptions {
157
140
  */
158
141
  interface ConfigFileOptions {
159
142
  /**
160
- * Do not raise an error, if no test files are selected.
143
+ * Do not search for the test files.
161
144
  */
162
- allowNoTestFiles?: boolean;
145
+ disableTestFileLookup?: boolean;
163
146
  /**
164
147
  * Stop running tests after the first failed assertion.
165
148
  */
@@ -192,8 +175,7 @@ declare class ConfigService {
192
175
  get configFileOptions(): ConfigFileOptions;
193
176
  static get defaultOptions(): Required<ConfigFileOptions>;
194
177
  parseCommandLine(commandLineArgs: Array<string>): Promise<void>;
195
- readConfigFile(filePath?: string, // TODO take URL as well
196
- sourceText?: string): Promise<void>;
178
+ readConfigFile(): Promise<void>;
197
179
  resolveConfig(): ResolvedConfig;
198
180
  selectTestFiles(): Array<string>;
199
181
  }
@@ -208,7 +190,7 @@ declare class TSTyche {
208
190
 
209
191
  declare class Cli {
210
192
  #private;
211
- constructor(process: NodeJS.Process);
193
+ constructor();
212
194
  run(commandLineArguments: Array<string>): Promise<void>;
213
195
  }
214
196
 
@@ -276,14 +258,14 @@ declare class CollectService {
276
258
 
277
259
  declare class Environment {
278
260
  #private;
279
- /**
280
- * Is `true` if the TypeScript package is installed.
281
- */
282
- static get isTypeScriptInstalled(): boolean;
283
261
  /**
284
262
  * Specifies whether color should be disabled in the output.
285
263
  */
286
264
  static get noColor(): boolean;
265
+ /**
266
+ * Specifies whether interactive elements should be disabled in the output.
267
+ */
268
+ static get noInteractive(): boolean;
287
269
  /**
288
270
  * The directory where to store the 'typescript' packages.
289
271
  */
@@ -292,6 +274,10 @@ declare class Environment {
292
274
  * The number of seconds to wait before giving up stale operations.
293
275
  */
294
276
  static get timeout(): number;
277
+ /**
278
+ * The path to the currently installed TypeScript module.
279
+ */
280
+ static get typescriptPath(): string | undefined;
295
281
  }
296
282
 
297
283
  declare class ResultTiming {
@@ -538,6 +524,15 @@ declare class Expect {
538
524
  match(assertion: Assertion, expectResult: ExpectResult): MatchResult | undefined;
539
525
  }
540
526
 
527
+ /**
528
+ * A stream to output messages.
529
+ */
530
+ interface WriteStream {
531
+ /**
532
+ * @param log - Message to write to the stream.
533
+ */
534
+ write: (log: string) => void;
535
+ }
541
536
  /**
542
537
  * Options to configure an instance of the {@link Logger}.
543
538
  */
@@ -547,13 +542,13 @@ interface LoggerOptions {
547
542
  */
548
543
  noColor?: boolean;
549
544
  /**
550
- * A stream to write warnings and errors. Default: `process.stdout`.
545
+ * A stream to write warnings and errors. Default: `process.stderr`.
551
546
  */
552
- stderr?: NodeJS.WritableStream;
547
+ stderr?: WriteStream;
553
548
  /**
554
- * A stream to write informational messages. Default: `process.stderr`.
549
+ * A stream to write informational messages. Default: `process.stdout`.
555
550
  */
556
- stdout?: NodeJS.WritableStream;
551
+ stdout?: WriteStream;
557
552
  }
558
553
  /**
559
554
  * Wraps the provided streams with a set of convenience methods.
@@ -565,14 +560,9 @@ declare class Logger {
565
560
  */
566
561
  constructor(options?: LoggerOptions);
567
562
  /**
568
- * Moves the cursor one line up and erases the line when the `stdout` stream
569
- * is interactive. Otherwise does nothing.
563
+ * Moves the cursor one line up in the `stdout` stream and erases that line.
570
564
  */
571
565
  eraseLastLine(): void;
572
- /**
573
- * Returns `true` if the `stdout` stream is interactive.
574
- */
575
- isInteractive(): boolean;
576
566
  writeError(body: JSX.Element | Array<JSX.Element>): void;
577
567
  writeMessage(body: JSX.Element | Array<JSX.Element>): void;
578
568
  writeWarning(body: JSX.Element | Array<JSX.Element>): void;
@@ -610,7 +600,6 @@ declare function usesCompilerStepText(compilerVersion: string, tsconfigFilePath:
610
600
  }): JSX.Element;
611
601
 
612
602
  declare class Path {
613
- static basename(filePath: string): string;
614
603
  static dirname(filePath: string): string;
615
604
  static join(...filePaths: Array<string>): string;
616
605
  static normalizeSlashes(filePath: string): string;
@@ -697,7 +686,7 @@ declare global {
697
686
  children?: never;
698
687
  escapes: Color | Array<Color>;
699
688
  };
700
- newline: {
689
+ newLine: {
701
690
  children?: never;
702
691
  };
703
692
  text: {
@@ -711,10 +700,14 @@ declare global {
711
700
  * Options to configure an instance of the {@link Scribbler}.
712
701
  */
713
702
  interface ScribblerOptions {
703
+ /**
704
+ * The end of line sequence to be used in the output. Default: `"\n"`.
705
+ */
706
+ newLine?: string;
714
707
  /**
715
708
  * Do not include ANSI color escape codes in the output. Default: `false`.
716
709
  */
717
- noColors?: boolean;
710
+ noColor?: boolean;
718
711
  }
719
712
  /**
720
713
  * Provides the JSX factory function and renderer.
@@ -746,4 +739,11 @@ declare class Text implements JSX.ElementClass {
746
739
  render(): JSX.Element;
747
740
  }
748
741
 
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 };
742
+ declare class Version {
743
+ #private;
744
+ static isGreaterThan(source: string, target: string): boolean;
745
+ static isSatisfiedWith(source: string, target: string): boolean;
746
+ static isVersionTag(target: string): boolean;
747
+ }
748
+
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, Version, type WriteStream, addsPackageStepText, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText };