Skip to content

Commit a27d274

Browse files
committed
Update test
1 parent 0ccd383 commit a27d274

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/test/suite/session.test.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as vscode from 'vscode';
22
import * as sinon from 'sinon';
33
import * as assert from 'assert';
44
import * as path from 'path';
5+
import * as os from 'os';
56
import * as fs from 'fs-extra';
67

78
import { mockExtensionContext } from '../common/mockvscode';
@@ -228,9 +229,11 @@ suite('Session Communication', () => {
228229
throw new Error('attach command should be a source(...) call');
229230
}
230231

231-
const scriptPath = commandMatch[1].slice(1, -1);
232+
const scriptPath = JSON.parse(commandMatch[1]) as string;
232233
const scriptStat = await fs.stat(scriptPath);
233-
assert.strictEqual(scriptStat.mode & 0o777, 0o600, 'attach script should be owner-only');
234+
if (process.platform !== 'win32') {
235+
assert.strictEqual(scriptStat.mode & 0o777, 0o600, 'attach script should be owner-only');
236+
}
234237

235238
const pipePath = session.globalPipePath;
236239
assert.ok(pipePath, 'global pipe path should be set');
@@ -242,9 +245,11 @@ suite('Session Communication', () => {
242245

243246
const sessionFilePid = `perm-test-${process.pid}`;
244247
await session.writeSessionFile(sessionFilePid, pipePath ?? '');
245-
const sessionFilePath = path.join(process.env.HOME ?? '', '.vscode-R', 'sessions', `${sessionFilePid}.json`);
248+
const sessionFilePath = path.join(os.homedir(), '.vscode-R', 'sessions', `${sessionFilePid}.json`);
246249
const sessionFileStat = await fs.stat(sessionFilePath);
247-
assert.strictEqual(sessionFileStat.mode & 0o777, 0o600, 'session handoff file should be owner-only');
250+
if (process.platform !== 'win32') {
251+
assert.strictEqual(sessionFileStat.mode & 0o777, 0o600, 'session handoff file should be owner-only');
252+
}
248253
await fs.remove(sessionFilePath);
249254

250255
await session.shutdownSessionWatcher();

0 commit comments

Comments
 (0)