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.
@@ -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 (title === 'testing' || title === 'tests' || title === 'test') {
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
- if (line.startsWith(markerPrefix)) {
247
- const exitCode = parseInt(line.slice(markerPrefix.length), 10);
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 "Testing" or "Tests" section found in the document.${colors.reset}`);
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
- Only runs code blocks under a "Testing", "Tests", or "Test" header.
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prquicktest",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Run code blocks from GitHub PR descriptions",
5
5
  "type": "module",
6
6
  "scripts": {