prquicktest 2.0.0 → 2.1.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/bin/prquicktest.mjs +12 -7
- package/package.json +1 -1
package/bin/prquicktest.mjs
CHANGED
|
@@ -63,7 +63,7 @@ function isTestingHeader(line) {
|
|
|
63
63
|
const level = match[1].length;
|
|
64
64
|
const title = match[2].trim().toLowerCase();
|
|
65
65
|
|
|
66
|
-
if (
|
|
66
|
+
if (/^test(?:ing|s)?(?:\s+\w+)?$/.test(title)) {
|
|
67
67
|
return { level, title: match[2].trim() };
|
|
68
68
|
}
|
|
69
69
|
return null;
|
|
@@ -91,7 +91,7 @@ function parseCondition(line) {
|
|
|
91
91
|
|
|
92
92
|
function parseMarkdown(content) {
|
|
93
93
|
const blocks = [];
|
|
94
|
-
const lines = content.split('\n');
|
|
94
|
+
const lines = content.replace(/\r\n?/g, '\n').split('\n');
|
|
95
95
|
let i = 0;
|
|
96
96
|
let inTestingSection = false;
|
|
97
97
|
let testingSectionLevel = null;
|
|
@@ -243,8 +243,13 @@ function runInShell(shell, code) {
|
|
|
243
243
|
const line = stdoutBuf.slice(0, newlineIdx);
|
|
244
244
|
stdoutBuf = stdoutBuf.slice(newlineIdx + 1);
|
|
245
245
|
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
const markerIdx = line.indexOf(markerPrefix);
|
|
247
|
+
if (markerIdx !== -1) {
|
|
248
|
+
// Output any content before the marker (e.g., if previous command didn't end with newline)
|
|
249
|
+
if (markerIdx > 0) {
|
|
250
|
+
process.stdout.write(line.slice(0, markerIdx) + '\n');
|
|
251
|
+
}
|
|
252
|
+
const exitCode = parseInt(line.slice(markerIdx + markerPrefix.length), 10);
|
|
248
253
|
cleanup();
|
|
249
254
|
resolve({ success: exitCode === 0, code: exitCode });
|
|
250
255
|
return;
|
|
@@ -311,8 +316,8 @@ async function run(content, skipConfirm = false) {
|
|
|
311
316
|
const blocks = parseMarkdown(content);
|
|
312
317
|
|
|
313
318
|
if (blocks.length === 0) {
|
|
314
|
-
console.log(`${colors.yellow}No
|
|
315
|
-
console.log(`${colors.dim}Add a section like "## Testing" with code blocks to run.${colors.reset}`);
|
|
319
|
+
console.log(`${colors.yellow}No testing section found in the document.${colors.reset}`);
|
|
320
|
+
console.log(`${colors.dim}Add a section like "## Testing" or "## Test Plan" with code blocks to run.${colors.reset}`);
|
|
316
321
|
return;
|
|
317
322
|
}
|
|
318
323
|
|
|
@@ -442,7 +447,7 @@ ${colors.yellow}Examples:${colors.reset}
|
|
|
442
447
|
prquicktest -y https://github.com/owner/repo/pull/123
|
|
443
448
|
|
|
444
449
|
${colors.yellow}How it works:${colors.reset}
|
|
445
|
-
|
|
450
|
+
Runs code blocks under headers like "Testing", "Tests", "Test Plan", etc.
|
|
446
451
|
The section ends when another header of equal or higher level appears.
|
|
447
452
|
All blocks run in a single shell session — environment variables,
|
|
448
453
|
working directory changes, and other state persist across blocks.
|