tstyche 7.2.5 → 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 -6204
- 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,21 @@
|
|
|
1
|
+
import { addsText, diagnosticText, OutputService } from "#output";
|
|
2
|
+
export class SetupReporter {
|
|
3
|
+
on([event, payload]) {
|
|
4
|
+
if (event === "store:adds") {
|
|
5
|
+
OutputService.writeMessage(addsText(payload.packageVersion, payload.packagePath));
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if ("diagnostics" in payload) {
|
|
9
|
+
for (const diagnostic of payload.diagnostics) {
|
|
10
|
+
switch (diagnostic.category) {
|
|
11
|
+
case "error":
|
|
12
|
+
OutputService.writeError(diagnosticText(diagnostic));
|
|
13
|
+
break;
|
|
14
|
+
case "warning":
|
|
15
|
+
OutputService.writeWarning(diagnosticText(diagnostic));
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OutputService, summaryText } from "#output";
|
|
2
|
+
import { BaseReporter } from "./BaseReporter.js";
|
|
3
|
+
export class SummaryReporter extends BaseReporter {
|
|
4
|
+
on([event, payload]) {
|
|
5
|
+
if (this.resolvedConfig.watch) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (event === "run:end") {
|
|
9
|
+
OutputService.writeMessage(summaryText({
|
|
10
|
+
targetCounts: payload.result.targetCounts,
|
|
11
|
+
fileCounts: payload.result.fileCounts,
|
|
12
|
+
testCounts: payload.result.testCounts,
|
|
13
|
+
assertionCounts: payload.result.assertionCounts,
|
|
14
|
+
suppressedCounts: payload.result.suppressedCounts,
|
|
15
|
+
timing: payload.result.timing,
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { diagnosticText, OutputService, waitingForFileChangesText, watchUsageText } from "#output";
|
|
2
|
+
import { BaseReporter } from "./BaseReporter.js";
|
|
3
|
+
export class WatchReporter extends BaseReporter {
|
|
4
|
+
on([event, payload]) {
|
|
5
|
+
switch (event) {
|
|
6
|
+
case "run:start":
|
|
7
|
+
OutputService.clearTerminal();
|
|
8
|
+
break;
|
|
9
|
+
case "run:end":
|
|
10
|
+
OutputService.writeMessage(watchUsageText());
|
|
11
|
+
break;
|
|
12
|
+
case "watch:error":
|
|
13
|
+
OutputService.clearTerminal();
|
|
14
|
+
for (const diagnostic of payload.diagnostics) {
|
|
15
|
+
OutputService.writeError(diagnosticText(diagnostic));
|
|
16
|
+
}
|
|
17
|
+
OutputService.writeMessage(waitingForFileChangesText());
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { BaseReporter } from "./BaseReporter.js";
|
|
2
|
+
export { DotReporter } from "./DotReporter.js";
|
|
3
|
+
export { ListReporter } from "./ListReporter.js";
|
|
4
|
+
export { SetupReporter } from "./SetupReporter.js";
|
|
5
|
+
export { SummaryReporter } from "./SummaryReporter.js";
|
|
6
|
+
export type { Reporter, ReporterEvent } from "./types.js";
|
|
7
|
+
export { WatchReporter } from "./WatchReporter.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { BaseReporter } from "./BaseReporter.js";
|
|
2
|
+
export { DotReporter } from "./DotReporter.js";
|
|
3
|
+
export { ListReporter } from "./ListReporter.js";
|
|
4
|
+
export { SetupReporter } from "./SetupReporter.js";
|
|
5
|
+
export { SummaryReporter } from "./SummaryReporter.js";
|
|
6
|
+
export { WatchReporter } from "./WatchReporter.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TestTreeNode } from "#collect";
|
|
2
|
+
import type { TestResult } from "./TestResult.js";
|
|
3
|
+
export declare class DescribeResult {
|
|
4
|
+
describe: TestTreeNode;
|
|
5
|
+
parent: DescribeResult | undefined;
|
|
6
|
+
results: Array<DescribeResult | TestResult>;
|
|
7
|
+
timing: import("./types.js").ResultTiming;
|
|
8
|
+
constructor(describe: TestTreeNode, parent?: DescribeResult);
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ExpectNode } from "#collect";
|
|
2
|
+
import type { TestResult } from "./TestResult.js";
|
|
3
|
+
import type { AssertionResultStatus } from "./types.js";
|
|
4
|
+
export declare class ExpectResult {
|
|
5
|
+
expect: ExpectNode;
|
|
6
|
+
parent: TestResult | undefined;
|
|
7
|
+
status: AssertionResultStatus;
|
|
8
|
+
timing: import("./types.js").ResultTiming;
|
|
9
|
+
constructor(expect: ExpectNode, parent?: TestResult);
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FilePosition } from "#file";
|
|
2
|
+
import type { DescribeResult } from "./DescribeResult.js";
|
|
3
|
+
import type { ExpectResult } from "./ExpectResult.js";
|
|
4
|
+
import type { TestResult } from "./TestResult.js";
|
|
5
|
+
import type { FileResultStatus } from "./types.js";
|
|
6
|
+
export declare class FileResult {
|
|
7
|
+
assertionCounts: import("./types.js").AssertionCounts;
|
|
8
|
+
file: FilePosition;
|
|
9
|
+
results: Array<DescribeResult | TestResult | ExpectResult>;
|
|
10
|
+
suppressedCounts: import("./types.js").SuppressedCounts;
|
|
11
|
+
status: FileResultStatus;
|
|
12
|
+
testCounts: import("./types.js").TestCounts;
|
|
13
|
+
timing: import("./types.js").ResultTiming;
|
|
14
|
+
constructor(file: FilePosition);
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createAssertionCounts, createResultTiming, createSuppressedCounts, createTestCounts } from "./helpers.js";
|
|
2
|
+
export class FileResult {
|
|
3
|
+
assertionCounts = createAssertionCounts();
|
|
4
|
+
file;
|
|
5
|
+
results = [];
|
|
6
|
+
suppressedCounts = createSuppressedCounts();
|
|
7
|
+
status = "runs";
|
|
8
|
+
testCounts = createTestCounts();
|
|
9
|
+
timing = createResultTiming();
|
|
10
|
+
constructor(file) {
|
|
11
|
+
this.file = file;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var ProjectConfigKind;
|
|
2
|
+
(function (ProjectConfigKind) {
|
|
3
|
+
ProjectConfigKind[ProjectConfigKind["Discovered"] = 0] = "Discovered";
|
|
4
|
+
ProjectConfigKind[ProjectConfigKind["Default"] = 1] = "Default";
|
|
5
|
+
ProjectConfigKind[ProjectConfigKind["Provided"] = 2] = "Provided";
|
|
6
|
+
ProjectConfigKind[ProjectConfigKind["Synthetic"] = 3] = "Synthetic";
|
|
7
|
+
})(ProjectConfigKind || (ProjectConfigKind = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FileResult } from "./FileResult.js";
|
|
2
|
+
import type { ProjectConfig } from "./types.js";
|
|
3
|
+
export declare class ProjectResult {
|
|
4
|
+
compilerVersion: string;
|
|
5
|
+
projectConfig: ProjectConfig;
|
|
6
|
+
results: Array<FileResult>;
|
|
7
|
+
constructor(compilerVersion: string, projectConfig: ProjectConfig);
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FilePosition } from "#file";
|
|
2
|
+
import type { TargetResult } from "./TargetResult.js";
|
|
3
|
+
export declare class Result {
|
|
4
|
+
assertionCounts: import("./types.js").AssertionCounts;
|
|
5
|
+
fileCounts: import("./types.js").FileCounts;
|
|
6
|
+
files: Array<FilePosition>;
|
|
7
|
+
results: Array<TargetResult>;
|
|
8
|
+
suppressedCounts: import("./types.js").SuppressedCounts;
|
|
9
|
+
targetCounts: import("./types.js").TargetCounts;
|
|
10
|
+
testCounts: import("./types.js").TestCounts;
|
|
11
|
+
timing: import("./types.js").ResultTiming;
|
|
12
|
+
constructor(files: Array<FilePosition>);
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createAssertionCounts, createFileCounts, createResultTiming, createSuppressedCounts, createTargetCounts, createTestCounts, } from "./helpers.js";
|
|
2
|
+
export class Result {
|
|
3
|
+
assertionCounts = createAssertionCounts();
|
|
4
|
+
fileCounts = createFileCounts();
|
|
5
|
+
files;
|
|
6
|
+
results = [];
|
|
7
|
+
suppressedCounts = createSuppressedCounts();
|
|
8
|
+
targetCounts = createTargetCounts();
|
|
9
|
+
testCounts = createTestCounts();
|
|
10
|
+
timing = createResultTiming();
|
|
11
|
+
constructor(files) {
|
|
12
|
+
this.files = files;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var ResultStatus;
|
|
2
|
+
(function (ResultStatus) {
|
|
3
|
+
ResultStatus["Runs"] = "runs";
|
|
4
|
+
ResultStatus["Passed"] = "passed";
|
|
5
|
+
ResultStatus["Matched"] = "matched";
|
|
6
|
+
ResultStatus["Failed"] = "failed";
|
|
7
|
+
ResultStatus["Fixme"] = "fixme";
|
|
8
|
+
ResultStatus["Skipped"] = "skipped";
|
|
9
|
+
ResultStatus["Ignored"] = "ignored";
|
|
10
|
+
ResultStatus["Todo"] = "todo";
|
|
11
|
+
})(ResultStatus || (ResultStatus = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FilePosition } from "#file";
|
|
2
|
+
import type { ProjectResult } from "./ProjectResult.js";
|
|
3
|
+
import type { TargetResultStatus } from "./types.js";
|
|
4
|
+
export declare class TargetResult {
|
|
5
|
+
files: Array<FilePosition>;
|
|
6
|
+
results: Map<string | undefined, ProjectResult>;
|
|
7
|
+
status: TargetResultStatus;
|
|
8
|
+
target: string;
|
|
9
|
+
timing: import("./types.js").ResultTiming;
|
|
10
|
+
constructor(target: string, files: Array<FilePosition>);
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createResultTiming } from "./helpers.js";
|
|
2
|
+
export class TargetResult {
|
|
3
|
+
files;
|
|
4
|
+
results = new Map();
|
|
5
|
+
status = "runs";
|
|
6
|
+
target;
|
|
7
|
+
timing = createResultTiming();
|
|
8
|
+
constructor(target, files) {
|
|
9
|
+
this.target = target;
|
|
10
|
+
this.files = files;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TestTreeNode } from "#collect";
|
|
2
|
+
import type { DescribeResult } from "./DescribeResult.js";
|
|
3
|
+
import type { ExpectResult } from "./ExpectResult.js";
|
|
4
|
+
import { ResultStatus } from "./ResultStatus.enum.js";
|
|
5
|
+
export declare class TestResult {
|
|
6
|
+
assertionCounts: import("./types.js").AssertionCounts;
|
|
7
|
+
parent: DescribeResult | undefined;
|
|
8
|
+
results: Array<ExpectResult>;
|
|
9
|
+
status: ResultStatus;
|
|
10
|
+
test: TestTreeNode;
|
|
11
|
+
timing: import("./types.js").ResultTiming;
|
|
12
|
+
constructor(test: TestTreeNode, parent?: DescribeResult);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createAssertionCounts, createResultTiming } from "./helpers.js";
|
|
2
|
+
export class TestResult {
|
|
3
|
+
assertionCounts = createAssertionCounts();
|
|
4
|
+
parent;
|
|
5
|
+
results = [];
|
|
6
|
+
status = "runs";
|
|
7
|
+
test;
|
|
8
|
+
timing = createResultTiming();
|
|
9
|
+
constructor(test, parent) {
|
|
10
|
+
this.test = test;
|
|
11
|
+
this.parent = parent;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AssertionCounts, FileCounts, ResultTiming, SuppressedCounts, TargetCounts, TestCounts } from "./types.js";
|
|
2
|
+
export declare function createTargetCounts(): TargetCounts;
|
|
3
|
+
export declare function createFileCounts(): FileCounts;
|
|
4
|
+
export declare function createTestCounts(): TestCounts;
|
|
5
|
+
export declare function createAssertionCounts(): AssertionCounts;
|
|
6
|
+
export declare function createSuppressedCounts(): SuppressedCounts;
|
|
7
|
+
export declare function createResultTiming(): ResultTiming;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function createObjectFromKeys(keys, defaultValue) {
|
|
2
|
+
return Object.fromEntries(keys.map((key) => [key, defaultValue]));
|
|
3
|
+
}
|
|
4
|
+
export function createTargetCounts() {
|
|
5
|
+
return createObjectFromKeys(["failed", "passed"], 0);
|
|
6
|
+
}
|
|
7
|
+
export function createFileCounts() {
|
|
8
|
+
return createObjectFromKeys(["failed", "passed"], 0);
|
|
9
|
+
}
|
|
10
|
+
export function createTestCounts() {
|
|
11
|
+
return createObjectFromKeys(["failed", "passed", "fixme", "skipped", "todo"], 0);
|
|
12
|
+
}
|
|
13
|
+
export function createAssertionCounts() {
|
|
14
|
+
return createObjectFromKeys(["failed", "passed", "fixme", "skipped", "todo"], 0);
|
|
15
|
+
}
|
|
16
|
+
export function createSuppressedCounts() {
|
|
17
|
+
return createObjectFromKeys(["failed", "matched", "ignored"], 0);
|
|
18
|
+
}
|
|
19
|
+
export function createResultTiming() {
|
|
20
|
+
return createObjectFromKeys(["start", "end"], Number.NaN);
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { DescribeResult } from "./DescribeResult.js";
|
|
2
|
+
export { ExpectResult } from "./ExpectResult.js";
|
|
3
|
+
export { FileResult } from "./FileResult.js";
|
|
4
|
+
export { ProjectConfigKind } from "./ProjectConfigKind.enum.js";
|
|
5
|
+
export { ProjectResult } from "./ProjectResult.js";
|
|
6
|
+
export { Result } from "./Result.js";
|
|
7
|
+
export { ResultStatus } from "./ResultStatus.enum.js";
|
|
8
|
+
export { SuppressedResult } from "./SuppressedResult.js";
|
|
9
|
+
export { TargetResult } from "./TargetResult.js";
|
|
10
|
+
export { TestResult } from "./TestResult.js";
|
|
11
|
+
export type { AssertionCounts, AssertionResultStatus, FileCounts, FileResultStatus, ProjectConfig, ResultCounts, ResultTiming, SuppressedCounts, SuppressedResultStatus, TargetCounts, TargetResultStatus, TestCounts, TestResultStatus, } from "./types.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { DescribeResult } from "./DescribeResult.js";
|
|
2
|
+
export { ExpectResult } from "./ExpectResult.js";
|
|
3
|
+
export { FileResult } from "./FileResult.js";
|
|
4
|
+
export { ProjectConfigKind } from "./ProjectConfigKind.enum.js";
|
|
5
|
+
export { ProjectResult } from "./ProjectResult.js";
|
|
6
|
+
export { Result } from "./Result.js";
|
|
7
|
+
export { ResultStatus } from "./ResultStatus.enum.js";
|
|
8
|
+
export { SuppressedResult } from "./SuppressedResult.js";
|
|
9
|
+
export { TargetResult } from "./TargetResult.js";
|
|
10
|
+
export { TestResult } from "./TestResult.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ProjectConfigKind } from "./ProjectConfigKind.enum.js";
|
|
2
|
+
import type { ResultStatus } from "./ResultStatus.enum.js";
|
|
3
|
+
export type ProjectConfig = {
|
|
4
|
+
kind: ProjectConfigKind;
|
|
5
|
+
specifier: string;
|
|
6
|
+
};
|
|
7
|
+
export type TargetResultStatus = ResultStatus.Runs | ResultStatus.Passed | ResultStatus.Failed;
|
|
8
|
+
export type TargetCounts = {
|
|
9
|
+
[K in Exclude<TargetResultStatus, ResultStatus.Runs>]: number;
|
|
10
|
+
};
|
|
11
|
+
export type FileResultStatus = ResultStatus.Runs | ResultStatus.Passed | ResultStatus.Failed;
|
|
12
|
+
export type FileCounts = {
|
|
13
|
+
[K in Exclude<FileResultStatus, ResultStatus.Runs>]: number;
|
|
14
|
+
};
|
|
15
|
+
export type TestResultStatus = ResultStatus.Runs | ResultStatus.Passed | ResultStatus.Failed | ResultStatus.Skipped | ResultStatus.Fixme | ResultStatus.Todo;
|
|
16
|
+
export type TestCounts = {
|
|
17
|
+
[K in Exclude<TestResultStatus, ResultStatus.Runs>]: number;
|
|
18
|
+
};
|
|
19
|
+
export type AssertionResultStatus = ResultStatus.Runs | ResultStatus.Passed | ResultStatus.Failed | ResultStatus.Skipped | ResultStatus.Fixme | ResultStatus.Todo;
|
|
20
|
+
export type AssertionCounts = {
|
|
21
|
+
[K in Exclude<AssertionResultStatus, ResultStatus.Runs>]: number;
|
|
22
|
+
};
|
|
23
|
+
export type SuppressedResultStatus = ResultStatus.Matched | ResultStatus.Failed | ResultStatus.Ignored;
|
|
24
|
+
export type SuppressedCounts = {
|
|
25
|
+
[K in SuppressedResultStatus]: number;
|
|
26
|
+
};
|
|
27
|
+
export type ResultCounts = TargetCounts | FileCounts | TestCounts | AssertionCounts | SuppressedCounts;
|
|
28
|
+
export interface ResultTiming {
|
|
29
|
+
start: number;
|
|
30
|
+
end: number;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ResolvedConfig } from "#config";
|
|
2
|
+
import type { FilePosition } from "#file";
|
|
3
|
+
import type { CancellationToken } from "#token";
|
|
4
|
+
import type * as ts from "#typescript";
|
|
5
|
+
export declare class FileRunner {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(ts: ts.TypeScript, resolvedConfig: ResolvedConfig);
|
|
8
|
+
close(): void;
|
|
9
|
+
run(file: FilePosition, cancellationToken: CancellationToken): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { pathToFileURL } from "node:url";
|
|
2
|
+
import { CollectService } from "#collect";
|
|
3
|
+
import { Directive } from "#config";
|
|
4
|
+
import { Diagnostic } from "#diagnostic";
|
|
5
|
+
import { EventEmitter } from "#events";
|
|
6
|
+
import { FileResult } from "#result";
|
|
7
|
+
import { SuppressedService } from "#suppressed";
|
|
8
|
+
import { TextFile, TextFileService } from "#text";
|
|
9
|
+
import { Version } from "#version";
|
|
10
|
+
import { TestTreeWalker } from "./TestTreeWalker.js";
|
|
11
|
+
export class FileRunner {
|
|
12
|
+
#collectService;
|
|
13
|
+
#projectService;
|
|
14
|
+
#resolvedConfig;
|
|
15
|
+
#suppressedService = new SuppressedService();
|
|
16
|
+
#ts;
|
|
17
|
+
constructor(ts, resolvedConfig) {
|
|
18
|
+
this.#ts = ts;
|
|
19
|
+
this.#resolvedConfig = resolvedConfig;
|
|
20
|
+
this.#projectService = ts.getProjectService(resolvedConfig);
|
|
21
|
+
this.#collectService = new CollectService(ts, this.#projectService, resolvedConfig);
|
|
22
|
+
}
|
|
23
|
+
close() {
|
|
24
|
+
if ("close" in this.#projectService) {
|
|
25
|
+
this.#projectService.close();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
#onDiagnostics(diagnostics, result) {
|
|
29
|
+
EventEmitter.dispatch(["file:error", { diagnostics, result }]);
|
|
30
|
+
}
|
|
31
|
+
async run(file, cancellationToken) {
|
|
32
|
+
if (cancellationToken.isCancellationRequested()) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
this.#projectService.openFile(file.path);
|
|
36
|
+
const fileResult = new FileResult(file);
|
|
37
|
+
EventEmitter.dispatch(["file:start", { result: fileResult }]);
|
|
38
|
+
await this.#run(file, fileResult, cancellationToken);
|
|
39
|
+
EventEmitter.dispatch(["file:end", { result: fileResult }]);
|
|
40
|
+
this.#projectService.closeFile(file.path);
|
|
41
|
+
}
|
|
42
|
+
async #resolveFileFacts(file, fileResult, runModeFlags) {
|
|
43
|
+
const syntacticDiagnostics = this.#projectService.getSyntacticDiagnostics(file.path);
|
|
44
|
+
if (syntacticDiagnostics.length > 0) {
|
|
45
|
+
this.#onDiagnostics(Diagnostic.fromDiagnostics(syntacticDiagnostics), fileResult);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const semanticDiagnostics = this.#projectService.getSemanticDiagnostics(file.path);
|
|
49
|
+
const sourceFile = this.#projectService.getSourceFile(file.path);
|
|
50
|
+
const directiveRanges = Directive.getDirectiveRanges(this.#ts, sourceFile);
|
|
51
|
+
const inlineConfig = await Directive.getInlineConfig(directiveRanges);
|
|
52
|
+
if (inlineConfig?.if?.target != null && !Version.isIncluded(this.#ts.version, inlineConfig.if.target)) {
|
|
53
|
+
runModeFlags |= 2;
|
|
54
|
+
}
|
|
55
|
+
if (inlineConfig?.template) {
|
|
56
|
+
if (semanticDiagnostics.length > 0) {
|
|
57
|
+
this.#onDiagnostics(Diagnostic.fromDiagnostics(semanticDiagnostics), fileResult);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const moduleSpecifier = pathToFileURL(file.path).toString();
|
|
61
|
+
const testText = (await import(moduleSpecifier))?.default;
|
|
62
|
+
if (typeof testText !== "string") {
|
|
63
|
+
this.#onDiagnostics([Diagnostic.error("A template test file must export a string.")], fileResult);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
TextFileService.set(file.path, new TextFile(file.path, testText));
|
|
67
|
+
this.#projectService.openFile(file.path, testText);
|
|
68
|
+
return this.#resolveFileFacts(file, fileResult, runModeFlags);
|
|
69
|
+
}
|
|
70
|
+
const testTree = this.#collectService.createTestTree(sourceFile, semanticDiagnostics);
|
|
71
|
+
this.#suppressedService.match(testTree);
|
|
72
|
+
return { runModeFlags, testTree };
|
|
73
|
+
}
|
|
74
|
+
async #run(file, fileResult, cancellationToken) {
|
|
75
|
+
const facts = await this.#resolveFileFacts(file, fileResult, 0);
|
|
76
|
+
if (!facts) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (facts.testTree.diagnostics.size > 0) {
|
|
80
|
+
this.#onDiagnostics(Diagnostic.fromDiagnostics([...facts.testTree.diagnostics]), fileResult);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const onFileDiagnostics = (diagnostics) => {
|
|
84
|
+
this.#onDiagnostics(diagnostics, fileResult);
|
|
85
|
+
};
|
|
86
|
+
const testTreeWalker = new TestTreeWalker(this.#ts, facts.testTree.program, facts.testTree.checker, this.#resolvedConfig, onFileDiagnostics, {
|
|
87
|
+
cancellationToken,
|
|
88
|
+
hasOnly: facts.testTree.hasOnly,
|
|
89
|
+
position: file.position,
|
|
90
|
+
});
|
|
91
|
+
await testTreeWalker.visit(facts.testTree.children, facts.runModeFlags, undefined);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type TestTreeNode } from "#collect";
|
|
2
|
+
import { type DirectiveRange } from "#config";
|
|
3
|
+
import { Diagnostic, type DiagnosticsHandler } from "#diagnostic";
|
|
4
|
+
export declare class FixmeService {
|
|
5
|
+
#private;
|
|
6
|
+
static start(directive: DirectiveRange, owner: TestTreeNode): Promise<void>;
|
|
7
|
+
static isFixme(owner: TestTreeNode, isPass: boolean): boolean;
|
|
8
|
+
static end(directive: DirectiveRange, owner: TestTreeNode, onFileDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Directive } from "#config";
|
|
2
|
+
import { Diagnostic, DiagnosticOrigin } from "#diagnostic";
|
|
3
|
+
import { FixmeDiagnosticText } from "./FixmeDiagnosticText.js";
|
|
4
|
+
export class FixmeService {
|
|
5
|
+
static #expectRange;
|
|
6
|
+
static #range;
|
|
7
|
+
static async start(directive, owner) {
|
|
8
|
+
const inlineConfig = await Directive.getInlineConfig(directive);
|
|
9
|
+
if (inlineConfig?.fixme === true) {
|
|
10
|
+
if (owner.brand === "expect") {
|
|
11
|
+
FixmeService.#expectRange = { directive, owner, previous: FixmeService.#expectRange };
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
FixmeService.#range = { directive, owner, previous: FixmeService.#range };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
static isFixme(owner, isPass) {
|
|
19
|
+
if (owner.brand !== "expect") {
|
|
20
|
+
return owner === FixmeService.#range?.owner && FixmeService.#range.isFail === true;
|
|
21
|
+
}
|
|
22
|
+
if (owner === FixmeService.#expectRange?.owner) {
|
|
23
|
+
FixmeService.#expectRange.isFail = !isPass;
|
|
24
|
+
return !isPass;
|
|
25
|
+
}
|
|
26
|
+
if (FixmeService.#range != null) {
|
|
27
|
+
if (!isPass) {
|
|
28
|
+
FixmeService.#range.isFail = true;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
FixmeService.#range.isFail ??= false;
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
static end(directive, owner, onFileDiagnostics) {
|
|
36
|
+
let isFail;
|
|
37
|
+
if (owner === FixmeService.#expectRange?.owner) {
|
|
38
|
+
isFail = FixmeService.#expectRange.isFail;
|
|
39
|
+
FixmeService.#expectRange = FixmeService.#expectRange.previous;
|
|
40
|
+
}
|
|
41
|
+
if (owner === FixmeService.#range?.owner) {
|
|
42
|
+
isFail = FixmeService.#range.isFail;
|
|
43
|
+
FixmeService.#range = FixmeService.#range.previous;
|
|
44
|
+
}
|
|
45
|
+
if (isFail === false) {
|
|
46
|
+
const text = [FixmeDiagnosticText.wasSupposedToFail(owner.brand), FixmeDiagnosticText.considerRemoving()];
|
|
47
|
+
const origin = new DiagnosticOrigin(directive.namespace.start, directive.directive.end, directive.file);
|
|
48
|
+
onFileDiagnostics([Diagnostic.error(text, origin)]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|