start-command 0.26.0 → 0.27.1

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/README.md +1 -1
  3. package/bunfig.toml +2 -2
  4. package/eslint.config.mjs +1 -1
  5. package/package.json +2 -2
  6. package/src/bin/cli.js +30 -0
  7. package/src/lib/args-parser.js +72 -6
  8. package/src/lib/execution-control.js +317 -0
  9. package/src/lib/isolation.js +22 -4
  10. package/src/lib/status-formatter.js +46 -2
  11. package/src/lib/usage.js +5 -1
  12. package/test/args-parser-control.js +71 -0
  13. package/test/{args-parser.test.js → args-parser.js} +1 -1
  14. package/test/cli.js +260 -0
  15. package/test/create-github-release.mjs +118 -0
  16. package/test/docker-autoremove.js +175 -0
  17. package/test/execution-control.js +253 -0
  18. package/test/{isolation-cleanup.test.js → isolation-cleanup.js} +120 -109
  19. package/test/{isolation.test.js → isolation.js} +4 -2
  20. package/test/merge-changesets.mjs +154 -0
  21. package/test/publish-to-crates.mjs +194 -0
  22. package/test/release-name.mjs +117 -0
  23. package/test/{screen-integration.test.js → screen-integration.js} +1 -1
  24. package/test/{ssh-integration.test.js → ssh-integration.js} +1 -1
  25. package/test/{status-query.test.js → status-query.js} +2 -0
  26. package/test/{substitution.test.js → substitution.js} +1 -2
  27. package/test/{user-manager.test.js → user-manager.js} +17 -0
  28. package/test/cli.test.js +0 -218
  29. package/test/docker-autoremove.test.js +0 -164
  30. package/test/release-name.test.mjs +0 -34
  31. /package/test/{args-parser-shell.test.js → args-parser-shell.js} +0 -0
  32. /package/test/{echo-integration.test.js → echo-integration.js} +0 -0
  33. /package/test/{execution-store.test.js → execution-store.js} +0 -0
  34. /package/test/{failure-handler.test.js → failure-handler.js} +0 -0
  35. /package/test/{isolation-log-utils.test.js → isolation-log-utils.js} +0 -0
  36. /package/test/{isolation-stacking.test.js → isolation-stacking.js} +0 -0
  37. /package/test/{output-blocks.test.js → output-blocks.js} +0 -0
  38. /package/test/{public-exports.test.js → public-exports.js} +0 -0
  39. /package/test/{regression-84.test.js → regression-84.js} +0 -0
  40. /package/test/{regression-89.test.js → regression-89.js} +0 -0
  41. /package/test/{regression-91.test.js → regression-91.js} +0 -0
  42. /package/test/{sequence-parser.test.js → sequence-parser.js} +0 -0
  43. /package/test/{session-name-status.test.js → session-name-status.js} +0 -0
  44. /package/test/{version.test.js → version.js} +0 -0
@@ -0,0 +1,194 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+ import { spawn } from 'node:child_process';
3
+ import {
4
+ mkdirSync,
5
+ mkdtempSync,
6
+ readFileSync,
7
+ rmSync,
8
+ writeFileSync,
9
+ } from 'node:fs';
10
+ import { createServer } from 'node:http';
11
+ import { tmpdir } from 'node:os';
12
+ import { dirname, join, resolve } from 'node:path';
13
+ import { fileURLToPath } from 'node:url';
14
+
15
+ const testDir = dirname(fileURLToPath(import.meta.url));
16
+ const repoRoot = resolve(testDir, '../..');
17
+ const scriptPath = resolve(repoRoot, 'scripts/publish-to-crates.mjs');
18
+
19
+ function createCargoPackage(tempDir) {
20
+ const packageDir = join(tempDir, 'crate');
21
+ const cargoTomlPath = join(packageDir, 'Cargo.toml');
22
+ mkdirSync(packageDir);
23
+ writeFileSync(
24
+ cargoTomlPath,
25
+ '[package]\nname = "example-crate"\nversion = "1.2.3"\nedition = "2021"\n'
26
+ );
27
+ return packageDir;
28
+ }
29
+
30
+ function createFakeCargoBin(tempDir) {
31
+ const fakeCargoJs = join(tempDir, 'fake-cargo.cjs');
32
+ writeFileSync(
33
+ fakeCargoJs,
34
+ `
35
+ const fs = require('node:fs');
36
+ fs.writeFileSync(process.env.FAKE_CARGO_ARGS_PATH, JSON.stringify(process.argv.slice(2)));
37
+ process.exit(Number(process.env.FAKE_CARGO_EXIT || 0));
38
+ `
39
+ );
40
+
41
+ return fakeCargoJs;
42
+ }
43
+
44
+ async function withCratesServer(status, callback) {
45
+ const requests = [];
46
+ const server = createServer((request, response) => {
47
+ requests.push(request.url);
48
+ response.writeHead(status, { 'content-type': 'application/json' });
49
+ response.end(JSON.stringify({ ok: status === 200 }));
50
+ });
51
+
52
+ await new Promise((resolveListen) =>
53
+ server.listen(0, '127.0.0.1', resolveListen)
54
+ );
55
+ const { port } = server.address();
56
+
57
+ try {
58
+ return await callback(`http://127.0.0.1:${port}/api/v1`, requests);
59
+ } finally {
60
+ await new Promise((resolveClose) => server.close(resolveClose));
61
+ }
62
+ }
63
+
64
+ function runScript({
65
+ cargoToken = '',
66
+ cratesIoBaseUrl,
67
+ fakeCargo = false,
68
+ packageDir,
69
+ tempDir,
70
+ }) {
71
+ const outputPath = join(tempDir, 'github-output.txt');
72
+ const cargoArgsPath = join(tempDir, 'cargo-args.json');
73
+ const fakeCargoJs = fakeCargo ? createFakeCargoBin(tempDir) : '';
74
+
75
+ const env = {
76
+ ...process.env,
77
+ CARGO_REGISTRY_TOKEN: cargoToken,
78
+ CRATES_IO_BASE_URL: cratesIoBaseUrl,
79
+ CRATES_PUBLISH_RETRY_DELAY_MS: '1',
80
+ FAKE_CARGO_ARGS_PATH: cargoArgsPath,
81
+ GITHUB_OUTPUT: outputPath,
82
+ };
83
+
84
+ if (fakeCargoJs) {
85
+ env.START_CARGO_COMMAND = process.execPath;
86
+ env.START_CARGO_COMMAND_ARGS = JSON.stringify([fakeCargoJs]);
87
+ }
88
+
89
+ return new Promise((resolveRun, rejectRun) => {
90
+ const child = spawn('node', [scriptPath, '--working-dir', packageDir], {
91
+ cwd: repoRoot,
92
+ env,
93
+ });
94
+
95
+ let stdout = '';
96
+ let stderr = '';
97
+ child.stdout.setEncoding('utf8');
98
+ child.stderr.setEncoding('utf8');
99
+ child.stdout.on('data', (chunk) => {
100
+ stdout += chunk;
101
+ });
102
+ child.stderr.on('data', (chunk) => {
103
+ stderr += chunk;
104
+ });
105
+ child.on('error', rejectRun);
106
+ child.on('close', (status, signal) => {
107
+ resolveRun({
108
+ cargoArgsPath,
109
+ outputPath,
110
+ result: {
111
+ signal,
112
+ status,
113
+ stderr,
114
+ stdout,
115
+ },
116
+ });
117
+ });
118
+ });
119
+ }
120
+
121
+ describe('publish-to-crates script', () => {
122
+ it('reports success without a token when the version is already published', async () => {
123
+ await withCratesServer(200, async (cratesIoBaseUrl, requests) => {
124
+ const tempDir = mkdtempSync(join(tmpdir(), 'publish-crates-test-'));
125
+ const packageDir = createCargoPackage(tempDir);
126
+
127
+ try {
128
+ const { outputPath, result } = await runScript({
129
+ cratesIoBaseUrl,
130
+ packageDir,
131
+ tempDir,
132
+ });
133
+
134
+ expect(result.status).toBe(0);
135
+ expect(result.stdout).toContain('already_published=true');
136
+ expect(readFileSync(outputPath, 'utf8')).toContain('published=true');
137
+ expect(requests).toEqual(['/api/v1/crates/example-crate/1.2.3']);
138
+ } finally {
139
+ rmSync(tempDir, { force: true, recursive: true });
140
+ }
141
+ });
142
+ });
143
+
144
+ it('fails clearly when a missing version needs a crates token', async () => {
145
+ await withCratesServer(404, async (cratesIoBaseUrl) => {
146
+ const tempDir = mkdtempSync(join(tmpdir(), 'publish-crates-test-'));
147
+ const packageDir = createCargoPackage(tempDir);
148
+
149
+ try {
150
+ const { result } = await runScript({
151
+ cratesIoBaseUrl,
152
+ packageDir,
153
+ tempDir,
154
+ });
155
+
156
+ expect(result.status).not.toBe(0);
157
+ expect(result.stderr).toContain('Missing crates.io token');
158
+ } finally {
159
+ rmSync(tempDir, { force: true, recursive: true });
160
+ }
161
+ });
162
+ });
163
+
164
+ it('publishes a missing version with cargo publish', async () => {
165
+ await withCratesServer(404, async (cratesIoBaseUrl) => {
166
+ const tempDir = mkdtempSync(join(tmpdir(), 'publish-crates-test-'));
167
+ const packageDir = createCargoPackage(tempDir);
168
+
169
+ try {
170
+ const { cargoArgsPath, outputPath, result } = await runScript({
171
+ cargoToken: 'test-token',
172
+ cratesIoBaseUrl,
173
+ fakeCargo: true,
174
+ packageDir,
175
+ tempDir,
176
+ });
177
+
178
+ expect(result.status).toBe(0);
179
+ expect(result.stdout).toContain('publish_result=published');
180
+ expect(readFileSync(outputPath, 'utf8')).toContain('published=true');
181
+ expect(JSON.parse(readFileSync(cargoArgsPath, 'utf8'))).toEqual([
182
+ 'publish',
183
+ '--allow-dirty',
184
+ '--manifest-path',
185
+ join(packageDir, 'Cargo.toml'),
186
+ '--token',
187
+ 'test-token',
188
+ ]);
189
+ } finally {
190
+ rmSync(tempDir, { force: true, recursive: true });
191
+ }
192
+ });
193
+ });
194
+ });
@@ -0,0 +1,117 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+ import {
3
+ encodeShieldsStaticBadgeSegment,
4
+ extractChangelogEntry,
5
+ normalizeReleaseVersionForBadge,
6
+ packageVersionBadge,
7
+ releaseName,
8
+ releaseTag,
9
+ } from '../../scripts/release-name.mjs';
10
+
11
+ describe('releaseTag', () => {
12
+ it('uses plain "v${version}" when no prefix is given', () => {
13
+ expect(releaseTag('0.25.4')).toBe('v0.25.4');
14
+ expect(releaseTag('0.25.4', '')).toBe('v0.25.4');
15
+ });
16
+
17
+ it('prepends known language prefixes', () => {
18
+ expect(releaseTag('0.25.4', 'js-')).toBe('js-v0.25.4');
19
+ expect(releaseTag('0.14.0', 'rust-')).toBe('rust-v0.14.0');
20
+ });
21
+
22
+ it('passes arbitrary prefixes through', () => {
23
+ expect(releaseTag('1.0.0', 'api-')).toBe('api-v1.0.0');
24
+ });
25
+ });
26
+
27
+ describe('releaseName', () => {
28
+ it('returns bare version when prefix is empty (preserves pre-issue-108 behaviour)', () => {
29
+ expect(releaseName('0.25.4')).toBe('0.25.4');
30
+ expect(releaseName('0.25.4', '')).toBe('0.25.4');
31
+ });
32
+
33
+ it('decorates known language prefixes with human titles', () => {
34
+ expect(releaseName('0.25.4', 'js-')).toBe('[JavaScript] 0.25.4');
35
+ expect(releaseName('0.14.0', 'rust-')).toBe('[Rust] 0.14.0');
36
+ });
37
+
38
+ it('falls back to "${prefix}${version}" for unknown prefixes', () => {
39
+ expect(releaseName('1.0.0', 'api-')).toBe('api-1.0.0');
40
+ });
41
+ });
42
+
43
+ describe('release badge helpers', () => {
44
+ it('strips plain and language-prefixed v tags before building badge versions', () => {
45
+ expect(normalizeReleaseVersionForBadge('v1.2.3')).toBe('1.2.3');
46
+ expect(normalizeReleaseVersionForBadge('js-v1.2.3')).toBe('1.2.3');
47
+ expect(normalizeReleaseVersionForBadge('rust-v0.14.1')).toBe('0.14.1');
48
+ });
49
+
50
+ it('escapes shields.io static badge path delimiters in prerelease versions', () => {
51
+ expect(encodeShieldsStaticBadgeSegment('1.0.0-alpha_1')).toBe(
52
+ '1.0.0--alpha__1'
53
+ );
54
+ });
55
+
56
+ it('builds an exact npm version badge without leaking the js tag prefix', () => {
57
+ const badge = packageVersionBadge({
58
+ packageType: 'npm',
59
+ packageName: 'start-command',
60
+ releaseVersion: 'js-v1.2.3',
61
+ });
62
+
63
+ expect(badge).toContain('/badge/npm-1.2.3-blue.svg');
64
+ expect(badge).not.toContain('/badge/npm-js-v1.2.3-blue.svg');
65
+ expect(badge).toContain('/start-command/v/1.2.3');
66
+ });
67
+
68
+ it('builds an exact crates.io version badge without leaking the rust tag prefix', () => {
69
+ const badge = packageVersionBadge({
70
+ packageType: 'crates',
71
+ packageName: 'start-command',
72
+ releaseVersion: 'rust-v0.14.1',
73
+ });
74
+
75
+ expect(badge).toContain('/badge/crates.io-0.14.1-orange.svg');
76
+ expect(badge).not.toContain('/badge/crates.io-rust-v0.14.1-orange.svg');
77
+ expect(badge).toContain('/crates/start-command/0.14.1');
78
+ });
79
+ });
80
+
81
+ describe('extractChangelogEntry', () => {
82
+ it('extracts a Changesets-style JavaScript entry', () => {
83
+ const changelog = `# start-command
84
+
85
+ ## 1.2.3
86
+
87
+ ### Patch Changes
88
+
89
+ - Fix release badges.
90
+
91
+ ## 1.2.2
92
+
93
+ - Previous change.
94
+ `;
95
+
96
+ expect(extractChangelogEntry(changelog, 'js-v1.2.3')).toBe(
97
+ '### Patch Changes\n\n- Fix release badges.'
98
+ );
99
+ });
100
+
101
+ it('extracts a Keep-a-Changelog-style Rust entry', () => {
102
+ const changelog = `# Changelog
103
+
104
+ ## [0.14.1] - 2026-05-02
105
+
106
+ - Fix Rust release automation.
107
+
108
+ ## [0.14.0] - 2026-04-24
109
+
110
+ - Previous change.
111
+ `;
112
+
113
+ expect(extractChangelogEntry(changelog, 'rust-v0.14.1')).toBe(
114
+ '- Fix Rust release automation.'
115
+ );
116
+ });
117
+ });
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Integration tests for screen isolation
4
4
  * Tests actual screen session behavior including output capture, exit codes, and edge cases.
5
- * Extracted from isolation.test.js to keep file sizes under the 1000-line limit.
5
+ * Extracted from isolation.js to keep file sizes under the 1000-line limit.
6
6
  */
7
7
 
8
8
  const { describe, it } = require('node:test');
@@ -9,7 +9,7 @@
9
9
  * To run locally:
10
10
  * 1. Ensure SSH server is running
11
11
  * 2. Set up passwordless SSH to localhost (ssh-keygen, ssh-copy-id localhost)
12
- * 3. Run: bun test test/ssh-integration.test.js
12
+ * 3. Run: bun run test test/ssh-integration.js
13
13
  */
14
14
 
15
15
  const { describe, it, before } = require('node:test');
@@ -123,6 +123,7 @@ describe('--status query functionality', () => {
123
123
  expect(parsed.status).toBe('executed');
124
124
  expect(parsed.exitCode).toBe(0);
125
125
  expect(parsed.pid).toBe(12345);
126
+ expect(parsed.processIds).toEqual({ wrapperPid: 12345 });
126
127
  });
127
128
  });
128
129
 
@@ -215,6 +216,7 @@ describe('--status query functionality', () => {
215
216
  (record) => record.uuid === executingRecord.uuid
216
217
  );
217
218
  expect(executing.status).toBe('executing');
219
+ expect(executing.processIds).toEqual({ wrapperPid: 99999 });
218
220
  expect(executing.currentTime).toBeDefined();
219
221
  });
220
222
 
@@ -225,11 +225,10 @@ function runTests() {
225
225
  console.log(` Expected: "${test.expected}"`);
226
226
  console.log(` Got: "${actual}"`);
227
227
  });
228
- process.exit(1);
228
+ throw new Error(`${failed} substitution tests failed`);
229
229
  }
230
230
 
231
231
  console.log('\n✓ All tests passed!\n');
232
- process.exit(0);
233
232
  }
234
233
 
235
234
  // Run tests
@@ -17,6 +17,8 @@ const {
17
17
  getUserInfo,
18
18
  } = require('../src/lib/user-manager');
19
19
 
20
+ const isWindows = process.platform === 'win32';
21
+
20
22
  describe('user-manager', () => {
21
23
  describe('getCurrentUser', () => {
22
24
  it('should return a non-empty string', () => {
@@ -27,6 +29,11 @@ describe('user-manager', () => {
27
29
 
28
30
  it('should return a valid username format', () => {
29
31
  const user = getCurrentUser();
32
+ if (isWindows) {
33
+ assert.ok(!/[\r\n]/.test(user));
34
+ return;
35
+ }
36
+
30
37
  // Username should contain only valid characters
31
38
  assert.ok(/^[a-zA-Z0-9_-]+$/.test(user));
32
39
  });
@@ -55,6 +62,11 @@ describe('user-manager', () => {
55
62
  describe('userExists', () => {
56
63
  it('should return true for current user', () => {
57
64
  const currentUser = getCurrentUser();
65
+ if (isWindows) {
66
+ assert.strictEqual(typeof userExists(currentUser), 'boolean');
67
+ return;
68
+ }
69
+
58
70
  assert.strictEqual(userExists(currentUser), true);
59
71
  });
60
72
 
@@ -130,6 +142,11 @@ describe('user-manager', () => {
130
142
  it('should return user info for current user', () => {
131
143
  const currentUser = getCurrentUser();
132
144
  const info = getUserInfo(currentUser);
145
+ if (isWindows) {
146
+ assert.strictEqual(typeof info.exists, 'boolean');
147
+ return;
148
+ }
149
+
133
150
  assert.strictEqual(info.exists, true);
134
151
  });
135
152
 
package/test/cli.test.js DELETED
@@ -1,218 +0,0 @@
1
- #!/usr/bin/env bun
2
- /**
3
- * Unit tests for the CLI
4
- * Tests version flag and basic CLI behavior
5
- */
6
-
7
- const { describe, it } = require('node:test');
8
- const assert = require('assert');
9
- const { spawnSync } = require('child_process');
10
- const path = require('path');
11
- const fs = require('fs');
12
-
13
- // Path to the CLI script
14
- const CLI_PATH = path.join(__dirname, '../src/bin/cli.js');
15
-
16
- // Timeout for CLI operations - longer on Windows due to cold-start latency
17
- const CLI_TIMEOUT = process.platform === 'win32' ? 30000 : 10000;
18
-
19
- // Helper to run CLI with timeout
20
- function runCLI(args = []) {
21
- return spawnSync('bun', [CLI_PATH, ...args], {
22
- encoding: 'utf8',
23
- timeout: CLI_TIMEOUT,
24
- env: {
25
- ...process.env,
26
- START_DISABLE_AUTO_ISSUE: '1',
27
- START_DISABLE_LOG_UPLOAD: '1',
28
- },
29
- });
30
- }
31
-
32
- describe('CLI version flag', () => {
33
- it('should display version with --version', () => {
34
- const result = runCLI(['--version']);
35
-
36
- // Check if process was killed (e.g., due to timeout)
37
- assert.notStrictEqual(
38
- result.status,
39
- null,
40
- `Process should complete (was killed with signal: ${result.signal})`
41
- );
42
- assert.strictEqual(result.status, 0, 'Exit code should be 0');
43
-
44
- // Check for key elements in version output
45
- assert.ok(
46
- result.stdout.includes('start-command version:'),
47
- 'Should display start-command version'
48
- );
49
- assert.ok(result.stdout.includes('OS:'), 'Should display OS');
50
- assert.ok(
51
- result.stdout.includes('OS Version:'),
52
- 'Should display OS Version'
53
- );
54
- // Check for either Bun or Node.js version depending on runtime
55
- const hasBunVersion = result.stdout.includes('Bun Version:');
56
- const hasNodeVersion = result.stdout.includes('Node.js Version:');
57
- assert.ok(
58
- hasBunVersion || hasNodeVersion,
59
- 'Should display Bun Version or Node.js Version'
60
- );
61
- assert.ok(
62
- result.stdout.includes('Architecture:'),
63
- 'Should display Architecture'
64
- );
65
- assert.ok(
66
- result.stdout.includes('Isolation tools:'),
67
- 'Should display Isolation tools section'
68
- );
69
- assert.ok(
70
- result.stdout.includes('screen:'),
71
- 'Should check for screen installation'
72
- );
73
- assert.ok(
74
- result.stdout.includes('tmux:'),
75
- 'Should check for tmux installation'
76
- );
77
- assert.ok(
78
- result.stdout.includes('docker:'),
79
- 'Should check for docker installation'
80
- );
81
- });
82
-
83
- it('should display version with -v', () => {
84
- const result = runCLI(['-v']);
85
-
86
- assert.strictEqual(result.status, 0, 'Exit code should be 0');
87
- assert.ok(
88
- result.stdout.includes('start-command version:'),
89
- 'Should display start-command version'
90
- );
91
- });
92
-
93
- it('should show correct package version', () => {
94
- const result = runCLI(['--version']);
95
- const packageJson = JSON.parse(
96
- fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8')
97
- );
98
-
99
- assert.ok(
100
- result.stdout.includes(`start-command version: ${packageJson.version}`),
101
- `Should display version ${packageJson.version}`
102
- );
103
- });
104
- });
105
-
106
- describe('CLI basic behavior', () => {
107
- it('should show usage when no arguments provided', () => {
108
- const result = runCLI([]);
109
-
110
- assert.strictEqual(result.status, 0, 'Exit code should be 0');
111
- assert.ok(result.stdout.includes('Usage:'), 'Should display usage');
112
- assert.ok(
113
- result.stdout.includes('--version'),
114
- 'Usage should mention --version flag'
115
- );
116
- });
117
-
118
- it('should show usage when no command provided after --', () => {
119
- const result = runCLI(['--']);
120
-
121
- assert.strictEqual(result.status, 0, 'Exit code should be 0');
122
- assert.ok(result.stdout.includes('Usage:'), 'Should display usage');
123
- });
124
- });
125
-
126
- describe('CLI isolation output (issue #67)', () => {
127
- const { isCommandAvailable } = require('../src/lib/isolation');
128
-
129
- it('should display screen session name when using screen isolation', async () => {
130
- if (!isCommandAvailable('screen')) {
131
- console.log(' Skipping: screen not installed');
132
- return;
133
- }
134
-
135
- const result = runCLI(['-i', 'screen', '--', 'echo', 'hello']);
136
-
137
- // The output should contain the screen session name (in format screen-timestamp-random)
138
- // Check that the session UUID is displayed
139
- assert.ok(
140
- result.stdout.includes('│ session'),
141
- 'Should display session UUID'
142
- );
143
- // Check that screen isolation info is displayed
144
- assert.ok(
145
- result.stdout.includes('│ isolation screen'),
146
- 'Should display screen isolation'
147
- );
148
- // Check that the actual screen session name is displayed (issue #67 fix)
149
- assert.ok(
150
- result.stdout.includes('│ screen screen-'),
151
- 'Should display actual screen session name for reconnection (issue #67)'
152
- );
153
- });
154
-
155
- it('should display tmux session name when using tmux isolation', async () => {
156
- if (!isCommandAvailable('tmux')) {
157
- console.log(' Skipping: tmux not installed');
158
- return;
159
- }
160
-
161
- const result = runCLI(['-i', 'tmux', '--', 'echo', 'hello']);
162
-
163
- // The output should contain the tmux session name
164
- assert.ok(
165
- result.stdout.includes('│ session'),
166
- 'Should display session UUID'
167
- );
168
- assert.ok(
169
- result.stdout.includes('│ isolation tmux'),
170
- 'Should display tmux isolation'
171
- );
172
- // Check that the actual tmux session name is displayed (issue #67 fix)
173
- assert.ok(
174
- result.stdout.includes('│ tmux tmux-'),
175
- 'Should display actual tmux session name for reconnection (issue #67)'
176
- );
177
- });
178
-
179
- it('should display docker container name when using docker isolation', async () => {
180
- const { canRunLinuxDockerImages } = require('../src/lib/isolation');
181
-
182
- if (!canRunLinuxDockerImages()) {
183
- console.log(
184
- ' Skipping: docker not available or cannot run Linux images'
185
- );
186
- return;
187
- }
188
-
189
- const result = runCLI([
190
- '-i',
191
- 'docker',
192
- '--image',
193
- 'alpine:latest',
194
- '--',
195
- 'echo',
196
- 'hello',
197
- ]);
198
-
199
- // The output should contain the docker container name
200
- assert.ok(
201
- result.stdout.includes('│ session'),
202
- 'Should display session UUID'
203
- );
204
- assert.ok(
205
- result.stdout.includes('│ isolation docker'),
206
- 'Should display docker isolation'
207
- );
208
- assert.ok(
209
- result.stdout.includes('│ image alpine:latest'),
210
- 'Should display docker image'
211
- );
212
- // Check that the actual container name is displayed (issue #67 fix)
213
- assert.ok(
214
- result.stdout.includes('│ container docker-'),
215
- 'Should display actual container name for reconnection (issue #67)'
216
- );
217
- });
218
- });