@flint.fyi/rule-tester 0.19.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +10 -23
- package/dist/index.mjs +4 -2
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AnyOptionalSchema, AnyRule, InferredInputObject, RuleAbout } from "@flint.fyi/core";
|
|
2
|
-
|
|
3
2
|
//#region src/types.d.ts
|
|
4
3
|
interface InvalidTestCase<Options extends object | undefined = object | undefined> extends TestCase<Options> {
|
|
5
4
|
output?: string;
|
|
@@ -12,17 +11,17 @@ interface TestCase<Options extends object | undefined = object | undefined> {
|
|
|
12
11
|
files?: Record<string, string> | undefined;
|
|
13
12
|
name?: string | undefined;
|
|
14
13
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
* Run only this test case. Useful for debugging.
|
|
15
|
+
*
|
|
16
|
+
* Do not commit code with this flag set.
|
|
17
|
+
*/
|
|
19
18
|
only?: boolean;
|
|
20
19
|
options?: Options | undefined;
|
|
21
20
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
* Skip running this test case. Useful for work-in-progress tests.
|
|
22
|
+
*
|
|
23
|
+
* Do not commit code with this flag set.
|
|
24
|
+
*/
|
|
26
25
|
skip?: boolean;
|
|
27
26
|
}
|
|
28
27
|
type TestSuggestion = TestSuggestionForFile | TestSuggestionForFiles;
|
|
@@ -64,20 +63,8 @@ type TesterSetupDescribe = (description: string, setup: () => void) => void;
|
|
|
64
63
|
type TesterSetupIt = (description: string, setup: () => Promise<void>) => void;
|
|
65
64
|
declare class RuleTester {
|
|
66
65
|
#private;
|
|
67
|
-
constructor({
|
|
68
|
-
|
|
69
|
-
defaults,
|
|
70
|
-
describe,
|
|
71
|
-
diskBackedFSRoot,
|
|
72
|
-
it,
|
|
73
|
-
only,
|
|
74
|
-
scope,
|
|
75
|
-
skip
|
|
76
|
-
}?: RuleTesterOptions);
|
|
77
|
-
describe<OptionsSchema extends AnyOptionalSchema | undefined>(rule: AnyRule<RuleAbout, OptionsSchema>, {
|
|
78
|
-
invalid,
|
|
79
|
-
valid
|
|
80
|
-
}: TestCases<InferredInputObject<OptionsSchema>>): void;
|
|
66
|
+
constructor({ assertNoLanguageReports, defaults, describe, diskBackedFSRoot, it, only, scope, skip }?: RuleTesterOptions);
|
|
67
|
+
describe<OptionsSchema extends AnyOptionalSchema | undefined>(rule: AnyRule<RuleAbout, OptionsSchema>, { invalid, valid }: TestCases<InferredInputObject<OptionsSchema>>): void;
|
|
81
68
|
}
|
|
82
69
|
//#endregion
|
|
83
70
|
export { type InvalidTestCase, RuleTester, type TestCase, type TestSuggestion, type TestSuggestionFileCase, type TestSuggestionForFile, type TestSuggestionForFiles, type ValidTestCase, type ValidTestCaseObject };
|
package/dist/index.mjs
CHANGED
|
@@ -219,8 +219,10 @@ var RuleTester = class {
|
|
|
219
219
|
}
|
|
220
220
|
#itTestCase(testCase, setup) {
|
|
221
221
|
let test = testCase.only ? this.#testerOptions.only : this.#testerOptions.it;
|
|
222
|
-
if (testCase.skip)
|
|
223
|
-
|
|
222
|
+
if (testCase.skip) {
|
|
223
|
+
if ("skip" in test && typeof test.skip === "function") test = test.skip;
|
|
224
|
+
else test = this.#testerOptions.skip;
|
|
225
|
+
}
|
|
224
226
|
test(testCase.name ?? ("files" in testCase ? JSON.stringify({
|
|
225
227
|
[testCase.fileName]: testCase.code,
|
|
226
228
|
...testCase.files
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flint.fyi/rule-tester",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "[Experimental] Rule unit tests for Flint.",
|
|
5
5
|
"homepage": "https://flint.fyi",
|
|
6
6
|
"repository": {
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"dist/"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"
|
|
26
|
-
"@flint.fyi/
|
|
27
|
-
"
|
|
25
|
+
"@flint.fyi/core": "^0.26.0",
|
|
26
|
+
"@flint.fyi/utils": "^0.16.0",
|
|
27
|
+
"cached-factory": "^0.3.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
30
|
+
"@flint.fyi/build": "^0.1.0",
|
|
31
|
+
"tsdown": "0.22.14",
|
|
32
|
+
"vitest": "4.1.11"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=26.1.0"
|