tstyche 7.2.4 → 8.0.0-beta.0
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/README.md +4 -0
- package/dist/api.d.ts +16 -761
- package/dist/api.js +16 -6170
- package/dist/bin.js +2 -3
- package/dist/checker/BaseCheckerAdapter.d.ts +15 -0
- package/dist/checker/BaseCheckerAdapter.js +32 -0
- package/dist/checker/CompatCheckerAdapter.d.ts +70 -0
- package/dist/checker/CompatCheckerAdapter.js +221 -0
- package/dist/checker/NativeCheckerAdapter.d.ts +70 -0
- package/dist/checker/NativeCheckerAdapter.js +200 -0
- package/dist/checker/index.d.ts +3 -0
- package/dist/checker/index.js +2 -0
- package/dist/checker/types.d.ts +9 -0
- package/dist/checker/types.js +1 -0
- package/dist/cli/Cli.d.ts +5 -0
- package/dist/cli/Cli.js +144 -0
- package/dist/cli/CliDIagnosticText.d.ts +3 -0
- package/dist/cli/CliDIagnosticText.js +9 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +1 -0
- package/dist/collect/CollectDiagnosticText.d.ts +3 -0
- package/dist/collect/CollectDiagnosticText.js +5 -0
- package/dist/collect/CollectService.d.ts +9 -0
- package/dist/collect/CollectService.js +150 -0
- package/dist/collect/ExpectNode.d.ts +16 -0
- package/dist/collect/ExpectNode.js +30 -0
- package/dist/collect/IdentifierLookup.d.ts +18 -0
- package/dist/collect/IdentifierLookup.js +90 -0
- package/dist/collect/TestTree.d.ts +16 -0
- package/dist/collect/TestTree.js +15 -0
- package/dist/collect/TestTreeNode.d.ts +15 -0
- package/dist/collect/TestTreeNode.js +27 -0
- package/dist/collect/TestTreeNodeBrand.enum.d.ts +6 -0
- package/dist/collect/TestTreeNodeBrand.enum.js +7 -0
- package/dist/collect/TestTreeNodeFlags.enum.d.ts +6 -0
- package/dist/collect/TestTreeNodeFlags.enum.js +7 -0
- package/dist/collect/index.d.ts +6 -0
- package/dist/collect/index.js +6 -0
- package/dist/config/CommandParser.d.ts +7 -0
- package/dist/config/CommandParser.js +107 -0
- package/dist/config/Config.d.ts +18 -0
- package/dist/config/Config.js +59 -0
- package/dist/config/ConfigDiagnosticText.d.ts +19 -0
- package/dist/config/ConfigDiagnosticText.js +57 -0
- package/dist/config/ConfigParser.d.ts +10 -0
- package/dist/config/ConfigParser.js +165 -0
- package/dist/config/Directive.d.ts +9 -0
- package/dist/config/Directive.js +119 -0
- package/dist/config/DirectiveDiagnosticText.d.ts +5 -0
- package/dist/config/DirectiveDiagnosticText.js +11 -0
- package/dist/config/OptionBrand.enum.d.ts +8 -0
- package/dist/config/OptionBrand.enum.js +9 -0
- package/dist/config/OptionGroup.enum.d.ts +5 -0
- package/dist/config/OptionGroup.enum.js +6 -0
- package/dist/config/Options.d.ts +29 -0
- package/dist/config/Options.js +290 -0
- package/dist/config/Target.d.ts +7 -0
- package/dist/config/Target.js +47 -0
- package/dist/config/defaultOptions.d.ts +2 -0
- package/dist/config/defaultOptions.js +14 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.js +7 -0
- package/dist/config/types.d.ts +55 -0
- package/dist/config/types.js +1 -0
- package/dist/diagnostic/Diagnostic.d.ts +19 -0
- package/dist/diagnostic/Diagnostic.js +51 -0
- package/dist/diagnostic/DiagnosticCategory.enum.d.ts +4 -0
- package/dist/diagnostic/DiagnosticCategory.enum.js +5 -0
- package/dist/diagnostic/DiagnosticOrigin.d.ts +13 -0
- package/dist/diagnostic/DiagnosticOrigin.js +27 -0
- package/dist/diagnostic/helpers.d.ts +6 -0
- package/dist/diagnostic/helpers.js +74 -0
- package/dist/diagnostic/index.d.ts +5 -0
- package/dist/diagnostic/index.js +4 -0
- package/dist/diagnostic/types.d.ts +2 -0
- package/dist/diagnostic/types.js +1 -0
- package/dist/editor/TextEditor.d.ts +15 -0
- package/dist/editor/TextEditor.js +88 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/editor/index.js +1 -0
- package/dist/editor/types.d.ts +4 -0
- package/dist/editor/types.js +1 -0
- package/dist/environment/Environment.d.ts +5 -0
- package/dist/environment/Environment.js +89 -0
- package/dist/environment/environmentOptions.d.ts +1 -0
- package/dist/environment/environmentOptions.js +2 -0
- package/dist/environment/index.d.ts +2 -0
- package/dist/environment/index.js +1 -0
- package/dist/environment/types.d.ts +10 -0
- package/dist/environment/types.js +1 -0
- package/dist/events/EventEmitter.d.ts +14 -0
- package/dist/events/EventEmitter.js +42 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/events/index.js +1 -0
- package/dist/events/types.d.ts +88 -0
- package/dist/events/types.js +1 -0
- package/dist/expect/AbilityMatcherBase.d.ts +16 -0
- package/dist/expect/AbilityMatcherBase.js +52 -0
- package/dist/expect/Ensure.d.ts +10 -0
- package/dist/expect/Ensure.js +51 -0
- package/dist/expect/ExpectDiagnosticText.d.ts +29 -0
- package/dist/expect/ExpectDiagnosticText.js +87 -0
- package/dist/expect/ExpectService.d.ts +21 -0
- package/dist/expect/ExpectService.js +90 -0
- package/dist/expect/RelationMatcherBase.d.ts +12 -0
- package/dist/expect/RelationMatcherBase.js +16 -0
- package/dist/expect/ToAcceptProps.d.ts +10 -0
- package/dist/expect/ToAcceptProps.js +52 -0
- package/dist/expect/ToBe.d.ts +13 -0
- package/dist/expect/ToBe.js +18 -0
- package/dist/expect/ToBeApplicable.d.ts +10 -0
- package/dist/expect/ToBeApplicable.js +72 -0
- package/dist/expect/ToBeAssignableFrom.d.ts +9 -0
- package/dist/expect/ToBeAssignableFrom.js +12 -0
- package/dist/expect/ToBeAssignableTo.d.ts +9 -0
- package/dist/expect/ToBeAssignableTo.js +12 -0
- package/dist/expect/ToBeCallableWith.d.ts +11 -0
- package/dist/expect/ToBeCallableWith.js +29 -0
- package/dist/expect/ToBeConstructableWith.d.ts +11 -0
- package/dist/expect/ToBeConstructableWith.js +29 -0
- package/dist/expect/ToBeInstantiableWith.d.ts +10 -0
- package/dist/expect/ToBeInstantiableWith.js +31 -0
- package/dist/expect/ToHaveProperty.d.ts +10 -0
- package/dist/expect/ToHaveProperty.js +59 -0
- package/dist/expect/ToRaiseError.d.ts +9 -0
- package/dist/expect/ToRaiseError.js +82 -0
- package/dist/expect/index.d.ts +2 -0
- package/dist/expect/index.js +1 -0
- package/dist/expect/types.d.ts +7 -0
- package/dist/expect/types.js +1 -0
- package/dist/file/FilePosition.d.ts +7 -0
- package/dist/file/FilePosition.js +16 -0
- package/dist/file/index.d.ts +1 -0
- package/dist/file/index.js +1 -0
- package/dist/glob/Braces.d.ts +4 -0
- package/dist/glob/Braces.js +56 -0
- package/dist/glob/Glob.d.ts +4 -0
- package/dist/glob/Glob.js +47 -0
- package/dist/glob/index.d.ts +1 -0
- package/dist/glob/index.js +1 -0
- package/dist/handlers/CancellationHandler.d.ts +7 -0
- package/dist/handlers/CancellationHandler.js +15 -0
- package/dist/handlers/ExitCodeHandler.d.ts +7 -0
- package/dist/handlers/ExitCodeHandler.js +20 -0
- package/dist/handlers/ResultHandler.d.ts +5 -0
- package/dist/handlers/ResultHandler.js +206 -0
- package/dist/handlers/index.d.ts +3 -0
- package/dist/handlers/index.js +3 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +40 -45
- package/dist/index.d.ts +40 -45
- package/dist/index.js +1 -2
- package/dist/input/InputService.d.ts +6 -0
- package/dist/input/InputService.js +16 -0
- package/dist/input/index.d.ts +1 -0
- package/dist/input/index.js +1 -0
- package/dist/json/JsonNode.d.ts +11 -0
- package/dist/json/JsonNode.js +28 -0
- package/dist/json/JsonScanner.d.ts +14 -0
- package/dist/json/JsonScanner.js +105 -0
- package/dist/json/index.d.ts +3 -0
- package/dist/json/index.js +2 -0
- package/dist/json/types.d.ts +1 -0
- package/dist/json/types.js +1 -0
- package/dist/layers/AbilityLayer.d.ts +10 -0
- package/dist/layers/AbilityLayer.js +186 -0
- package/dist/layers/Layers.d.ts +11 -0
- package/dist/layers/Layers.js +47 -0
- package/dist/layers/SuppressedLayer.d.ts +11 -0
- package/dist/layers/SuppressedLayer.js +93 -0
- package/dist/layers/index.d.ts +2 -0
- package/dist/layers/index.js +1 -0
- package/dist/layers/types.d.ts +8 -0
- package/dist/layers/types.js +1 -0
- package/dist/output/CodeFrameText.d.ts +10 -0
- package/dist/output/CodeFrameText.js +71 -0
- package/dist/output/OutputService.d.ts +13 -0
- package/dist/output/OutputService.js +38 -0
- package/dist/output/StreamController.d.ts +10 -0
- package/dist/output/StreamController.js +16 -0
- package/dist/output/addsText.d.ts +4 -0
- package/dist/output/addsText.js +8 -0
- package/dist/output/describeNameText.d.ts +2 -0
- package/dist/output/describeNameText.js +5 -0
- package/dist/output/diagnosticText.d.ts +4 -0
- package/dist/output/diagnosticText.js +23 -0
- package/dist/output/dotText.d.ts +3 -0
- package/dist/output/dotText.js +11 -0
- package/dist/output/fileStatusText.d.ts +4 -0
- package/dist/output/fileStatusText.js +26 -0
- package/dist/output/formattedText.d.ts +2 -0
- package/dist/output/formattedText.js +19 -0
- package/dist/output/helpText.d.ts +3 -0
- package/dist/output/helpText.js +52 -0
- package/dist/output/helpers.d.ts +5 -0
- package/dist/output/helpers.js +23 -0
- package/dist/output/index.d.ts +16 -0
- package/dist/output/index.js +15 -0
- package/dist/output/prologueText.d.ts +2 -0
- package/dist/output/prologueText.js +5 -0
- package/dist/output/summaryText.d.ts +12 -0
- package/dist/output/summaryText.js +31 -0
- package/dist/output/testNameText.d.ts +3 -0
- package/dist/output/testNameText.js +24 -0
- package/dist/output/types.d.ts +5 -0
- package/dist/output/types.js +1 -0
- package/dist/output/usesText.d.ts +5 -0
- package/dist/output/usesText.js +22 -0
- package/dist/output/waitingForFileChangesText.d.ts +2 -0
- package/dist/output/waitingForFileChangesText.js +5 -0
- package/dist/output/watchUsageText.d.ts +2 -0
- package/dist/output/watchUsageText.js +12 -0
- package/dist/path/Path.d.ts +7 -0
- package/dist/path/Path.js +28 -0
- package/dist/path/index.d.ts +1 -0
- package/dist/path/index.js +1 -0
- package/dist/project/CompatMappedDiagnostic.d.ts +12 -0
- package/dist/project/CompatMappedDiagnostic.js +25 -0
- package/dist/project/CompatProjectService.d.ts +19 -0
- package/dist/project/CompatProjectService.js +188 -0
- package/dist/project/FileMapService.d.ts +6 -0
- package/dist/project/FileMapService.js +14 -0
- package/dist/project/NativeMappedDiagnostic.d.ts +14 -0
- package/dist/project/NativeMappedDiagnostic.js +29 -0
- package/dist/project/NativeProjectService.d.ts +21 -0
- package/dist/project/NativeProjectService.js +216 -0
- package/dist/project/ProjectConfigService.d.ts +8 -0
- package/dist/project/ProjectConfigService.js +73 -0
- package/dist/project/index.d.ts +3 -0
- package/dist/project/index.js +2 -0
- package/dist/project/types.d.ts +7 -0
- package/dist/project/types.js +1 -0
- package/dist/reject/Reject.d.ts +9 -0
- package/dist/reject/Reject.js +43 -0
- package/dist/reject/RejectDiagnosticText.d.ts +5 -0
- package/dist/reject/RejectDiagnosticText.js +16 -0
- package/dist/reject/helpers.d.ts +1 -0
- package/dist/reject/helpers.js +3 -0
- package/dist/reject/index.d.ts +1 -0
- package/dist/reject/index.js +1 -0
- package/dist/reporters/BaseReporter.d.ts +7 -0
- package/dist/reporters/BaseReporter.js +6 -0
- package/dist/reporters/DotReporter.d.ts +6 -0
- package/dist/reporters/DotReporter.js +51 -0
- package/dist/reporters/FileView.d.ts +13 -0
- package/dist/reporters/FileView.js +33 -0
- package/dist/reporters/ListReporter.d.ts +6 -0
- package/dist/reporters/ListReporter.js +125 -0
- package/dist/reporters/SetupReporter.d.ts +4 -0
- package/dist/reporters/SetupReporter.js +21 -0
- package/dist/reporters/SummaryReporter.d.ts +5 -0
- package/dist/reporters/SummaryReporter.js +19 -0
- package/dist/reporters/WatchReporter.d.ts +5 -0
- package/dist/reporters/WatchReporter.js +21 -0
- package/dist/reporters/index.d.ts +7 -0
- package/dist/reporters/index.js +6 -0
- package/dist/reporters/types.d.ts +5 -0
- package/dist/reporters/types.js +1 -0
- package/dist/result/DescribeResult.d.ts +9 -0
- package/dist/result/DescribeResult.js +11 -0
- package/dist/result/ExpectResult.d.ts +10 -0
- package/dist/result/ExpectResult.js +11 -0
- package/dist/result/FileResult.d.ts +15 -0
- package/dist/result/FileResult.js +13 -0
- package/dist/result/ProjectConfigKind.enum.d.ts +6 -0
- package/dist/result/ProjectConfigKind.enum.js +7 -0
- package/dist/result/ProjectResult.d.ts +8 -0
- package/dist/result/ProjectResult.js +9 -0
- package/dist/result/Result.d.ts +13 -0
- package/dist/result/Result.js +14 -0
- package/dist/result/ResultStatus.enum.d.ts +10 -0
- package/dist/result/ResultStatus.enum.js +11 -0
- package/dist/result/SuppressedResult.d.ts +5 -0
- package/dist/result/SuppressedResult.js +6 -0
- package/dist/result/TargetResult.d.ts +11 -0
- package/dist/result/TargetResult.js +12 -0
- package/dist/result/TestResult.d.ts +13 -0
- package/dist/result/TestResult.js +13 -0
- package/dist/result/helpers.d.ts +7 -0
- package/dist/result/helpers.js +21 -0
- package/dist/result/index.d.ts +11 -0
- package/dist/result/index.js +10 -0
- package/dist/result/types.d.ts +31 -0
- package/dist/result/types.js +1 -0
- package/dist/runner/FileRunner.d.ts +10 -0
- package/dist/runner/FileRunner.js +93 -0
- package/dist/runner/FixmeDiagnosticText.d.ts +4 -0
- package/dist/runner/FixmeDiagnosticText.js +8 -0
- package/dist/runner/FixmeService.d.ts +9 -0
- package/dist/runner/FixmeService.js +51 -0
- package/dist/runner/RunModeFlags.enum.d.ts +7 -0
- package/dist/runner/RunModeFlags.enum.js +8 -0
- package/dist/runner/Runner.d.ts +9 -0
- package/dist/runner/Runner.js +101 -0
- package/dist/runner/TestTreeWalker.d.ts +19 -0
- package/dist/runner/TestTreeWalker.js +169 -0
- package/dist/runner/index.d.ts +1 -0
- package/dist/runner/index.js +1 -0
- package/dist/scribbler/Color.enum.d.ts +10 -0
- package/dist/scribbler/Color.enum.js +11 -0
- package/dist/scribbler/Line.d.ts +9 -0
- package/dist/scribbler/Line.js +5 -0
- package/dist/scribbler/Scribbler.d.ts +10 -0
- package/dist/scribbler/Scribbler.js +53 -0
- package/dist/scribbler/Text.d.ts +9 -0
- package/dist/scribbler/Text.js +8 -0
- package/dist/scribbler/index.d.ts +5 -0
- package/dist/scribbler/index.js +4 -0
- package/dist/scribbler/jsxRuntime.d.ts +4 -0
- package/dist/scribbler/jsxRuntime.js +4 -0
- package/dist/scribbler/types.d.ts +19 -0
- package/dist/scribbler/types.js +1 -0
- package/dist/select/Select.d.ts +7 -0
- package/dist/select/Select.js +91 -0
- package/dist/select/SelectDiagnosticText.d.ts +6 -0
- package/dist/select/SelectDiagnosticText.js +24 -0
- package/dist/select/index.d.ts +2 -0
- package/dist/select/index.js +2 -0
- package/dist/store/Fetcher.d.ts +8 -0
- package/dist/store/Fetcher.js +52 -0
- package/dist/store/Lock.d.ts +5 -0
- package/dist/store/Lock.js +17 -0
- package/dist/store/LockService.d.ts +8 -0
- package/dist/store/LockService.js +36 -0
- package/dist/store/Manifest.d.ts +35 -0
- package/dist/store/Manifest.js +58 -0
- package/dist/store/ManifestService.d.ts +10 -0
- package/dist/store/ManifestService.js +129 -0
- package/dist/store/PackageService.d.ts +8 -0
- package/dist/store/PackageService.js +69 -0
- package/dist/store/Store.d.ts +12 -0
- package/dist/store/Store.js +103 -0
- package/dist/store/StoreDiagnosticText.d.ts +12 -0
- package/dist/store/StoreDiagnosticText.js +36 -0
- package/dist/store/TarReader.d.ts +9 -0
- package/dist/store/TarReader.js +56 -0
- package/dist/store/helpers.d.ts +1 -0
- package/dist/store/helpers.js +3 -0
- package/dist/store/index.d.ts +1 -0
- package/dist/store/index.js +1 -0
- package/dist/structure/ComparisonResult.enum.d.ts +5 -0
- package/dist/structure/ComparisonResult.enum.js +6 -0
- package/dist/structure/Structure.d.ts +24 -0
- package/dist/structure/Structure.js +481 -0
- package/dist/structure/index.d.ts +1 -0
- package/dist/structure/index.js +1 -0
- package/dist/suppressed/SuppressedDiagnosticText.d.ts +6 -0
- package/dist/suppressed/SuppressedDiagnosticText.js +18 -0
- package/dist/suppressed/SuppressedService.d.ts +5 -0
- package/dist/suppressed/SuppressedService.js +61 -0
- package/dist/suppressed/index.d.ts +1 -0
- package/dist/suppressed/index.js +1 -0
- package/dist/tag.d.ts +1 -3
- package/dist/tag.js +2 -5
- package/dist/text/TextFile.d.ts +11 -0
- package/dist/text/TextFile.js +41 -0
- package/dist/text/TextFileService.d.ts +10 -0
- package/dist/text/TextFileService.js +31 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.js +2 -0
- package/dist/text/types.d.ts +5 -0
- package/dist/text/types.js +1 -0
- package/dist/token/CancellationReason.enum.d.ts +6 -0
- package/dist/token/CancellationReason.enum.js +7 -0
- package/dist/token/CancellationToken.d.ts +8 -0
- package/dist/token/CancellationToken.js +22 -0
- package/dist/token/index.d.ts +2 -0
- package/dist/token/index.js +2 -0
- package/dist/typescript/BaseAdapter.d.ts +36 -0
- package/dist/typescript/BaseAdapter.js +83 -0
- package/dist/typescript/CompatTypeScript.d.ts +21 -0
- package/dist/typescript/CompatTypeScript.js +37 -0
- package/dist/typescript/NativeTypeScript.d.ts +24 -0
- package/dist/typescript/NativeTypeScript.js +44 -0
- package/dist/typescript/index.d.ts +3 -0
- package/dist/typescript/index.js +2 -0
- package/dist/typescript/types.d.ts +69 -0
- package/dist/typescript/types.js +1 -0
- package/dist/version/Version.d.ts +6 -0
- package/dist/version/Version.js +30 -0
- package/dist/version/index.d.ts +1 -0
- package/dist/version/index.js +1 -0
- package/dist/watch/Debounce.d.ts +9 -0
- package/dist/watch/Debounce.js +27 -0
- package/dist/watch/FileWatcher.d.ts +5 -0
- package/dist/watch/FileWatcher.js +12 -0
- package/dist/watch/WatchService.d.ts +8 -0
- package/dist/watch/WatchService.js +96 -0
- package/dist/watch/Watcher.d.ts +10 -0
- package/dist/watch/Watcher.js +31 -0
- package/dist/watch/index.d.ts +3 -0
- package/dist/watch/index.js +3 -0
- package/package.json +9 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { compareDiagnostics } from "#diagnostic";
|
|
2
|
+
import { TextEditor } from "#editor";
|
|
3
|
+
import { AbilityLayer } from "./AbilityLayer.js";
|
|
4
|
+
import { SuppressedLayer } from "./SuppressedLayer.js";
|
|
5
|
+
export class Layers {
|
|
6
|
+
#abilityLayer;
|
|
7
|
+
#editor = new TextEditor();
|
|
8
|
+
#projectService;
|
|
9
|
+
#suppressedDiagnostics;
|
|
10
|
+
#suppressedLayer;
|
|
11
|
+
constructor(ts, projectService, resolvedConfig) {
|
|
12
|
+
this.#projectService = projectService;
|
|
13
|
+
this.#abilityLayer = new AbilityLayer(ts, this.#editor);
|
|
14
|
+
this.#suppressedLayer = new SuppressedLayer(this.#editor, resolvedConfig);
|
|
15
|
+
}
|
|
16
|
+
close(tree) {
|
|
17
|
+
let seenDiagnostics = [];
|
|
18
|
+
if (this.#suppressedDiagnostics != null) {
|
|
19
|
+
seenDiagnostics = this.#suppressedDiagnostics;
|
|
20
|
+
this.#suppressedDiagnostics = undefined;
|
|
21
|
+
}
|
|
22
|
+
const abilityDiagnostics = [];
|
|
23
|
+
if (this.#abilityLayer.hasChanges()) {
|
|
24
|
+
const diagnostics = this.#projectService.openLayer(this.#editor.getFilePath(), this.#editor.getText());
|
|
25
|
+
const offsets = this.#editor.getOffsets();
|
|
26
|
+
for (const diagnostic of diagnostics) {
|
|
27
|
+
const mappedDiagnostic = this.#projectService.getMappedDiagnostic(tree.sourceFile, diagnostic, offsets);
|
|
28
|
+
if (!seenDiagnostics.some((seenDiagnostic) => compareDiagnostics(mappedDiagnostic, seenDiagnostic))) {
|
|
29
|
+
abilityDiagnostics.push(mappedDiagnostic);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
this.#abilityLayer.close(abilityDiagnostics);
|
|
34
|
+
this.#editor.close();
|
|
35
|
+
}
|
|
36
|
+
open(tree) {
|
|
37
|
+
this.#editor.open(tree.sourceFile);
|
|
38
|
+
this.#suppressedLayer.open(tree);
|
|
39
|
+
if (this.#suppressedLayer.hasChanges()) {
|
|
40
|
+
this.#suppressedDiagnostics = this.#projectService.openLayer(this.#editor.getFilePath(), this.#editor.getText());
|
|
41
|
+
}
|
|
42
|
+
this.#suppressedLayer.close(this.#suppressedDiagnostics?.map((diagnostic) => this.#projectService.getMappedDiagnostic(tree.sourceFile, diagnostic)));
|
|
43
|
+
}
|
|
44
|
+
visit(node) {
|
|
45
|
+
this.#abilityLayer.visitExpect(node);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TestTree } from "#collect";
|
|
2
|
+
import type { ResolvedConfig } from "#config";
|
|
3
|
+
import type { TextEditor } from "#editor";
|
|
4
|
+
import type * as ts from "#typescript";
|
|
5
|
+
export declare class SuppressedLayer {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(editor: TextEditor, resolvedConfig: ResolvedConfig);
|
|
8
|
+
close(diagnostics: Array<ts.Diagnostic> | undefined): void;
|
|
9
|
+
hasChanges(): boolean;
|
|
10
|
+
open(tree: TestTree): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { isDiagnosticLocation, isDiagnosticPosition } from "#diagnostic";
|
|
2
|
+
import { TextFileService } from "#text";
|
|
3
|
+
export class SuppressedLayer {
|
|
4
|
+
#editor;
|
|
5
|
+
#expectErrorRegex = /^([ \t/*{]*)(@ts-expect-error)(!?)(:? *)(.*?)(?:\*\/.*)?$/gim;
|
|
6
|
+
#resolvedConfig;
|
|
7
|
+
#suppressedErrorsMap;
|
|
8
|
+
constructor(editor, resolvedConfig) {
|
|
9
|
+
this.#editor = editor;
|
|
10
|
+
this.#resolvedConfig = resolvedConfig;
|
|
11
|
+
}
|
|
12
|
+
#collectSuppressedErrors(text) {
|
|
13
|
+
const ranges = [];
|
|
14
|
+
for (const match of text.matchAll(this.#expectErrorRegex)) {
|
|
15
|
+
const offsetText = match[1];
|
|
16
|
+
const directiveText = match[2];
|
|
17
|
+
const ignoreText = match[3];
|
|
18
|
+
const argumentSeparatorText = match[4];
|
|
19
|
+
const argumentText = match[5]?.split(/--+/)[0]?.trimEnd();
|
|
20
|
+
if (typeof offsetText !== "string" || !directiveText) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const start = match.index + offsetText.length;
|
|
24
|
+
const range = {
|
|
25
|
+
directive: { start, end: start + directiveText.length, text: directiveText },
|
|
26
|
+
ignore: ignoreText === "!",
|
|
27
|
+
diagnostics: [],
|
|
28
|
+
};
|
|
29
|
+
if (typeof argumentSeparatorText === "string" && typeof argumentText === "string") {
|
|
30
|
+
const start = range.directive.end + argumentSeparatorText.length;
|
|
31
|
+
range.argument = { start, end: start + argumentText.length, text: argumentText };
|
|
32
|
+
}
|
|
33
|
+
ranges.push(range);
|
|
34
|
+
}
|
|
35
|
+
return ranges;
|
|
36
|
+
}
|
|
37
|
+
close(diagnostics) {
|
|
38
|
+
if (diagnostics != null && this.#suppressedErrorsMap != null) {
|
|
39
|
+
for (const diagnostic of diagnostics) {
|
|
40
|
+
this.#mapToDirectives(diagnostic);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
this.#suppressedErrorsMap = undefined;
|
|
44
|
+
}
|
|
45
|
+
hasChanges() {
|
|
46
|
+
return this.#suppressedErrorsMap != null;
|
|
47
|
+
}
|
|
48
|
+
#mapToDirectives(diagnostic) {
|
|
49
|
+
let file;
|
|
50
|
+
let position;
|
|
51
|
+
if (isDiagnosticPosition(diagnostic)) {
|
|
52
|
+
file = TextFileService.get(diagnostic.fileName);
|
|
53
|
+
position = diagnostic.pos;
|
|
54
|
+
}
|
|
55
|
+
if (isDiagnosticLocation(diagnostic)) {
|
|
56
|
+
file = TextFileService.get(diagnostic.file);
|
|
57
|
+
position = diagnostic.start;
|
|
58
|
+
}
|
|
59
|
+
if (!file || !position) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const lineMap = file.getLineMap();
|
|
63
|
+
let line = file.getLocation(position).line - 1;
|
|
64
|
+
while (line >= 0) {
|
|
65
|
+
const suppressedError = this.#suppressedErrorsMap?.get(line);
|
|
66
|
+
if (suppressedError != null) {
|
|
67
|
+
suppressedError.diagnostics.push(diagnostic);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
const lineText = file.text.slice(lineMap[line], lineMap[line + 1]).trim();
|
|
71
|
+
if (lineText !== "" && !lineText.startsWith("//")) {
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
line--;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
open(tree) {
|
|
78
|
+
const suppressedErrors = this.#collectSuppressedErrors(this.#editor.getText());
|
|
79
|
+
if (this.#resolvedConfig.checkSuppressedErrors) {
|
|
80
|
+
tree.suppressedErrors = suppressedErrors;
|
|
81
|
+
this.#suppressedErrorsMap = new Map();
|
|
82
|
+
}
|
|
83
|
+
for (const suppressedError of suppressedErrors) {
|
|
84
|
+
const { start, end } = suppressedError.directive;
|
|
85
|
+
this.#editor.erase(start, end);
|
|
86
|
+
if (this.#suppressedErrorsMap != null) {
|
|
87
|
+
const file = TextFileService.get(tree.sourceFile);
|
|
88
|
+
const { line } = file.getLocation(start);
|
|
89
|
+
this.#suppressedErrorsMap.set(line, suppressedError);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Layers } from "./Layers.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DiagnosticCategory, type DiagnosticOrigin } from "#diagnostic";
|
|
2
|
+
import { type ScribblerJsx } from "#scribbler";
|
|
3
|
+
import type { CodeFrameOptions } from "./types.js";
|
|
4
|
+
interface CodeFrameTextProps {
|
|
5
|
+
diagnosticCategory: DiagnosticCategory;
|
|
6
|
+
diagnosticOrigin: DiagnosticOrigin;
|
|
7
|
+
options?: CodeFrameOptions | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function CodeFrameText({ diagnosticCategory, diagnosticOrigin, options }: CodeFrameTextProps): ScribblerJsx.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "#scribbler/jsx-runtime";
|
|
2
|
+
import { Path } from "#path";
|
|
3
|
+
import { Line, Text } from "#scribbler";
|
|
4
|
+
function BreadcrumbsText({ ancestor }) {
|
|
5
|
+
const text = [];
|
|
6
|
+
while ("name" in ancestor) {
|
|
7
|
+
if (ancestor.name !== "") {
|
|
8
|
+
text.push(ancestor.name);
|
|
9
|
+
}
|
|
10
|
+
ancestor = ancestor.parent;
|
|
11
|
+
}
|
|
12
|
+
text.push("");
|
|
13
|
+
return _jsx(Text, { color: "90", children: text.reverse().join(" ❭ ") });
|
|
14
|
+
}
|
|
15
|
+
function CodeLineText({ gutterWidth, lineNumber, lineNumberColor = "90", lineText }) {
|
|
16
|
+
return (_jsxs(Line, { children: [_jsx(Text, { color: lineNumberColor, children: lineNumber.toString().padStart(gutterWidth) }), _jsx(Text, { color: "90", children: " | " }), lineText] }));
|
|
17
|
+
}
|
|
18
|
+
function SquiggleLineText({ gutterWidth, indentWidth = 0, squiggleColor, squiggleWidth }) {
|
|
19
|
+
return (_jsxs(Line, { children: [" ".repeat(gutterWidth), _jsx(Text, { color: "90", children: " | " }), " ".repeat(indentWidth), _jsx(Text, { color: squiggleColor, children: "~".repeat(squiggleWidth === 0 ? 1 : squiggleWidth) })] }));
|
|
20
|
+
}
|
|
21
|
+
export function CodeFrameText({ diagnosticCategory, diagnosticOrigin, options }) {
|
|
22
|
+
const linesAbove = options?.linesAbove ?? 2;
|
|
23
|
+
const linesBelow = options?.linesBelow ?? 3;
|
|
24
|
+
const showBreadcrumbs = options?.showBreadcrumbs ?? true;
|
|
25
|
+
const { start, end, file, expectNode } = diagnosticOrigin;
|
|
26
|
+
const lineMap = file.getLineMap();
|
|
27
|
+
const { character: firstMarkedCharacter, line: firstMarkedLine } = file.getLocation(start);
|
|
28
|
+
const { character: lastMarkedCharacter, line: lastMarkedLine } = file.getLocation(end);
|
|
29
|
+
const firstLine = Math.max(firstMarkedLine - linesAbove, 0);
|
|
30
|
+
const lastLine = Math.min(lastMarkedLine + linesBelow, lineMap.length - 1);
|
|
31
|
+
const gutterWidth = (lastLine + 1).toString().length + 2;
|
|
32
|
+
let highlightColor;
|
|
33
|
+
switch (diagnosticCategory) {
|
|
34
|
+
case "error":
|
|
35
|
+
highlightColor = "31";
|
|
36
|
+
break;
|
|
37
|
+
case "warning":
|
|
38
|
+
highlightColor = "33";
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
const codeFrame = [];
|
|
42
|
+
for (let index = firstLine; index <= lastLine; index++) {
|
|
43
|
+
const lineStart = lineMap[index];
|
|
44
|
+
const lineEnd = index === lineMap.length - 1 ? file.text.length : lineMap[index + 1];
|
|
45
|
+
const lineText = file.text.slice(lineStart, lineEnd).trimEnd().replace(/\t/g, " ");
|
|
46
|
+
if (index >= firstMarkedLine && index <= lastMarkedLine) {
|
|
47
|
+
codeFrame.push(_jsx(CodeLineText, { gutterWidth: gutterWidth, lineNumber: index + 1, lineNumberColor: highlightColor, lineText: lineText }));
|
|
48
|
+
if (index === firstMarkedLine) {
|
|
49
|
+
const squiggleLength = index === lastMarkedLine
|
|
50
|
+
? lastMarkedCharacter - firstMarkedCharacter
|
|
51
|
+
: lineText.length - firstMarkedCharacter;
|
|
52
|
+
codeFrame.push(_jsx(SquiggleLineText, { gutterWidth: gutterWidth, indentWidth: firstMarkedCharacter, squiggleColor: highlightColor, squiggleWidth: squiggleLength }));
|
|
53
|
+
}
|
|
54
|
+
else if (index === lastMarkedLine) {
|
|
55
|
+
codeFrame.push(_jsx(SquiggleLineText, { gutterWidth: gutterWidth, squiggleColor: highlightColor, squiggleWidth: lastMarkedCharacter }));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
codeFrame.push(_jsx(SquiggleLineText, { gutterWidth: gutterWidth, squiggleColor: highlightColor, squiggleWidth: lineText.length }));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
codeFrame.push(_jsx(CodeLineText, { gutterWidth: gutterWidth, lineNumber: index + 1, lineText: lineText }));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
let breadcrumbs;
|
|
66
|
+
if (showBreadcrumbs && expectNode != null) {
|
|
67
|
+
breadcrumbs = _jsx(BreadcrumbsText, { ancestor: expectNode.parent });
|
|
68
|
+
}
|
|
69
|
+
const location = (_jsxs(Line, { children: [" ".repeat(gutterWidth + 2), _jsx(Text, { color: "90", children: " at " }), _jsx(Text, { color: "36", children: Path.relative("", file.path) }), _jsx(Text, { color: "90", children: `:${firstMarkedLine + 1}:${firstMarkedCharacter + 1}` }), breadcrumbs] }));
|
|
70
|
+
return (_jsxs(Text, { children: [codeFrame, _jsx(Line, {}), location] }));
|
|
71
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ScribblerJsx } from "#scribbler";
|
|
2
|
+
import { StreamController } from "./StreamController.js";
|
|
3
|
+
export declare class OutputService {
|
|
4
|
+
#private;
|
|
5
|
+
static errorStream: StreamController;
|
|
6
|
+
static outputStream: StreamController;
|
|
7
|
+
static clearTerminal(): void;
|
|
8
|
+
static eraseLastLine(): void;
|
|
9
|
+
static writeBlankLine(count?: number): void;
|
|
10
|
+
static writeError(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
|
|
11
|
+
static writeMessage(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
|
|
12
|
+
static writeWarning(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { Scribbler } from "#scribbler";
|
|
3
|
+
import { StreamController } from "./StreamController.js";
|
|
4
|
+
export class OutputService {
|
|
5
|
+
static errorStream = new StreamController(process.stderr);
|
|
6
|
+
static outputStream = new StreamController(process.stdout);
|
|
7
|
+
static #isClear = false;
|
|
8
|
+
static #newLine = "\n";
|
|
9
|
+
static #scribbler = new Scribbler({ newLine: OutputService.#newLine });
|
|
10
|
+
static clearTerminal() {
|
|
11
|
+
if (!OutputService.#isClear) {
|
|
12
|
+
OutputService.outputStream.write("\u001B[2J\u001B[3J\u001B[H");
|
|
13
|
+
OutputService.#isClear = true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
static eraseLastLine() {
|
|
17
|
+
OutputService.outputStream.write("\u001B[1A\u001B[0K");
|
|
18
|
+
}
|
|
19
|
+
static #write(stream, element) {
|
|
20
|
+
const elements = Array.isArray(element) ? element : [element];
|
|
21
|
+
for (const element of elements) {
|
|
22
|
+
stream.write(OutputService.#scribbler.render(element));
|
|
23
|
+
}
|
|
24
|
+
OutputService.#isClear = false;
|
|
25
|
+
}
|
|
26
|
+
static writeBlankLine(count = 1) {
|
|
27
|
+
OutputService.outputStream.write(OutputService.#newLine.repeat(count));
|
|
28
|
+
}
|
|
29
|
+
static writeError(element) {
|
|
30
|
+
OutputService.#write(OutputService.errorStream, element);
|
|
31
|
+
}
|
|
32
|
+
static writeMessage(element) {
|
|
33
|
+
OutputService.#write(OutputService.outputStream, element);
|
|
34
|
+
}
|
|
35
|
+
static writeWarning(element) {
|
|
36
|
+
OutputService.#write(OutputService.errorStream, element);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class StreamController {
|
|
2
|
+
#isEnabled = true;
|
|
3
|
+
#stream;
|
|
4
|
+
constructor(stream) {
|
|
5
|
+
this.#stream = stream;
|
|
6
|
+
}
|
|
7
|
+
disable() {
|
|
8
|
+
this.#isEnabled = false;
|
|
9
|
+
}
|
|
10
|
+
enable() {
|
|
11
|
+
this.#isEnabled = true;
|
|
12
|
+
}
|
|
13
|
+
write(text) {
|
|
14
|
+
this.#isEnabled && this.#stream.write(text);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "#scribbler/jsx-runtime";
|
|
2
|
+
import { Line, Text } from "#scribbler";
|
|
3
|
+
export function addsText(packageVersion, packagePath, options) {
|
|
4
|
+
if (options?.short) {
|
|
5
|
+
return (_jsx(Line, { children: _jsx(Text, { color: "90", children: packageVersion }) }));
|
|
6
|
+
}
|
|
7
|
+
return (_jsxs(Line, { children: [_jsx(Text, { color: "90", children: "adds" }), " TypeScript ", packageVersion, _jsxs(Text, { color: "90", children: [" to ", packagePath] })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Diagnostic } from "#diagnostic";
|
|
2
|
+
import { type ScribblerJsx } from "#scribbler";
|
|
3
|
+
import type { CodeFrameOptions } from "./types.js";
|
|
4
|
+
export declare function diagnosticText(diagnostic: Diagnostic, codeFrameOptions?: CodeFrameOptions): ScribblerJsx.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "#scribbler/jsx-runtime";
|
|
2
|
+
import { Line, Text } from "#scribbler";
|
|
3
|
+
import { CodeFrameText } from "./CodeFrameText.js";
|
|
4
|
+
function DiagnosticText({ codeFrameOptions, diagnostic }) {
|
|
5
|
+
const code = diagnostic.code ? _jsxs(Text, { color: "90", children: [" ", diagnostic.code] }) : undefined;
|
|
6
|
+
const text = Array.isArray(diagnostic.text) ? diagnostic.text : [diagnostic.text];
|
|
7
|
+
const message = text.map((text, index) => (_jsxs(Text, { children: [index === 1 ? _jsx(Line, {}) : undefined, _jsxs(Line, { children: [text, index === 0 ? code : undefined] })] })));
|
|
8
|
+
const related = diagnostic.related?.map((relatedDiagnostic) => _jsx(DiagnosticText, { diagnostic: relatedDiagnostic }));
|
|
9
|
+
const codeFrame = diagnostic.origin ? (_jsxs(Text, { children: [_jsx(Line, {}), _jsx(CodeFrameText, { diagnosticCategory: diagnostic.category, diagnosticOrigin: diagnostic.origin, options: codeFrameOptions })] })) : undefined;
|
|
10
|
+
return (_jsxs(Text, { children: [message, codeFrame, _jsx(Line, {}), _jsx(Text, { indent: 2, children: related })] }));
|
|
11
|
+
}
|
|
12
|
+
export function diagnosticText(diagnostic, codeFrameOptions = {}) {
|
|
13
|
+
let prefix;
|
|
14
|
+
switch (diagnostic.category) {
|
|
15
|
+
case "error":
|
|
16
|
+
prefix = _jsx(Text, { color: "31", children: "Error: " });
|
|
17
|
+
break;
|
|
18
|
+
case "warning":
|
|
19
|
+
prefix = _jsx(Text, { color: "33", children: "Warning: " });
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
return (_jsxs(Text, { children: [prefix, _jsx(DiagnosticText, { codeFrameOptions: codeFrameOptions, diagnostic: diagnostic })] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "#scribbler/jsx-runtime";
|
|
2
|
+
import { Text } from "#scribbler";
|
|
3
|
+
export function dotText(status) {
|
|
4
|
+
let statusColor;
|
|
5
|
+
let statusText = "·";
|
|
6
|
+
if (status === "failed") {
|
|
7
|
+
statusColor = "31";
|
|
8
|
+
statusText = "×";
|
|
9
|
+
}
|
|
10
|
+
return _jsx(Text, { color: statusColor, children: statusText });
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "#scribbler/jsx-runtime";
|
|
2
|
+
import { Path } from "#path";
|
|
3
|
+
import { Line, Text } from "#scribbler";
|
|
4
|
+
import { getStatusColor } from "./helpers.js";
|
|
5
|
+
function FileNameText({ filePath }) {
|
|
6
|
+
const relativePath = Path.relative("", filePath);
|
|
7
|
+
const lastPathSeparator = relativePath.lastIndexOf("/");
|
|
8
|
+
const directoryNameText = relativePath.slice(0, lastPathSeparator + 1);
|
|
9
|
+
const fileNameText = relativePath.slice(lastPathSeparator + 1);
|
|
10
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: "90", children: directoryNameText }), fileNameText] }));
|
|
11
|
+
}
|
|
12
|
+
export function fileStatusText(status, file) {
|
|
13
|
+
let statusText;
|
|
14
|
+
switch (status) {
|
|
15
|
+
case "runs":
|
|
16
|
+
statusText = "runs";
|
|
17
|
+
break;
|
|
18
|
+
case "passed":
|
|
19
|
+
statusText = "pass";
|
|
20
|
+
break;
|
|
21
|
+
case "failed":
|
|
22
|
+
statusText = "fail";
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
return (_jsxs(Line, { children: [_jsx(Text, { color: getStatusColor(status), children: statusText }), " ", _jsx(FileNameText, { filePath: file.path })] }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "#scribbler/jsx-runtime";
|
|
2
|
+
import { Line } from "#scribbler";
|
|
3
|
+
export function formattedText(input) {
|
|
4
|
+
if (typeof input === "string") {
|
|
5
|
+
return _jsx(Line, { children: input });
|
|
6
|
+
}
|
|
7
|
+
if (Array.isArray(input)) {
|
|
8
|
+
return _jsx(Line, { children: JSON.stringify(input, null, 2) });
|
|
9
|
+
}
|
|
10
|
+
function sortObject(target) {
|
|
11
|
+
return Object.keys(target)
|
|
12
|
+
.sort()
|
|
13
|
+
.reduce((result, key) => {
|
|
14
|
+
result[key] = target[key];
|
|
15
|
+
return result;
|
|
16
|
+
}, {});
|
|
17
|
+
}
|
|
18
|
+
return _jsx(Line, { children: JSON.stringify(sortObject(input), null, 2) });
|
|
19
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "#scribbler/jsx-runtime";
|
|
2
|
+
import { Line, Text } from "#scribbler";
|
|
3
|
+
function HintText({ children }) {
|
|
4
|
+
return (_jsx(Text, { indent: 1, color: "90", children: children }));
|
|
5
|
+
}
|
|
6
|
+
function HelpHeaderText({ tstycheVersion }) {
|
|
7
|
+
return (_jsxs(Line, { children: ["The TSTyche Type Test Runner", _jsx(HintText, { children: tstycheVersion })] }));
|
|
8
|
+
}
|
|
9
|
+
function CommandText({ hint, text }) {
|
|
10
|
+
return (_jsxs(Line, { indent: 1, children: [_jsx(Text, { color: "34", children: text }), hint && _jsx(HintText, { children: hint })] }));
|
|
11
|
+
}
|
|
12
|
+
function OptionDescriptionText({ text }) {
|
|
13
|
+
return _jsx(Line, { indent: 1, children: text });
|
|
14
|
+
}
|
|
15
|
+
function CommandLineUsageText() {
|
|
16
|
+
const usage = [
|
|
17
|
+
["tstyche", "Run all tests."],
|
|
18
|
+
["tstyche query-params", "Only run the matching test file."],
|
|
19
|
+
["tstyche --target '5.4 || 5.6.2 || >=5.8'", "Test against specific versions of TypeScript."],
|
|
20
|
+
];
|
|
21
|
+
const usageText = usage.map(([commandText, descriptionText]) => (_jsxs(Line, { children: [_jsx(CommandText, { text: commandText }), _jsx(OptionDescriptionText, { text: descriptionText })] })));
|
|
22
|
+
return _jsx(Text, { children: usageText });
|
|
23
|
+
}
|
|
24
|
+
function CommandLineOptionNameText({ text }) {
|
|
25
|
+
return _jsx(Text, { children: `--${text}` });
|
|
26
|
+
}
|
|
27
|
+
function CommandLineOptionHintText({ definition }) {
|
|
28
|
+
if (definition.brand === "list") {
|
|
29
|
+
return _jsx(Text, { children: `${definition.brand} of ${definition.items.brand}s` });
|
|
30
|
+
}
|
|
31
|
+
if (definition.brand === "range") {
|
|
32
|
+
return _jsx(Text, { children: "string" });
|
|
33
|
+
}
|
|
34
|
+
return _jsx(Text, { children: definition.brand });
|
|
35
|
+
}
|
|
36
|
+
function CommandLineOptionsText({ optionDefinitions }) {
|
|
37
|
+
const definitions = [...optionDefinitions.values()];
|
|
38
|
+
const optionsText = definitions.map((definition) => {
|
|
39
|
+
let hint;
|
|
40
|
+
if (definition.brand !== "true") {
|
|
41
|
+
hint = _jsx(CommandLineOptionHintText, { definition: definition });
|
|
42
|
+
}
|
|
43
|
+
return (_jsxs(Text, { children: [_jsx(CommandText, { text: _jsx(CommandLineOptionNameText, { text: definition.name }), hint: hint }), _jsx(OptionDescriptionText, { text: definition.description }), _jsx(Line, {})] }));
|
|
44
|
+
});
|
|
45
|
+
return (_jsxs(Text, { children: [_jsx(Line, { children: "Command Line Options" }), _jsx(Line, {}), optionsText] }));
|
|
46
|
+
}
|
|
47
|
+
function HelpFooterText() {
|
|
48
|
+
return _jsx(Line, { children: "To learn more, visit https://tstyche.org" });
|
|
49
|
+
}
|
|
50
|
+
export function helpText(options, version) {
|
|
51
|
+
return (_jsxs(Text, { children: [_jsx(HelpHeaderText, { tstycheVersion: version }), _jsx(Line, {}), _jsx(CommandLineUsageText, {}), _jsx(Line, {}), _jsx(CommandLineOptionsText, { optionDefinitions: options }), _jsx(Line, {}), _jsx(HelpFooterText, {}), _jsx(Line, {})] }));
|
|
52
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ResultCounts, ResultStatus, type ResultTiming } from "#result";
|
|
2
|
+
import { Color } from "#scribbler";
|
|
3
|
+
export declare function getStatusColor(status: ResultStatus): Color;
|
|
4
|
+
export declare function duration(timing: ResultTiming): number;
|
|
5
|
+
export declare function total(counts: ResultCounts): number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function getStatusColor(status) {
|
|
2
|
+
switch (status) {
|
|
3
|
+
case "runs":
|
|
4
|
+
return "33";
|
|
5
|
+
case "passed":
|
|
6
|
+
case "matched":
|
|
7
|
+
return "32";
|
|
8
|
+
case "failed":
|
|
9
|
+
return "31";
|
|
10
|
+
case "fixme":
|
|
11
|
+
case "skipped":
|
|
12
|
+
case "ignored":
|
|
13
|
+
return "33";
|
|
14
|
+
case "todo":
|
|
15
|
+
return "35";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function duration(timing) {
|
|
19
|
+
return timing.end - timing.start;
|
|
20
|
+
}
|
|
21
|
+
export function total(counts) {
|
|
22
|
+
return Object.values(counts).reduce((sum, value) => sum + value, 0);
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { addsText } from "./addsText.js";
|
|
2
|
+
export { describeNameText } from "./describeNameText.js";
|
|
3
|
+
export { diagnosticText } from "./diagnosticText.js";
|
|
4
|
+
export { dotText } from "./dotText.js";
|
|
5
|
+
export { fileStatusText } from "./fileStatusText.js";
|
|
6
|
+
export { formattedText } from "./formattedText.js";
|
|
7
|
+
export { helpText } from "./helpText.js";
|
|
8
|
+
export { OutputService } from "./OutputService.js";
|
|
9
|
+
export { prologueText } from "./prologueText.js";
|
|
10
|
+
export { StreamController, type WriteStream } from "./StreamController.js";
|
|
11
|
+
export { summaryText } from "./summaryText.js";
|
|
12
|
+
export { testNameText } from "./testNameText.js";
|
|
13
|
+
export type { CodeFrameOptions } from "./types.js";
|
|
14
|
+
export { usesText } from "./usesText.js";
|
|
15
|
+
export { waitingForFileChangesText } from "./waitingForFileChangesText.js";
|
|
16
|
+
export { watchUsageText } from "./watchUsageText.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { addsText } from "./addsText.js";
|
|
2
|
+
export { describeNameText } from "./describeNameText.js";
|
|
3
|
+
export { diagnosticText } from "./diagnosticText.js";
|
|
4
|
+
export { dotText } from "./dotText.js";
|
|
5
|
+
export { fileStatusText } from "./fileStatusText.js";
|
|
6
|
+
export { formattedText } from "./formattedText.js";
|
|
7
|
+
export { helpText } from "./helpText.js";
|
|
8
|
+
export { OutputService } from "./OutputService.js";
|
|
9
|
+
export { prologueText } from "./prologueText.js";
|
|
10
|
+
export { StreamController } from "./StreamController.js";
|
|
11
|
+
export { summaryText } from "./summaryText.js";
|
|
12
|
+
export { testNameText } from "./testNameText.js";
|
|
13
|
+
export { usesText } from "./usesText.js";
|
|
14
|
+
export { waitingForFileChangesText } from "./waitingForFileChangesText.js";
|
|
15
|
+
export { watchUsageText } from "./watchUsageText.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "#scribbler/jsx-runtime";
|
|
2
|
+
import { Line, Text } from "#scribbler";
|
|
3
|
+
export function prologueText(runnerVersion, rootPath) {
|
|
4
|
+
return (_jsxs(Text, { children: [_jsxs(Line, { children: [_jsx(Text, { color: "90", children: "····" }), " TSTyche ", runnerVersion, _jsxs(Text, { color: "90", children: [" at ", rootPath] })] }), _jsx(Line, {})] }));
|
|
5
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResultCounts, ResultTiming, SuppressedCounts } from "#result";
|
|
2
|
+
import { type ScribblerJsx } from "#scribbler";
|
|
3
|
+
interface SummaryTextOptions {
|
|
4
|
+
targetCounts: ResultCounts;
|
|
5
|
+
fileCounts: ResultCounts;
|
|
6
|
+
testCounts: ResultCounts;
|
|
7
|
+
assertionCounts: ResultCounts;
|
|
8
|
+
suppressedCounts: SuppressedCounts;
|
|
9
|
+
timing: ResultTiming;
|
|
10
|
+
}
|
|
11
|
+
export declare function summaryText({ targetCounts, fileCounts, testCounts, assertionCounts, suppressedCounts, timing, }: SummaryTextOptions): ScribblerJsx.Element;
|
|
12
|
+
export {};
|