@kernlang/test 3.4.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/LICENSE +678 -0
- package/README.md +142 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.js +216 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.js +3011 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# @kernlang/test
|
|
2
|
+
|
|
3
|
+
Native KERN structural test runner.
|
|
4
|
+
|
|
5
|
+
Use it for KERN-level invariants that should be checked before generated code exists:
|
|
6
|
+
|
|
7
|
+
- machine reachability and transition hygiene
|
|
8
|
+
- derive graph cycles
|
|
9
|
+
- guard exhaustiveness and guard configuration
|
|
10
|
+
- API/MCP route and parameter safety
|
|
11
|
+
- unguarded effects and async recovery debt
|
|
12
|
+
|
|
13
|
+
## CLI
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
kern-test path/to/order.test.kern
|
|
17
|
+
kern-test path/to/tests --json
|
|
18
|
+
kern test path/to/order.test.kern
|
|
19
|
+
kern test path/to/tests
|
|
20
|
+
kern test path/to/tests --json
|
|
21
|
+
kern test path/to/tests --grep Order
|
|
22
|
+
kern test path/to/tests --bail
|
|
23
|
+
kern test path/to/tests --watch
|
|
24
|
+
kern test path/to/tests --format compact
|
|
25
|
+
kern test path/to/tests --coverage
|
|
26
|
+
kern test path/to/tests --min-coverage 80
|
|
27
|
+
kern test path/to/tests --max-warnings 4
|
|
28
|
+
kern test path/to/tests --write-baseline kern-test-baseline.json
|
|
29
|
+
kern test path/to/tests --baseline kern-test-baseline.json
|
|
30
|
+
kern test --list-rules
|
|
31
|
+
kern test --explain-rule no:unguardedEffects
|
|
32
|
+
kern test path/to/tests --pass-with-no-tests
|
|
33
|
+
kern test path/to/tests --fail-on-warn
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`kern-test` is the standalone binary shipped by `@kernlang/test`. `kern test` is the integrated command from `@kernlang/cli`; it supports the same native runner flags plus `--watch` and the legacy MCP Jest generator fallback. Single-file `kern test <file.kern>` inputs keep that legacy generator behavior when the file has no native `test` nodes. Directory inputs discover `.kern` files that contain native `test` nodes and run them as one aggregate suite. This repo's `examples/native-test` directory includes machine, MCP safety, permission-gated tool, runtime-function, and language-surface smoke tests for arrays, classes, and functions.
|
|
37
|
+
|
|
38
|
+
## KERN Syntax
|
|
39
|
+
|
|
40
|
+
```kern
|
|
41
|
+
test name="Order invariants" target="./order.kern"
|
|
42
|
+
it name="reaches paid"
|
|
43
|
+
expect machine=Order reaches=paid via=confirm,capture
|
|
44
|
+
expect machine=Order from=confirmed reaches=paid via=capture maxSteps=1
|
|
45
|
+
expect machine=Order transition=capture from=confirmed to=paid guarded=true
|
|
46
|
+
|
|
47
|
+
it name="machine stays healthy"
|
|
48
|
+
expect preset=machine
|
|
49
|
+
|
|
50
|
+
it name="known migration debt stays visible"
|
|
51
|
+
expect no=deadStates severity=warn
|
|
52
|
+
|
|
53
|
+
it name="target still reaches core codegen"
|
|
54
|
+
expect no=codegenErrors
|
|
55
|
+
|
|
56
|
+
it name="KERN declaration shape stays stable"
|
|
57
|
+
expect node=interface name=Order child=field count=3
|
|
58
|
+
expect node=field name=status within=Order prop=type is=OrderState
|
|
59
|
+
|
|
60
|
+
it name="computed constants stay sane"
|
|
61
|
+
expect expr={{MAX_RETRIES > 0 && statuses.includes("paid")}}
|
|
62
|
+
expect expr={{MAX_RETRIES}} equals=3
|
|
63
|
+
expect expr={{status}} matches="^paid$"
|
|
64
|
+
expect expr={{JSON.parse("not-json")}} throws=SyntaxError
|
|
65
|
+
|
|
66
|
+
it name="order behavior is stable"
|
|
67
|
+
fixture name=paidOrder value={{({ items: [{ price: 20, qty: 2 }, { price: 5, qty: 1 }] })}}
|
|
68
|
+
fixture name=taxRate value=0.2
|
|
69
|
+
expect fn=orderSubtotal with=paidOrder equals=45
|
|
70
|
+
expect fn=addTax args={{[orderSubtotal(paidOrder), taxRate]}} equals=54
|
|
71
|
+
expect derive=total equals=54
|
|
72
|
+
|
|
73
|
+
it name="suite covers target surface"
|
|
74
|
+
expect preset=coverage
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Presets expand into granular checks:
|
|
78
|
+
|
|
79
|
+
- `machine`: `deadStates`, `duplicateTransitions`
|
|
80
|
+
- `guard`: `invalidGuards`, `weakGuards`, `nonExhaustiveGuards`
|
|
81
|
+
- `coverage`: `untestedTransitions`, `untestedGuards`
|
|
82
|
+
- `apiSafety`: `duplicateRoutes`, `emptyRoutes`, `unvalidatedRoutes`, `unguardedEffects`, `uncheckedRoutePathParams`
|
|
83
|
+
- `mcpSafety`: `duplicateParams`, `invalidGuards`, `unguardedToolParams`, `missingPathGuards`, `ssrfRisks`
|
|
84
|
+
- `effects`: `unguardedEffects`, `sensitiveEffectsRequireAuth`, `effectWithoutCleanup`, `unrecoveredAsync`
|
|
85
|
+
- `strict`: broad structural safety sweep
|
|
86
|
+
|
|
87
|
+
Use `no=codegenErrors` as a smoke check when a suite should prove that valid KERN still reaches core code generation. It catches generator exceptions that parse/schema/semantic validation can miss.
|
|
88
|
+
|
|
89
|
+
Use `expect machine=<Name> transition=<Transition>` for direct machine-edge assertions. Add `from=`, `to=`, and `guarded=true|false` when the transition contract matters independently from a full path. Reachability assertions can also start at a non-initial state with `from=`, require states with `through=`, forbid states with `avoid=`/`avoids=`, and cap path length with `maxSteps=`.
|
|
90
|
+
|
|
91
|
+
Use `expect node=<type>` for KERN-native shape assertions over the target IR. Add `name=<name>` to narrow the node, `within=<ancestor-name-or-type>` to scope it under a parent declaration, `child=<type>` plus optional `childName=<name>` to assert direct children, `count=<n>` to assert cardinality, and `prop=<prop> is=<value>` to assert a KERN prop value. This is the preferred assertion when the invariant is about KERN declarations themselves, for example an interface field, machine state, class method, route param, or guard node.
|
|
92
|
+
|
|
93
|
+
Use `no=nonExhaustiveGuards` to scan target-side variant guards that declare `covers=...`, `over=<Union>`, or `union=<Union>`. This is useful when Guard/Sight should catch a newly-added union variant before any backend compiler runs. Use `no=emptyRoutes` when route declarations must carry executable behavior through `handler`, `respond`, `derive`, `fmt`, `branch`, `each`, `collect`, or `effect`.
|
|
94
|
+
|
|
95
|
+
Use `expect expr={{...}}` for small runtime assertions over referenced target-side `const`, `derive`, `let`, and pure `fn` bindings. Runtime `fn` handlers may use local statements, `if`, `return`, `throw`, and `async=true`/`await` over sandboxed values. Without a comparator, the expression must evaluate truthy. Add `equals=...` for deep equality, `matches="..."` for string/regex checks, or `throws=ErrorName` for expected exceptions.
|
|
96
|
+
|
|
97
|
+
Use `fixture name=<id> value={{...}}` or `fixture name=<id> expr={{...}}` to define scoped runtime data inside `test`, `describe`, or `it`. Fixtures are visible to descendant assertions and do not leak into sibling cases.
|
|
98
|
+
|
|
99
|
+
Use `expect fn=<name>` when the target KERN `fn` itself is the behavior under test. Add `with=<fixture-or-expression>` to pass one argument, or `args={{[...]}}` to spread an argument array into the function. Use `expect derive=<name>` to execute a target-side `derive` binding through the same runtime evaluator. Behavioral assertions support the same `equals=...`, `matches="..."`, and `throws=ErrorName` comparators as `expect expr={{...}}`. Failed behavior assertions report the generated call expression and fixture names so CI output points back to the KERN-native setup.
|
|
100
|
+
|
|
101
|
+
Runtime assertions intentionally do not execute arbitrary application code. Multi-statement expressions and unsafe globals such as `process`, `require`, `eval`, `Function`, `fetch`, timers, and `WebSocket` are rejected before execution.
|
|
102
|
+
|
|
103
|
+
Use `preset=coverage` when Guard/Sight need a native signal for untested KERN surface. Machine transition coverage is driven by explicit `via=...` reachability assertions. Guard coverage passes when guards have explicit `expect guard=<name> exhaustive=true` assertions or a guard-wide assertion such as `expect preset=guard`.
|
|
104
|
+
|
|
105
|
+
Native effect checks follow same-file helper `fn` calls before classifying dangerous work, so a route/tool that calls `readSecret()` still gets flagged when `readSecret()` performs filesystem, database, network, shell, or email effects. They also recognize inline CLI permission gates shaped like a `checkPermission` function returning a `PermissionDecision` and returned from a tool factory. That lets KERN test AGON-style tool factories without forcing every permission check into a separate `guard` node.
|
|
106
|
+
|
|
107
|
+
Use `--coverage` to print native transition/guard coverage. Use `--min-coverage <pct>` to fail CI when combined machine-transition and guard coverage drops below the threshold. JSON summaries always include the same `coverage` object.
|
|
108
|
+
|
|
109
|
+
Use `severity=warn` for known migration debt that should stay visible without failing local runs. CI can promote warnings to failures with `kern test <file-or-dir> --fail-on-warn`.
|
|
110
|
+
|
|
111
|
+
Use `--grep <pattern>` to run only matching suites, cases, assertions, rule IDs, messages, or files. The CLI exits nonzero when a grep run matches zero assertions. Use `--bail` to stop after the first failed native assertion.
|
|
112
|
+
|
|
113
|
+
Use `--watch` during development to rerun native KERN tests when watched `.kern` files change. Directory inputs watch every `.kern` file under the directory. Single native test files watch the test file plus its current target files.
|
|
114
|
+
|
|
115
|
+
Use `--format compact` (or `--compact`) in CI when you only want the aggregate line plus warning/failure details. JSON output is unchanged by format flags.
|
|
116
|
+
|
|
117
|
+
Use `--max-warnings <n>` to enforce a warning budget during adoption. `--fail-on-warn` is equivalent to a zero-warning budget.
|
|
118
|
+
|
|
119
|
+
Use `--write-baseline <file>` to snapshot current warning debt, then `--baseline <file>` in CI to fail when warnings are added or removed. Baseline entries key on suite, case, rule ID, assertion, and message, not line number, so moving tests does not churn the file.
|
|
120
|
+
|
|
121
|
+
Use `--pass-with-no-tests` when wiring native tests into a repo before every package has `.test.kern` coverage. Without it, an empty native test run fails so missing tests stay visible.
|
|
122
|
+
|
|
123
|
+
Text and JSON results include stable `ruleId` values such as `machine:reaches`, `guard:exhaustive`, and `no:deadstates`. Guard and Sight should key off those IDs instead of display messages.
|
|
124
|
+
|
|
125
|
+
Use `--list-rules` and `--explain-rule <rule>` to inspect the native rule IDs that appear in text, JSON, and baselines.
|
|
126
|
+
|
|
127
|
+
## Library API
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import {
|
|
131
|
+
discoverNativeKernTestFiles,
|
|
132
|
+
formatNativeKernTestCoverage,
|
|
133
|
+
formatNativeKernTestRunSummary,
|
|
134
|
+
runNativeKernTestRun,
|
|
135
|
+
runNativeKernTests,
|
|
136
|
+
} from '@kernlang/test';
|
|
137
|
+
|
|
138
|
+
const fileSummary = runNativeKernTests('order.test.kern', { grep: 'Order', bail: true });
|
|
139
|
+
const runSummary = runNativeKernTestRun('examples/native-test', { grep: /coverage|guard/i });
|
|
140
|
+
console.log(formatNativeKernTestRunSummary(runSummary));
|
|
141
|
+
console.log(formatNativeKernTestCoverage(runSummary.coverage));
|
|
142
|
+
```
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, readFileSync, statSync, writeFileSync } from 'fs';
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { checkNativeKernTestBaseline, createNativeKernTestBaseline, explainNativeKernTestRule, formatNativeKernTestCoverage, formatNativeKernTestRunSummary, formatNativeKernTestSummary, listNativeKernTestRules, runNativeKernTestRun, runNativeKernTests, } from './index.js';
|
|
6
|
+
const VALUE_FLAGS = new Set([
|
|
7
|
+
'--baseline',
|
|
8
|
+
'--explain-rule',
|
|
9
|
+
'--format',
|
|
10
|
+
'--grep',
|
|
11
|
+
'--max-warnings',
|
|
12
|
+
'--min-coverage',
|
|
13
|
+
'--write-baseline',
|
|
14
|
+
]);
|
|
15
|
+
function hasFlag(args, ...flags) {
|
|
16
|
+
return args.some((arg) => flags.includes(arg));
|
|
17
|
+
}
|
|
18
|
+
function hasValueFlag(args, flag) {
|
|
19
|
+
return args.includes(flag) || args.some((arg) => arg.startsWith(`${flag}=`));
|
|
20
|
+
}
|
|
21
|
+
function parseValueFlag(args, flag) {
|
|
22
|
+
const eqArg = args.find((arg) => arg.startsWith(`${flag}=`));
|
|
23
|
+
if (eqArg)
|
|
24
|
+
return eqArg.slice(flag.length + 1);
|
|
25
|
+
const index = args.indexOf(flag);
|
|
26
|
+
if (index === -1)
|
|
27
|
+
return undefined;
|
|
28
|
+
const next = args[index + 1];
|
|
29
|
+
if (!next || next.startsWith('--'))
|
|
30
|
+
return '';
|
|
31
|
+
return next;
|
|
32
|
+
}
|
|
33
|
+
function firstPositionalArg(args) {
|
|
34
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
35
|
+
const arg = args[i];
|
|
36
|
+
if (arg.startsWith('--')) {
|
|
37
|
+
if (!arg.includes('=') && VALUE_FLAGS.has(arg))
|
|
38
|
+
i += 1;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
return arg;
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
function requireValueFlag(args, flag, description, io) {
|
|
46
|
+
if (!hasValueFlag(args, flag))
|
|
47
|
+
return undefined;
|
|
48
|
+
const value = parseValueFlag(args, flag);
|
|
49
|
+
if (!value) {
|
|
50
|
+
io.stderr.write(`${flag} requires ${description}.\n`);
|
|
51
|
+
throw new Error('usage');
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
function loadNativeBaseline(path) {
|
|
56
|
+
const parsed = JSON.parse(readFileSync(path, 'utf-8'));
|
|
57
|
+
if (parsed.version !== 1 || !Array.isArray(parsed.warnings)) {
|
|
58
|
+
throw new Error('expected { "version": 1, "warnings": [...] }');
|
|
59
|
+
}
|
|
60
|
+
return parsed;
|
|
61
|
+
}
|
|
62
|
+
function isNativeRunSummary(summary) {
|
|
63
|
+
return 'files' in summary;
|
|
64
|
+
}
|
|
65
|
+
function usage() {
|
|
66
|
+
return [
|
|
67
|
+
'Usage: kern-test <file-or-dir> [--json] [--grep <pattern>] [--bail] [--fail-on-warn]',
|
|
68
|
+
' [--max-warnings <n>] [--coverage] [--min-coverage <pct>]',
|
|
69
|
+
' [--baseline <file>] [--write-baseline <file>] [--pass-with-no-tests]',
|
|
70
|
+
' [--format compact] [--compact] [--list-rules] [--explain-rule <rule>]',
|
|
71
|
+
].join('\n');
|
|
72
|
+
}
|
|
73
|
+
function handleNativeBaseline(summary, opts, io) {
|
|
74
|
+
let failed = false;
|
|
75
|
+
if (opts.writeBaselinePath) {
|
|
76
|
+
writeFileSync(opts.writeBaselinePath, `${JSON.stringify(createNativeKernTestBaseline(summary), null, 2)}\n`);
|
|
77
|
+
}
|
|
78
|
+
if (opts.baselinePath) {
|
|
79
|
+
const check = checkNativeKernTestBaseline(summary, loadNativeBaseline(opts.baselinePath));
|
|
80
|
+
if (!check.ok) {
|
|
81
|
+
failed = true;
|
|
82
|
+
for (const warning of check.newWarnings) {
|
|
83
|
+
io.stderr.write(`New native warning: ${warning.suite} > ${warning.caseName}: ${warning.assertion} [${warning.ruleId}]${warning.message ? ` - ${warning.message}` : ''}\n`);
|
|
84
|
+
}
|
|
85
|
+
for (const warning of check.staleWarnings) {
|
|
86
|
+
io.stderr.write(`Stale native warning baseline: ${warning.suite} > ${warning.caseName}: ${warning.assertion} [${warning.ruleId}]${warning.message ? ` - ${warning.message}` : ''}\n`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return failed;
|
|
91
|
+
}
|
|
92
|
+
function reportNativeSummary(summary, options, io) {
|
|
93
|
+
io.stdout.write(options.json
|
|
94
|
+
? `${JSON.stringify(summary, null, 2)}\n`
|
|
95
|
+
: isNativeRunSummary(summary)
|
|
96
|
+
? formatNativeKernTestRunSummary(summary, options.compact ? { format: 'compact' } : undefined)
|
|
97
|
+
: formatNativeKernTestSummary(summary, options.compact ? { format: 'compact' } : undefined));
|
|
98
|
+
if (options.coverage && !options.json)
|
|
99
|
+
io.stdout.write(formatNativeKernTestCoverage(summary.coverage));
|
|
100
|
+
const baselineFailed = handleNativeBaseline(summary, { baselinePath: options.baselinePath, writeBaselinePath: options.writeBaselinePath }, io);
|
|
101
|
+
const coverageFailed = options.minCoverage !== undefined && summary.coverage.percent < options.minCoverage;
|
|
102
|
+
if (coverageFailed) {
|
|
103
|
+
io.stderr.write(`Native coverage ${summary.coverage.percent}% is below --min-coverage ${options.minCoverage}%.\n`);
|
|
104
|
+
}
|
|
105
|
+
const grepMatchedNothing = Boolean(options.grep) &&
|
|
106
|
+
summary.total === 0 &&
|
|
107
|
+
!options.passWithNoTests &&
|
|
108
|
+
(!isNativeRunSummary(summary) || summary.files.length > 0);
|
|
109
|
+
const failed = summary.failed > 0 ||
|
|
110
|
+
baselineFailed ||
|
|
111
|
+
coverageFailed ||
|
|
112
|
+
(options.failOnWarn && summary.warnings > 0) ||
|
|
113
|
+
(options.maxWarnings !== undefined && summary.warnings > options.maxWarnings) ||
|
|
114
|
+
grepMatchedNothing;
|
|
115
|
+
return failed ? 1 : 0;
|
|
116
|
+
}
|
|
117
|
+
export function runNativeKernTestCli(args = process.argv.slice(2), io = { stdout: process.stdout, stderr: process.stderr }) {
|
|
118
|
+
try {
|
|
119
|
+
const json = hasFlag(args, '--json');
|
|
120
|
+
const listRules = hasFlag(args, '--list-rules');
|
|
121
|
+
const help = hasFlag(args, '--help', '-h');
|
|
122
|
+
if (help) {
|
|
123
|
+
io.stdout.write(`${usage()}\n`);
|
|
124
|
+
return 0;
|
|
125
|
+
}
|
|
126
|
+
if (listRules) {
|
|
127
|
+
const rules = listNativeKernTestRules();
|
|
128
|
+
io.stdout.write(json
|
|
129
|
+
? `${JSON.stringify(rules, null, 2)}\n`
|
|
130
|
+
: `${rules.map((rule) => `${rule.ruleId} - ${rule.description}`).join('\n')}\n`);
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
const explainRule = requireValueFlag(args, '--explain-rule', 'a rule ID', io);
|
|
134
|
+
if (explainRule) {
|
|
135
|
+
const rule = explainNativeKernTestRule(explainRule);
|
|
136
|
+
if (!rule) {
|
|
137
|
+
io.stderr.write(`Unknown native test rule: ${explainRule}\n`);
|
|
138
|
+
return 2;
|
|
139
|
+
}
|
|
140
|
+
io.stdout.write(json
|
|
141
|
+
? `${JSON.stringify(rule, null, 2)}\n`
|
|
142
|
+
: `${rule.ruleId}\n${rule.description}${rule.presets?.length ? `\nPresets: ${rule.presets.join(', ')}` : ''}\n`);
|
|
143
|
+
return 0;
|
|
144
|
+
}
|
|
145
|
+
const input = firstPositionalArg(args);
|
|
146
|
+
if (!input) {
|
|
147
|
+
io.stderr.write(`${usage()}\n`);
|
|
148
|
+
return 1;
|
|
149
|
+
}
|
|
150
|
+
const grepFlagPresent = hasValueFlag(args, '--grep');
|
|
151
|
+
const grep = requireValueFlag(args, '--grep', 'a pattern', io);
|
|
152
|
+
const formatFlagPresent = hasValueFlag(args, '--format');
|
|
153
|
+
const requestedFormat = requireValueFlag(args, '--format', '"default" or "compact"', io);
|
|
154
|
+
const compact = hasFlag(args, '--compact') || requestedFormat === 'compact';
|
|
155
|
+
const maxWarningsRaw = requireValueFlag(args, '--max-warnings', 'a non-negative integer', io);
|
|
156
|
+
const minCoverageRaw = requireValueFlag(args, '--min-coverage', 'a percentage from 0 to 100', io);
|
|
157
|
+
const baselinePath = requireValueFlag(args, '--baseline', 'a file path', io);
|
|
158
|
+
const writeBaselinePath = requireValueFlag(args, '--write-baseline', 'a file path', io);
|
|
159
|
+
const maxWarnings = maxWarningsRaw === undefined ? undefined : Number(maxWarningsRaw);
|
|
160
|
+
const minCoverage = minCoverageRaw === undefined ? undefined : Number(minCoverageRaw);
|
|
161
|
+
if (grepFlagPresent && !grep) {
|
|
162
|
+
io.stderr.write('--grep requires a pattern.\n');
|
|
163
|
+
return 2;
|
|
164
|
+
}
|
|
165
|
+
if (formatFlagPresent && requestedFormat !== 'default' && requestedFormat !== 'compact') {
|
|
166
|
+
io.stderr.write('--format must be "default" or "compact".\n');
|
|
167
|
+
return 2;
|
|
168
|
+
}
|
|
169
|
+
if (maxWarnings !== undefined && (!Number.isInteger(maxWarnings) || maxWarnings < 0)) {
|
|
170
|
+
io.stderr.write('--max-warnings requires a non-negative integer.\n');
|
|
171
|
+
return 2;
|
|
172
|
+
}
|
|
173
|
+
if (minCoverage !== undefined && (Number.isNaN(minCoverage) || minCoverage < 0 || minCoverage > 100)) {
|
|
174
|
+
io.stderr.write('--min-coverage requires a percentage from 0 to 100.\n');
|
|
175
|
+
return 2;
|
|
176
|
+
}
|
|
177
|
+
if (baselinePath && writeBaselinePath) {
|
|
178
|
+
io.stderr.write('--baseline and --write-baseline cannot be used together.\n');
|
|
179
|
+
return 2;
|
|
180
|
+
}
|
|
181
|
+
const inputPath = resolve(input);
|
|
182
|
+
if (!existsSync(inputPath)) {
|
|
183
|
+
io.stderr.write(`Not found: ${input}\n`);
|
|
184
|
+
return 1;
|
|
185
|
+
}
|
|
186
|
+
const options = {
|
|
187
|
+
json,
|
|
188
|
+
compact,
|
|
189
|
+
coverage: hasFlag(args, '--coverage') || minCoverageRaw !== undefined,
|
|
190
|
+
baselinePath,
|
|
191
|
+
writeBaselinePath,
|
|
192
|
+
minCoverage,
|
|
193
|
+
failOnWarn: hasFlag(args, '--fail-on-warn'),
|
|
194
|
+
maxWarnings,
|
|
195
|
+
grep,
|
|
196
|
+
bail: hasFlag(args, '--bail'),
|
|
197
|
+
passWithNoTests: hasFlag(args, '--pass-with-no-tests'),
|
|
198
|
+
};
|
|
199
|
+
const stat = statSync(inputPath);
|
|
200
|
+
const summary = stat.isDirectory()
|
|
201
|
+
? runNativeKernTestRun(inputPath, options)
|
|
202
|
+
: runNativeKernTests(inputPath, options);
|
|
203
|
+
return reportNativeSummary(summary, options, io);
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
if (error instanceof Error && error.message === 'usage')
|
|
207
|
+
return 2;
|
|
208
|
+
io.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
209
|
+
return 2;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
const isEntrypoint = process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
213
|
+
if (isEntrypoint) {
|
|
214
|
+
process.exitCode = runNativeKernTestC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K,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/E,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpG,IAAI,YAAY,EAAE,CAAC;IACjB,OAAO,CAAC,QAAQ,GAAG,oBAAoB,EAAE,CAAC;AAC5C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export type NativeKernTestStatus = 'passed' | 'failed' | 'warning';
|
|
2
|
+
export type NativeKernTestSeverity = 'error' | 'warn';
|
|
3
|
+
export interface NativeKernTestResult {
|
|
4
|
+
suite: string;
|
|
5
|
+
caseName: string;
|
|
6
|
+
ruleId: string;
|
|
7
|
+
assertion: string;
|
|
8
|
+
severity: NativeKernTestSeverity;
|
|
9
|
+
status: NativeKernTestStatus;
|
|
10
|
+
message?: string;
|
|
11
|
+
file?: string;
|
|
12
|
+
line?: number;
|
|
13
|
+
col?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface NativeKernTestCoverageMetric {
|
|
16
|
+
total: number;
|
|
17
|
+
covered: number;
|
|
18
|
+
percent: number;
|
|
19
|
+
uncovered: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface NativeKernTestCoverageTarget {
|
|
22
|
+
file: string;
|
|
23
|
+
transitions: NativeKernTestCoverageMetric;
|
|
24
|
+
guards: NativeKernTestCoverageMetric;
|
|
25
|
+
}
|
|
26
|
+
export interface NativeKernTestCoverageSummary {
|
|
27
|
+
total: number;
|
|
28
|
+
covered: number;
|
|
29
|
+
percent: number;
|
|
30
|
+
transitions: NativeKernTestCoverageMetric;
|
|
31
|
+
guards: NativeKernTestCoverageMetric;
|
|
32
|
+
targets: NativeKernTestCoverageTarget[];
|
|
33
|
+
}
|
|
34
|
+
export interface NativeKernTestSummary {
|
|
35
|
+
file: string;
|
|
36
|
+
targetFiles: string[];
|
|
37
|
+
total: number;
|
|
38
|
+
passed: number;
|
|
39
|
+
warnings: number;
|
|
40
|
+
failed: number;
|
|
41
|
+
results: NativeKernTestResult[];
|
|
42
|
+
coverage: NativeKernTestCoverageSummary;
|
|
43
|
+
}
|
|
44
|
+
export interface NativeKernTestRunSummary {
|
|
45
|
+
input: string;
|
|
46
|
+
testFiles: string[];
|
|
47
|
+
targetFiles: string[];
|
|
48
|
+
total: number;
|
|
49
|
+
passed: number;
|
|
50
|
+
warnings: number;
|
|
51
|
+
failed: number;
|
|
52
|
+
files: NativeKernTestSummary[];
|
|
53
|
+
coverage: NativeKernTestCoverageSummary;
|
|
54
|
+
}
|
|
55
|
+
export interface NativeKernTestBaselineEntry {
|
|
56
|
+
suite: string;
|
|
57
|
+
caseName: string;
|
|
58
|
+
ruleId: string;
|
|
59
|
+
assertion: string;
|
|
60
|
+
signature?: string;
|
|
61
|
+
message?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface NativeKernTestBaseline {
|
|
64
|
+
version: 1;
|
|
65
|
+
warnings: NativeKernTestBaselineEntry[];
|
|
66
|
+
}
|
|
67
|
+
export interface NativeKernTestBaselineCheck {
|
|
68
|
+
ok: boolean;
|
|
69
|
+
knownWarnings: NativeKernTestBaselineEntry[];
|
|
70
|
+
newWarnings: NativeKernTestBaselineEntry[];
|
|
71
|
+
staleWarnings: NativeKernTestBaselineEntry[];
|
|
72
|
+
}
|
|
73
|
+
export interface NativeKernTestOptions {
|
|
74
|
+
grep?: string | RegExp;
|
|
75
|
+
bail?: boolean;
|
|
76
|
+
passWithNoTests?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export type NativeKernTestFormat = 'default' | 'compact';
|
|
79
|
+
export interface NativeKernTestFormatOptions {
|
|
80
|
+
format?: NativeKernTestFormat;
|
|
81
|
+
}
|
|
82
|
+
export interface NativeKernTestRule {
|
|
83
|
+
ruleId: string;
|
|
84
|
+
description: string;
|
|
85
|
+
presets?: string[];
|
|
86
|
+
}
|
|
87
|
+
export declare function listNativeKernTestRules(): NativeKernTestRule[];
|
|
88
|
+
export declare function explainNativeKernTestRule(ruleId: string): NativeKernTestRule | undefined;
|
|
89
|
+
export declare function hasNativeKernTests(source: string): boolean;
|
|
90
|
+
export declare function discoverNativeKernTestFiles(input: string): string[];
|
|
91
|
+
export declare function runNativeKernTests(file: string, options?: NativeKernTestOptions): NativeKernTestSummary;
|
|
92
|
+
export declare function runNativeKernTestRun(input: string, options?: NativeKernTestOptions): NativeKernTestRunSummary;
|
|
93
|
+
export declare function createNativeKernTestBaseline(summary: NativeKernTestSummary | NativeKernTestRunSummary): NativeKernTestBaseline;
|
|
94
|
+
export declare function checkNativeKernTestBaseline(summary: NativeKernTestSummary | NativeKernTestRunSummary, baseline: NativeKernTestBaseline): NativeKernTestBaselineCheck;
|
|
95
|
+
export declare function formatNativeKernTestCoverage(coverage: NativeKernTestCoverageSummary): string;
|
|
96
|
+
export declare function formatNativeKernTestSummary(summary: NativeKernTestSummary, options?: NativeKernTestFormatOptions): string;
|
|
97
|
+
export declare function formatNativeKernTestRunSummary(summary: NativeKernTestRunSummary, options?: NativeKernTestFormatOptions): string;
|