@telorun/assert 0.1.11 → 0.2.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 +5 -0
- package/dist/manifest.d.ts +1 -0
- package/dist/manifest.js +24 -5
- package/package.json +3 -3
- package/src/manifest.ts +30 -5
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Telo: YAML-driven execution engine for declarative backends with micro-kernel architecture and language-agnostic design"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# ⚡ Telo
|
|
2
6
|
|
|
3
7
|
Runtime for declarative backends.
|
|
@@ -73,6 +77,7 @@ connection:
|
|
|
73
77
|
kind: Sql.Migration
|
|
74
78
|
metadata:
|
|
75
79
|
name: Migration_20260413_182154_CreateFeedback
|
|
80
|
+
version: 20260413_182154_CreateFeedback
|
|
76
81
|
sql: |
|
|
77
82
|
CREATE TABLE IF NOT EXISTS feedback (
|
|
78
83
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
package/dist/manifest.d.ts
CHANGED
package/dist/manifest.js
CHANGED
|
@@ -87,7 +87,9 @@ export async function create(manifest, ctx) {
|
|
|
87
87
|
}
|
|
88
88
|
const diagnostics = analyzer.analyze(manifests);
|
|
89
89
|
const errors = diagnostics.filter((d) => d.severity === 1); // DiagnosticSeverity.Error = 1
|
|
90
|
+
const warnings = diagnostics.filter((d) => d.severity === 2); // DiagnosticSeverity.Warning = 2
|
|
90
91
|
const expectedErrors = manifest.expect.errors ?? [];
|
|
92
|
+
const expectedWarnings = manifest.expect.warnings ?? [];
|
|
91
93
|
const failures = [];
|
|
92
94
|
const matched = [];
|
|
93
95
|
if (expectedErrors.length === 0) {
|
|
@@ -108,17 +110,34 @@ export async function create(manifest, ctx) {
|
|
|
108
110
|
matched.push(`${expected.code ?? "*"}${expected.message ? ` (${expected.message})` : ""}`);
|
|
109
111
|
}
|
|
110
112
|
else {
|
|
111
|
-
failures.push(`expected ${expected.code ?? "*"}${expected.message ? ` containing "${expected.message}"` : ""} — not found`);
|
|
113
|
+
failures.push(`expected error ${expected.code ?? "*"}${expected.message ? ` containing "${expected.message}"` : ""} — not found`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Warnings are checked only when the caller declares expect.warnings. Unexpected
|
|
118
|
+
// warnings are not failures (unlike errors) — warnings are advisory and may exist
|
|
119
|
+
// on manifests that are otherwise valid. When expect.warnings is present, every
|
|
120
|
+
// listed warning must be found; extras are ignored.
|
|
121
|
+
if (expectedWarnings.length > 0) {
|
|
122
|
+
for (const expected of expectedWarnings) {
|
|
123
|
+
const match = warnings.find((d) => matchesDiagnostic(d, expected));
|
|
124
|
+
if (match) {
|
|
125
|
+
matched.push(`warning ${expected.code ?? "*"}${expected.message ? ` (${expected.message})` : ""}`);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
failures.push(`expected warning ${expected.code ?? "*"}${expected.message ? ` containing "${expected.message}"` : ""} — not found`);
|
|
112
129
|
}
|
|
113
130
|
}
|
|
114
131
|
}
|
|
115
132
|
const passedLines = matched.map((m) => ` ${green("✓")} ${dim(m)}\n`).join("");
|
|
116
133
|
if (failures.length > 0) {
|
|
117
134
|
const failedLines = failures.map((f) => ` ${red("✗")} ${f}\n`).join("");
|
|
118
|
-
const actualLines = errors.length > 0
|
|
119
|
-
? ` ${dim("actual
|
|
120
|
-
errors
|
|
121
|
-
|
|
135
|
+
const actualLines = errors.length > 0 || warnings.length > 0
|
|
136
|
+
? ` ${dim("actual diagnostics:")}\n` +
|
|
137
|
+
[...errors, ...warnings]
|
|
138
|
+
.map((d) => ` ${dim(`[${d.code}] ${d.message}`)}\n`)
|
|
139
|
+
.join("")
|
|
140
|
+
: ` ${dim("no diagnostics produced")}\n`;
|
|
122
141
|
ctx.stderr.write(bold(red(`Assert.Manifest.${name}: assertion failed`)) + "\n" +
|
|
123
142
|
passedLines + failedLines + actualLines);
|
|
124
143
|
ctx.requestExit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telorun/assert",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Telo Assert module - Assertion resource kinds for Telo manifests.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"telo",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@sinclair/typebox": "^0.34.48",
|
|
34
|
-
"@telorun/analyzer": "0.
|
|
35
|
-
"@telorun/sdk": "0.
|
|
34
|
+
"@telorun/analyzer": "0.4.0",
|
|
35
|
+
"@telorun/sdk": "0.5.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^20.0.0",
|
package/src/manifest.ts
CHANGED
|
@@ -13,6 +13,7 @@ interface ManifestAssertManifest {
|
|
|
13
13
|
source: string;
|
|
14
14
|
expect: {
|
|
15
15
|
errors?: ExpectError[];
|
|
16
|
+
warnings?: ExpectError[];
|
|
16
17
|
loadError?: string;
|
|
17
18
|
};
|
|
18
19
|
}
|
|
@@ -121,7 +122,9 @@ export async function create(
|
|
|
121
122
|
|
|
122
123
|
const diagnostics = analyzer.analyze(manifests);
|
|
123
124
|
const errors = diagnostics.filter((d) => d.severity === 1); // DiagnosticSeverity.Error = 1
|
|
125
|
+
const warnings = diagnostics.filter((d) => d.severity === 2); // DiagnosticSeverity.Warning = 2
|
|
124
126
|
const expectedErrors = manifest.expect.errors ?? [];
|
|
127
|
+
const expectedWarnings = manifest.expect.warnings ?? [];
|
|
125
128
|
const failures: string[] = [];
|
|
126
129
|
const matched: string[] = [];
|
|
127
130
|
|
|
@@ -143,7 +146,26 @@ export async function create(
|
|
|
143
146
|
);
|
|
144
147
|
} else {
|
|
145
148
|
failures.push(
|
|
146
|
-
`expected ${expected.code ?? "*"}${expected.message ? ` containing "${expected.message}"` : ""} — not found`,
|
|
149
|
+
`expected error ${expected.code ?? "*"}${expected.message ? ` containing "${expected.message}"` : ""} — not found`,
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Warnings are checked only when the caller declares expect.warnings. Unexpected
|
|
156
|
+
// warnings are not failures (unlike errors) — warnings are advisory and may exist
|
|
157
|
+
// on manifests that are otherwise valid. When expect.warnings is present, every
|
|
158
|
+
// listed warning must be found; extras are ignored.
|
|
159
|
+
if (expectedWarnings.length > 0) {
|
|
160
|
+
for (const expected of expectedWarnings) {
|
|
161
|
+
const match = warnings.find((d) => matchesDiagnostic(d, expected));
|
|
162
|
+
if (match) {
|
|
163
|
+
matched.push(
|
|
164
|
+
`warning ${expected.code ?? "*"}${expected.message ? ` (${expected.message})` : ""}`,
|
|
165
|
+
);
|
|
166
|
+
} else {
|
|
167
|
+
failures.push(
|
|
168
|
+
`expected warning ${expected.code ?? "*"}${expected.message ? ` containing "${expected.message}"` : ""} — not found`,
|
|
147
169
|
);
|
|
148
170
|
}
|
|
149
171
|
}
|
|
@@ -152,10 +174,13 @@ export async function create(
|
|
|
152
174
|
const passedLines = matched.map((m) => ` ${green("✓")} ${dim(m)}\n`).join("");
|
|
153
175
|
if (failures.length > 0) {
|
|
154
176
|
const failedLines = failures.map((f) => ` ${red("✗")} ${f}\n`).join("");
|
|
155
|
-
const actualLines =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
177
|
+
const actualLines =
|
|
178
|
+
errors.length > 0 || warnings.length > 0
|
|
179
|
+
? ` ${dim("actual diagnostics:")}\n` +
|
|
180
|
+
[...errors, ...warnings]
|
|
181
|
+
.map((d) => ` ${dim(`[${d.code}] ${d.message}`)}\n`)
|
|
182
|
+
.join("")
|
|
183
|
+
: ` ${dim("no diagnostics produced")}\n`;
|
|
159
184
|
ctx.stderr.write(
|
|
160
185
|
bold(red(`Assert.Manifest.${name}: assertion failed`)) + "\n" +
|
|
161
186
|
passedLines + failedLines + actualLines,
|