brsh 3.6.2 → 3.8.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.
@@ -23,6 +23,11 @@ function cloneCell(cell) {
23
23
  };
24
24
  }
25
25
 
26
+ function isCellEmpty(cell) {
27
+ if (!cell) return true;
28
+ return cell.ch === ' ' && cell.fg === null && cell.bg === null && cell.flags === 0 && cell.link === null;
29
+ }
30
+
26
31
  class ScreenBuffer {
27
32
  constructor(cols = 80, rows = 24, options = {}) {
28
33
  this.cols = Math.max(1, cols);
@@ -74,6 +79,7 @@ class ScreenBuffer {
74
79
  for (let c = 0; c < cols; c++) {
75
80
  row[c] = createCell(' ', fg, bg, flags, null);
76
81
  }
82
+ row.isWrapped = false;
77
83
  return row;
78
84
  }
79
85
 
@@ -264,6 +270,10 @@ class ScreenBuffer {
264
270
  putChar(ch) {
265
271
  if (this.pendingWrap) {
266
272
  if (this.autoWrap) {
273
+ const prevRow = this.grid[this.cursorRow];
274
+ if (prevRow) {
275
+ prevRow.isWrapped = true;
276
+ }
267
277
  this.cursorCol = 0;
268
278
  this.pendingWrap = false;
269
279
  this._indexDown();
@@ -364,7 +374,9 @@ class ScreenBuffer {
364
374
  for (let i = 0; i < n; i++) {
365
375
  const removed = g[top];
366
376
  if (!this.isAltScreen && top === 0 && this.maxScrollback > 0) {
367
- this.scrollback.push(removed.map(cloneCell));
377
+ const cloned = removed.map(cloneCell);
378
+ cloned.isWrapped = Boolean(removed.isWrapped);
379
+ this.scrollback.push(cloned);
368
380
  if (this.scrollback.length > this.maxScrollback) {
369
381
  this.scrollback.shift();
370
382
  }
@@ -402,7 +414,12 @@ class ScreenBuffer {
402
414
  return;
403
415
  }
404
416
  for (let c = start; c <= end; c++) {
405
- row[c] = createCell(' ', this.curFg, this.curBg, this.curFlags, null);
417
+ if (c < row.length) {
418
+ row[c] = createCell(' ', this.curFg, this.curBg, this.curFlags, null);
419
+ }
420
+ }
421
+ if (mode === 2 || (mode === 0 && this.cursorCol === 0)) {
422
+ row.isWrapped = false;
406
423
  }
407
424
  this.pendingWrap = false;
408
425
  this._markRowDirty(this.cursorRow);
@@ -493,33 +510,199 @@ class ScreenBuffer {
493
510
  const rows = Math.max(1, newRows);
494
511
  if (cols === this.cols && rows === this.rows) return;
495
512
 
496
- const resizeGrid = (oldGrid) => {
497
- const nextGrid = new Array(rows);
498
- for (let r = 0; r < rows; r++) {
499
- const newRow = new Array(cols);
500
- const oldRow = r < oldGrid.length ? oldGrid[r] : null;
501
- for (let c = 0; c < cols; c++) {
502
- newRow[c] = oldRow && c < oldRow.length
503
- ? oldRow[c]
504
- : createCell(' ', null, null, 0, null);
513
+ if (this.isAltScreen) {
514
+ const resizeGrid = (oldGrid) => {
515
+ const nextGrid = new Array(rows);
516
+ for (let r = 0; r < rows; r++) {
517
+ const newRow = new Array(cols);
518
+ const oldRow = r < oldGrid.length ? oldGrid[r] : null;
519
+ for (let c = 0; c < cols; c++) {
520
+ newRow[c] = oldRow && c < oldRow.length
521
+ ? oldRow[c]
522
+ : createCell(' ', null, null, 0, null);
523
+ }
524
+ newRow.isWrapped = false;
525
+ nextGrid[r] = newRow;
505
526
  }
506
- nextGrid[r] = newRow;
527
+ return nextGrid;
528
+ };
529
+ this.altGrid = resizeGrid(this.altGrid);
530
+ this.cols = cols;
531
+ this.rows = rows;
532
+ this.scrollTop = 0;
533
+ this.scrollBottom = rows - 1;
534
+ this.cursorRow = Math.min(rows - 1, this.cursorRow);
535
+ this.cursorCol = Math.min(cols - 1, this.cursorCol);
536
+ this.pendingWrap = false;
537
+ this._markAllDirty();
538
+ return;
539
+ }
540
+
541
+ const reflowResult = this._reflowPrimaryBuffer(cols, rows);
542
+ this.scrollback = reflowResult.scrollback;
543
+ this.primaryGrid = reflowResult.primaryGrid;
544
+ this.cursorRow = reflowResult.cursorRow;
545
+ this.cursorCol = reflowResult.cursorCol;
546
+
547
+ // Resize altGrid directly so dimensions stay in sync
548
+ const nextAlt = new Array(rows);
549
+ for (let r = 0; r < rows; r++) {
550
+ const row = new Array(cols);
551
+ const oldRow = r < this.altGrid.length ? this.altGrid[r] : null;
552
+ for (let c = 0; c < cols; c++) {
553
+ row[c] = oldRow && c < oldRow.length
554
+ ? oldRow[c]
555
+ : createCell(' ', null, null, 0, null);
507
556
  }
508
- return nextGrid;
509
- };
557
+ row.isWrapped = false;
558
+ nextAlt[r] = row;
559
+ }
560
+ this.altGrid = nextAlt;
510
561
 
511
- this.primaryGrid = resizeGrid(this.primaryGrid);
512
- this.altGrid = resizeGrid(this.altGrid);
513
562
  this.cols = cols;
514
563
  this.rows = rows;
515
564
  this.scrollTop = 0;
516
565
  this.scrollBottom = rows - 1;
517
- this.cursorRow = Math.min(rows - 1, this.cursorRow);
518
- this.cursorCol = Math.min(cols - 1, this.cursorCol);
519
566
  this.pendingWrap = false;
567
+ this.viewportOffset = Math.min(this.scrollback.length, this.viewportOffset);
520
568
  this._markAllDirty();
521
569
  }
522
570
 
571
+ _reflowPrimaryBuffer(newCols, newRows) {
572
+ const oldCols = this.cols;
573
+ const fullBuffer = [...this.scrollback, ...this.primaryGrid];
574
+ const cursorAbsRow = this.scrollback.length + this.cursorRow;
575
+ const cursorAbsCol = this.cursorCol;
576
+
577
+ let lastActiveRow = cursorAbsRow;
578
+ for (let r = fullBuffer.length - 1; r >= 0; r--) {
579
+ const row = fullBuffer[r];
580
+ if (row && (row.isWrapped || row.some(c => !isCellEmpty(c)))) {
581
+ lastActiveRow = Math.max(lastActiveRow, r);
582
+ break;
583
+ }
584
+ }
585
+
586
+ const activeBuffer = fullBuffer.slice(0, lastActiveRow + 1);
587
+
588
+ const logicalLines = [];
589
+ let currentLine = null;
590
+
591
+ for (let r = 0; r < activeBuffer.length; r++) {
592
+ const row = activeBuffer[r];
593
+ const isCursorRow = (r === cursorAbsRow);
594
+
595
+ if (!currentLine) {
596
+ currentLine = { cells: [], cursorPos: null, isWrapped: false };
597
+ }
598
+
599
+ let lastMeaningfulCol = -1;
600
+ for (let c = row.length - 1; c >= 0; c--) {
601
+ if (!isCellEmpty(row[c])) {
602
+ lastMeaningfulCol = c;
603
+ break;
604
+ }
605
+ }
606
+
607
+ let takeCols = row.isWrapped ? oldCols : lastMeaningfulCol + 1;
608
+ if (isCursorRow && cursorAbsCol >= takeCols) {
609
+ takeCols = cursorAbsCol + 1;
610
+ }
611
+
612
+ const baseOffset = currentLine.cells.length;
613
+ if (isCursorRow) {
614
+ currentLine.cursorPos = baseOffset + cursorAbsCol;
615
+ }
616
+
617
+ for (let c = 0; c < takeCols; c++) {
618
+ currentLine.cells.push(c < row.length ? cloneCell(row[c]) : createCell(' '));
619
+ }
620
+
621
+ currentLine.isWrapped = Boolean(row.isWrapped);
622
+ if (!row.isWrapped) {
623
+ logicalLines.push(currentLine);
624
+ currentLine = null;
625
+ }
626
+ }
627
+ if (currentLine) {
628
+ logicalLines.push(currentLine);
629
+ }
630
+
631
+ const newRowsList = [];
632
+ let newCursorRow = null;
633
+ let newCursorCol = null;
634
+
635
+ for (const line of logicalLines) {
636
+ const cells = line.cells;
637
+ const totalCells = cells.length;
638
+
639
+ if (totalCells === 0) {
640
+ const emptyRow = this._createRow(newCols);
641
+ if (line.cursorPos !== null) {
642
+ newCursorRow = newRowsList.length;
643
+ newCursorCol = 0;
644
+ }
645
+ newRowsList.push(emptyRow);
646
+ continue;
647
+ }
648
+
649
+ let offset = 0;
650
+ while (offset < totalCells) {
651
+ const chunkLen = Math.min(newCols, totalCells - offset);
652
+ const row = new Array(newCols);
653
+ for (let c = 0; c < newCols; c++) {
654
+ if (c < chunkLen) {
655
+ row[c] = cells[offset + c];
656
+ } else {
657
+ row[c] = createCell(' ');
658
+ }
659
+ }
660
+
661
+ const isLastChunk = (offset + chunkLen >= totalCells);
662
+ row.isWrapped = !isLastChunk ? true : line.isWrapped;
663
+
664
+ if (line.cursorPos !== null && line.cursorPos >= offset && (line.cursorPos < offset + newCols || isLastChunk)) {
665
+ newCursorRow = newRowsList.length;
666
+ newCursorCol = Math.min(newCols - 1, line.cursorPos - offset);
667
+ }
668
+
669
+ newRowsList.push(row);
670
+ offset += newCols;
671
+ }
672
+ }
673
+
674
+ if (newCursorRow === null) {
675
+ newCursorRow = Math.min(newRows - 1, newRowsList.length - 1);
676
+ newCursorCol = 0;
677
+ }
678
+
679
+ let finalScrollback = [];
680
+ let finalPrimary = [];
681
+
682
+ if (newRowsList.length <= newRows) {
683
+ finalScrollback = [];
684
+ finalPrimary = newRowsList;
685
+ while (finalPrimary.length < newRows) {
686
+ finalPrimary.push(this._createRow(newCols));
687
+ }
688
+ } else {
689
+ const excess = newRowsList.length - newRows;
690
+ finalScrollback = newRowsList.slice(0, excess);
691
+ if (this.maxScrollback > 0 && finalScrollback.length > this.maxScrollback) {
692
+ finalScrollback = finalScrollback.slice(finalScrollback.length - this.maxScrollback);
693
+ }
694
+ finalPrimary = newRowsList.slice(excess);
695
+ newCursorRow = Math.max(0, newCursorRow - excess);
696
+ }
697
+
698
+ return {
699
+ scrollback: finalScrollback,
700
+ primaryGrid: finalPrimary,
701
+ cursorRow: Math.min(newRows - 1, newCursorRow),
702
+ cursorCol: Math.min(newCols - 1, newCursorCol)
703
+ };
704
+ }
705
+
523
706
  scrollViewport(deltaLines) {
524
707
  if (this.isAltScreen) return;
525
708
  const maxOffset = this.scrollback.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brsh",
3
- "version": "3.6.2",
3
+ "version": "3.8.0",
4
4
  "description": "A unix like shell written in javascript",
5
5
  "main": "./dist/shell.min.js",
6
6
  "module": "./dist/shell.es.js",
@@ -1071,4 +1071,74 @@ describe('Output Typing Animation Suppression', () => {
1071
1071
  term.destroy();
1072
1072
  });
1073
1073
  });
1074
+
1075
+ describe('Terminal Resizing and Content Preservation', () => {
1076
+ it('preserves line content cut off when resizing smaller, and restores it when resized bigger', () => {
1077
+ const el = document.createElement('div');
1078
+ const term = new Terminal({
1079
+ el,
1080
+ Shell: false,
1081
+ cols: 80,
1082
+ rows: 24
1083
+ });
1084
+
1085
+ const longLine = 'Email: eliot@piratemedia.tv (mailto:eliot@piratemedia.tv)';
1086
+ term.write(longLine + '\r\n');
1087
+
1088
+ expect(term.getLineText(0)).toBe(longLine);
1089
+
1090
+ // Resize down to 32 columns: reflows overflow onto next row
1091
+ term.resize(32, 24);
1092
+ expect(term.cols).toBe(32);
1093
+ expect(term.getLineText(0)).toBe(longLine.slice(0, 32));
1094
+ expect(term.getLineText(1)).toBe(longLine.slice(32));
1095
+
1096
+ // In DOM, the reflowed rows are rendered
1097
+ expect(term.renderer._rowElements[0].innerHTML).toContain('Email: eliot@piratemedia.tv (mai');
1098
+ expect(term.renderer._rowElements[1].innerHTML).toContain('lto:eliot@piratemedia.tv)');
1099
+
1100
+ // Resize back bigger to 80 columns: the cut off text unwraps and is fully restored
1101
+ term.resize(80, 24);
1102
+ expect(term.cols).toBe(80);
1103
+ expect(term.getLineText(0)).toBe(longLine);
1104
+ expect(term.getLineText(1)).toBe('');
1105
+
1106
+ // Multiple resize cycles
1107
+ term.resize(20, 24);
1108
+ expect(term.getLineText(0)).toBe(longLine.slice(0, 20));
1109
+ expect(term.getLineText(1)).toBe(longLine.slice(20, 40));
1110
+ expect(term.getLineText(2)).toBe(longLine.slice(40));
1111
+
1112
+ term.resize(100, 24);
1113
+ expect(term.getLineText(0)).toBe(longLine);
1114
+ expect(term.getLineText(1)).toBe('');
1115
+ expect(term.getLineText(2)).toBe('');
1116
+
1117
+ term.destroy();
1118
+ });
1119
+
1120
+ it('clears reflowed line when erased with erase-in-line', () => {
1121
+ const el = document.createElement('div');
1122
+ const term = new Terminal({
1123
+ el,
1124
+ Shell: false,
1125
+ cols: 80,
1126
+ rows: 24
1127
+ });
1128
+
1129
+ const longLine = 'Email: eliot@piratemedia.tv (mailto:eliot@piratemedia.tv)';
1130
+ term.write(longLine);
1131
+
1132
+ // Resize to 32 cols: wraps onto row 0 and 1
1133
+ term.resize(32, 24);
1134
+ expect(term.getLineText(0)).toBe(longLine.slice(0, 32));
1135
+ expect(term.getLineText(1)).toBe(longLine.slice(32));
1136
+
1137
+ // Move cursor to start of row 0 and erase row 0
1138
+ term.write('\x1b[H\x1b[K');
1139
+ expect(term.getLineText(0)).toBe('');
1140
+
1141
+ term.destroy();
1142
+ });
1143
+ });
1074
1144
  });
@@ -124,4 +124,68 @@ describe('Running .wasm files directly as CLI tools in base shell', () => {
124
124
  expect(shell.context.fs.exists('/help.txt')).toBe(true);
125
125
  expect(shell.context.fs.getFileByPath('/help.txt')).toContain('Usage: mytool.wasm');
126
126
  });
127
+
128
+ it('supports WASI fd_fdstat_set_flags, fd_fdstat_get, and non-blocking fd_read (ERRNO_AGAIN)', async () => {
129
+ const NONBLOCK_WASM_BYTES = Buffer.from(
130
+ 'AGFzbQEAAAABFgRgAn9/AX9gAX8AYAR/f39/AX9gAAACmQEEFndhc2lfc25hcHNob3RfcHJldmlldzETZmRfZmRzdGF0X3NldF9mbGFncwAAFndhc2lfc25hcHNob3RfcHJldmlldzEJcHJvY19leGl0AAEWd2FzaV9zbmFwc2hvdF9wcmV2aWV3MQ1mZF9mZHN0YXRfZ2V0AAAWd2FzaV9zbmFwc2hvdF9wcmV2aWV3MQdmZF9yZWFkAAIDAgEDBQMBAAIGCAF/AUGQigQLBxMCBm1lbW9yeQIABl9zdGFydAAECt4BAdsBAQF/I4CAgIAAQRBrIgAkgICAgAACQEEAQQQQgICAgABFDQBBChCBgICAAAsCQEEAQZCIgIAAEIKAgIAARQ0AQQsQgYCAgAALAkBBAC8BkoiAgABBBEYNAEEMEIGAgIAACyAAQQApA4CIgIAANwMIIABBADYCBAJAQQAgAEEIakEBIABBBGoQg4CAgABBBkYNAEENEIGAgIAACwJAQQJBBBCAgICAAEUNAEEOEIGAgIAAC0ECIABBCGpBASAAQQRqEIOAgIAAGkEAEIGAgIAAIABBEGokgICAgAALCw8BAEGACAsIMAQAABAAAAAAaARuYW1lAUEFABNmZF9mZHN0YXRfc2V0X2ZsYWdzAQlwcm9jX2V4aXQCDWZkX2Zkc3RhdF9nZXQDB2ZkX3JlYWQEBl9zdGFydAcSAQAPX19zdGFja19wb2ludGVyCQoBAAcucm9kYXRhAC0JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDERlYmlhbiBjbGFuZwYxNC4wLjY=',
131
+ 'base64'
132
+ );
133
+
134
+ const shell = new Shell({
135
+ filesystem: {
136
+ bin: {
137
+ 'nonblock.wasm': NONBLOCK_WASM_BYTES
138
+ }
139
+ },
140
+ permissions: {
141
+ '/bin/nonblock.wasm': 0o755
142
+ }
143
+ });
144
+
145
+ const res = await run(shell, 'nonblock');
146
+ expect(res.exitCode).toBe(0);
147
+ });
148
+
149
+ it('supports WASI poll_oneoff clock subscriptions and timers', async () => {
150
+ const POLL_WASM_BYTES = Buffer.from(
151
+ 'AGFzbQEAAAABEANgBH9/f38Bf2ABfwBgAAACSQIWd2FzaV9zbmFwc2hvdF9wcmV2aWV3MQtwb2xsX29uZW9mZgAAFndhc2lfc25hcHNob3RfcHJldmlldzEJcHJvY19leGl0AAEDAgECBQMBAAIGCAF/AUGAiAQLBxMCBm1lbW9yeQIABl9zdGFydAACCtABAc0BAQN/I4CAgIAAQeAAayIAJICAgIAAIABB2ABqIgFCADcDACAAQTBqQRBqIgJCADcDACAAQdAAakIANwMAIAFBADsBACACQQA2AgAgAEIANwM4IABCgK3iBDcDSCAAQrngADcDMCAAQShqQgA3AwAgAEEQakEQakIANwMAIABBGGpCADcDACAAQgA3AxAgAEEANgIMAkAgAEEwaiAAQRBqQQEgAEEMahCAgICAAEUNAEEUEIGAgIAAC0EAEIGAgIAAIABB4ABqJICAgIAACwA8BG5hbWUBIQMAC3BvbGxfb25lb2ZmAQlwcm9jX2V4aXQCBl9zdGFydAcSAQAPX19zdGFja19wb2ludGVyAC0JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDERlYmlhbiBjbGFuZwYxNC4wLjY=',
152
+ 'base64'
153
+ );
154
+
155
+ const shell = new Shell({
156
+ filesystem: {
157
+ bin: {
158
+ 'poll.wasm': POLL_WASM_BYTES
159
+ }
160
+ },
161
+ permissions: {
162
+ '/bin/poll.wasm': 0o755
163
+ }
164
+ });
165
+
166
+ const res = await run(shell, 'poll');
167
+ expect(res.exitCode).toBe(0);
168
+ });
169
+
170
+ it('supports opening /dev/null, /dev/zero, and exporting set_terminal_size for dynamic sizing', async () => {
171
+ const DEV_WASM_BYTES = Buffer.from(
172
+ 'AGFzbQEAAAABKwdgCX9/f39/fn5/fwF/YAF/AGAEf39/fwF/YAF/AX9gAn9/AGAAAX9gAAACrAEFFndhc2lfc25hcHNob3RfcHJldmlldzEJcGF0aF9vcGVuAAAWd2FzaV9zbmFwc2hvdF9wcmV2aWV3MQlwcm9jX2V4aXQAARZ3YXNpX3NuYXBzaG90X3ByZXZpZXcxCGZkX3dyaXRlAAIWd2FzaV9zbmFwc2hvdF9wcmV2aWV3MQdmZF9yZWFkAAIWd2FzaV9zbmFwc2hvdF9wcmV2aWV3MQhmZF9jbG9zZQADAwUEBAUFBgQFAXABAQEFAwEAAgYIAX8BQbCIBAsHPQUGbWVtb3J5AgARc2V0X3Rlcm1pbmFsX3NpemUABQhnZXRfY29scwAGCGdldF9yb3dzAAcGX3N0YXJ0AAgKgwQEGABBACABNgKkiICAAEEAIAA2AqCIgIAACwsAQQAoAqCIgIAACwsAQQAoAqSIgIAAC88DAQF/I4CAgIAAQfAAayIAJICAgIAAIABB6ABqQQAvAJKIgIAAOwEAIABBACkAioiAgAA3A2ACQEEDQQAgAEHgAGpBCUEAQgBCAEEAIABB7ABqEICAgIAARQ0AQQoQgYCAgAALIABBACgAm4iAgAA2AFcgAEEAKQCUiICAADcDUCAAQQo2AkwgACAAQdAAajYCSCAAQQA2AkQCQAJAIAAoAmwgAEHIAGpBASAAQcQAahCCgICAAA0AIAAoAkRBCkYNAQtBCxCBgICAAAsgAEEgNgIcIAAgAEEgajYCGCAAQeMANgIUAkACQCAAKAJsIABBGGpBASAAQRRqEIOAgIAADQAgACgCFEUNAQtBDBCBgICAAAsgACgCbBCEgICAABogAEEIakEALwCIiICAADsBACAAQQApAICIgIAANwMAAkBBA0EAIABBCUEAQgBCAEEAIABBEGoQgICAgABFDQBBDRCBgICAAAsgAEHV1AI7ASACQAJAIAAoAhAgAEEYakEBIABBFGoQg4CAgAANACAALQAgQf8BcQ0AIAAtACFB/wFxRQ0BC0EOEIGAgIAACyAAKAIQEISAgIAAGkEAEIGAgIAAIABB8ABqJICAgIAACwsmAQBBgAgLHy9kZXYvemVybwAvZGV2L251bGwAaGVsbG8gbnVsbAAArgEEbmFtZQGGAQkAEF9fd2FzaV9wYXRoX29wZW4BEF9fd2FzaV9wcm9jX2V4aXQCD19fd2FzaV9mZF93cml0ZQMOX193YXNpX2ZkX3JlYWQED19fd2FzaV9mZF9jbG9zZQURc2V0X3Rlcm1pbmFsX3NpemUGCGdldF9jb2xzBwhnZXRfcm93cwgGX3N0YXJ0BxIBAA9fX3N0YWNrX3BvaW50ZXIJCgEABy5yb2RhdGEALQlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQEMRGViaWFuIGNsYW5nBjE0LjAuNg==',
173
+ 'base64'
174
+ );
175
+
176
+ const shell = new Shell({
177
+ filesystem: {
178
+ bin: {
179
+ 'devtool.wasm': DEV_WASM_BYTES
180
+ }
181
+ },
182
+ permissions: {
183
+ '/bin/devtool.wasm': 0o755
184
+ }
185
+ });
186
+
187
+ const res = await run(shell, 'devtool');
188
+ expect(res.exitCode).toBe(0);
189
+ });
127
190
  });
191
+
package/test/wbt.test.js CHANGED
@@ -1372,7 +1372,7 @@ describe('WBT GNU nano WASM package (nano / nano-wasm)', () => {
1372
1372
 
1373
1373
  const verRes = await run(shell, 'nano --version');
1374
1374
  expect(verRes.exitCode).toBe(0);
1375
- expect(verRes.output.join('\n')).toMatch(/GNU nano, version 8\.0|nano.*8\.0\.0.*wasm/i);
1375
+ expect(verRes.output.join('\n')).toMatch(/GNU nano, version 8\.0|nano.*8\.0\.[0-9]+.*wasm/i);
1376
1376
 
1377
1377
  const helpRes = await run(shell, 'nano --help');
1378
1378
  expect(helpRes.exitCode).toBe(0);
@@ -1380,13 +1380,13 @@ describe('WBT GNU nano WASM package (nano / nano-wasm)', () => {
1380
1380
 
1381
1381
  const aliasVerRes = await run(shell, 'nano-wasm --version');
1382
1382
  expect(aliasVerRes.exitCode).toBe(0);
1383
- expect(aliasVerRes.output.join('\n')).toMatch(/GNU nano, version 8\.0|nano.*8\.0\.0.*wasm/i);
1383
+ expect(aliasVerRes.output.join('\n')).toMatch(/GNU nano, version 8\.0|nano.*8\.0\.[0-9]+.*wasm/i);
1384
1384
  });
1385
1385
 
1386
1386
  it('supports wbt run nano --version without permanently installing', async () => {
1387
1387
  const runRes = await run(shell, 'wbt run nano --version');
1388
1388
  expect(runRes.exitCode).toBe(0);
1389
- expect(runRes.output.join('\n')).toMatch(/GNU nano, version 8\.0|nano.*8\.0\.0.*wasm/i);
1389
+ expect(runRes.output.join('\n')).toMatch(/GNU nano, version 8\.0|nano.*8\.0\.[0-9]+.*wasm/i);
1390
1390
  expect(shell.context.fs.exists('/bin/nano')).toBe(false);
1391
1391
  });
1392
1392
 
@@ -1417,7 +1417,7 @@ describe('WBT GNU nano WASM package (nano / nano-wasm)', () => {
1417
1417
  instance.fs = shell.context.fs.sandbox();
1418
1418
  const res = await instance.runCommand();
1419
1419
  expect(res.getExitCode()).toBe(0);
1420
- expect(res.getStdOutput().map(l => l.string).join('\n')).toMatch(/GNU nano, version 8\.0|nano.*8\.0\.0.*wasm/i);
1420
+ expect(res.getStdOutput().map(l => l.string).join('\n')).toMatch(/GNU nano, version 8\.0|nano.*8\.0\.[0-9]+.*wasm/i);
1421
1421
  });
1422
1422
 
1423
1423
  it('runs nano interactively, accepts text input, writes out file, and exits cleanly', async () => {