mirror of
https://github.com/coder/code-server.git
synced 2026-05-06 04:25:19 +02:00
chore(vscode): update to 1.55.2
This commit is contained in:
@@ -4,9 +4,10 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import { parseExtensionHostPort, parseUserDataDir } from 'vs/platform/environment/node/environmentService';
|
||||
import { parseExtensionHostPort } from 'vs/platform/environment/common/environmentService';
|
||||
import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
|
||||
suite('EnvironmentService', () => {
|
||||
|
||||
@@ -44,15 +45,6 @@ suite('EnvironmentService', () => {
|
||||
assert.deepStrictEqual(parse(['--inspect-extensions=1234', '--inspect-brk-extensions=5678', '--debugId=7']), { port: 5678, break: true, debugId: '7' });
|
||||
});
|
||||
|
||||
test('userDataPath', () => {
|
||||
const parse = (a: string[], b: { cwd: () => string, env: { [key: string]: string } }) => parseUserDataDir(parseArgs(a, OPTIONS), <any>b);
|
||||
|
||||
assert.equal(parse(['--user-data-dir', './dir'], { cwd: () => '/foo', env: {} }), path.resolve('/foo/dir'),
|
||||
'should use cwd when --user-data-dir is specified');
|
||||
assert.equal(parse(['--user-data-dir', './dir'], { cwd: () => '/foo', env: { 'VSCODE_CWD': '/bar' } }), path.resolve('/bar/dir'),
|
||||
'should use VSCODE_CWD as the cwd when --user-data-dir is specified');
|
||||
});
|
||||
|
||||
// https://github.com/microsoft/vscode/issues/78440
|
||||
test('careful with boolean file names', function () {
|
||||
let actual = parseArgs(['-r', 'arg.txt'], OPTIONS);
|
||||
@@ -63,4 +55,15 @@ suite('EnvironmentService', () => {
|
||||
assert(actual['reuse-window']);
|
||||
assert.deepStrictEqual(actual._, ['true.txt']);
|
||||
});
|
||||
|
||||
test('userDataDir', () => {
|
||||
const service1 = new NativeEnvironmentService(parseArgs(process.argv, OPTIONS), { _serviceBrand: undefined, ...product });
|
||||
assert.ok(service1.userDataPath.length > 0);
|
||||
|
||||
const args = parseArgs(process.argv, OPTIONS);
|
||||
args['user-data-dir'] = '/userDataDir/folder';
|
||||
|
||||
const service2 = new NativeEnvironmentService(args, { _serviceBrand: undefined, ...product });
|
||||
assert.notStrictEqual(service1.userDataPath, service2.userDataPath);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -37,9 +37,9 @@ suite('Native Modules (all platforms)', () => {
|
||||
assert.ok(typeof spdlog.createRotatingLogger === 'function', testErrorMessage('spdlog'));
|
||||
});
|
||||
|
||||
test('vscode-nsfw', async () => {
|
||||
const nsfWatcher = await import('vscode-nsfw');
|
||||
assert.ok(typeof nsfWatcher === 'function', testErrorMessage('vscode-nsfw'));
|
||||
test('nsfw', async () => {
|
||||
const nsfWatcher = await import('nsfw');
|
||||
assert.ok(typeof nsfWatcher === 'function', testErrorMessage('nsfw'));
|
||||
});
|
||||
|
||||
test('vscode-sqlite3', async () => {
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { OPTIONS, parseArgs } from 'vs/platform/environment/node/argv';
|
||||
import { getUserDataPath } from 'vs/platform/environment/node/userDataPath';
|
||||
|
||||
suite('User data path', () => {
|
||||
|
||||
test('getUserDataPath - default', () => {
|
||||
const path = getUserDataPath(parseArgs(process.argv, OPTIONS));
|
||||
assert.ok(path.length > 0);
|
||||
});
|
||||
|
||||
test('getUserDataPath - portable mode', () => {
|
||||
const origPortable = process.env['VSCODE_PORTABLE'];
|
||||
try {
|
||||
const portableDir = 'portable-dir';
|
||||
process.env['VSCODE_PORTABLE'] = portableDir;
|
||||
|
||||
const path = getUserDataPath(parseArgs(process.argv, OPTIONS));
|
||||
assert.ok(path.includes(portableDir));
|
||||
} finally {
|
||||
if (typeof origPortable === 'string') {
|
||||
process.env['VSCODE_PORTABLE'] = origPortable;
|
||||
} else {
|
||||
delete process.env['VSCODE_PORTABLE'];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('getUserDataPath - --user-data-dir', () => {
|
||||
const cliUserDataDir = 'cli-data-dir';
|
||||
const args = parseArgs(process.argv, OPTIONS);
|
||||
args['user-data-dir'] = cliUserDataDir;
|
||||
|
||||
const path = getUserDataPath(args);
|
||||
assert.ok(path.includes(cliUserDataDir));
|
||||
});
|
||||
|
||||
test('getUserDataPath - VSCODE_APPDATA', () => {
|
||||
const origAppData = process.env['VSCODE_APPDATA'];
|
||||
try {
|
||||
const appDataDir = 'appdata-dir';
|
||||
process.env['VSCODE_APPDATA'] = appDataDir;
|
||||
|
||||
const path = getUserDataPath(parseArgs(process.argv, OPTIONS));
|
||||
assert.ok(path.includes(appDataDir));
|
||||
} finally {
|
||||
if (typeof origAppData === 'string') {
|
||||
process.env['VSCODE_APPDATA'] = origAppData;
|
||||
} else {
|
||||
delete process.env['VSCODE_APPDATA'];
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user