valent-pipeline 0.19.32 → 0.19.33
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/package.json +1 -1
- package/src/lib/spec-conformance.js +40 -10
package/package.json
CHANGED
|
@@ -66,10 +66,38 @@ export function isGatableToken(token) {
|
|
|
66
66
|
return true;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Blank out JS/TS comments — both line and block comments — so a skip marker that appears only inside
|
|
71
|
+
* a comment (a commented-out `// it.skip(...)`, or an `it.skip` mentioned inside a JSDoc/block comment)
|
|
72
|
+
* is not mistaken for a real skip (HARNESS-GAPS 2026-06-18). Comment bytes become spaces; newlines and
|
|
73
|
+
* tabs are preserved so line numbers and the waiver line-window stay exact. String / template literals
|
|
74
|
+
* are tracked, so a comment-looking substring INSIDE a string is left intact — a real marker is never
|
|
75
|
+
* hidden (no false-negatives).
|
|
76
|
+
*/
|
|
77
|
+
export function stripComments(content) {
|
|
78
|
+
const s = String(content || '');
|
|
79
|
+
let out = '';
|
|
80
|
+
let state = 'code'; // code | line | block | sq | dq | tpl
|
|
81
|
+
const ws = (ch) => (ch === '\n' || ch === '\t' ? ch : ' ');
|
|
82
|
+
for (let i = 0; i < s.length; i++) {
|
|
83
|
+
const c = s[i];
|
|
84
|
+
const d = s[i + 1];
|
|
85
|
+
if (state === 'code') {
|
|
86
|
+
if (c === '/' && d === '/') { state = 'line'; out += ' '; i++; continue; }
|
|
87
|
+
if (c === '/' && d === '*') { state = 'block'; out += ' '; i++; continue; }
|
|
88
|
+
if (c === "'") { state = 'sq'; out += c; continue; }
|
|
89
|
+
if (c === '"') { state = 'dq'; out += c; continue; }
|
|
90
|
+
if (c === '`') { state = 'tpl'; out += c; continue; }
|
|
91
|
+
out += c; continue;
|
|
92
|
+
}
|
|
93
|
+
if (state === 'line') { if (c === '\n') { state = 'code'; out += c; } else out += ws(c); continue; }
|
|
94
|
+
if (state === 'block') { if (c === '*' && d === '/') { state = 'code'; out += ' '; i++; } else out += ws(c); continue; }
|
|
95
|
+
// inside a string/template literal: copy verbatim, honor backslash escapes, close on the quote
|
|
96
|
+
out += c;
|
|
97
|
+
if (c === '\\') { out += (s[i + 1] ?? ''); i++; continue; }
|
|
98
|
+
if ((state === 'sq' && c === "'") || (state === 'dq' && c === '"') || (state === 'tpl' && c === '`')) state = 'code';
|
|
99
|
+
}
|
|
100
|
+
return out;
|
|
73
101
|
}
|
|
74
102
|
|
|
75
103
|
/**
|
|
@@ -81,14 +109,16 @@ function stripLineComment(line) {
|
|
|
81
109
|
*/
|
|
82
110
|
function scanSkips(file) {
|
|
83
111
|
const out = [];
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
112
|
+
const raw = (file.content || '').split(/\r?\n/);
|
|
113
|
+
// Match skip markers in CODE only — comments (line `//` and block `/* */`) are blanked so a marker
|
|
114
|
+
// that merely appears inside a comment is not flagged. The waiver check still reads the RAW line,
|
|
115
|
+
// since the `valent-waiver:` token lives in a comment / the it.skip() title.
|
|
116
|
+
const code = stripComments(file.content || '').split(/\r?\n/);
|
|
117
|
+
for (let i = 0; i < raw.length; i++) {
|
|
88
118
|
SKIP_MARKER.lastIndex = 0;
|
|
89
|
-
const m = code.match(SKIP_MARKER);
|
|
119
|
+
const m = (code[i] || '').match(SKIP_MARKER);
|
|
90
120
|
if (!m) continue;
|
|
91
|
-
const waived = WAIVER_RE.test(raw) ||
|
|
121
|
+
const waived = WAIVER_RE.test(raw[i]) || raw.slice(Math.max(0, i - 3), i).some((l) => WAIVER_RE.test(l));
|
|
92
122
|
if (waived) continue;
|
|
93
123
|
out.push({
|
|
94
124
|
kind: 'unwaived-skip',
|