Skip to content

Commit

Permalink
Use custom dir to disable update
Browse files Browse the repository at this point in the history
Needs to be in short dir name, see microsoft/vscode#86382
  • Loading branch information
badsyntax committed May 18, 2020
1 parent 71435d5 commit 6705828
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 5 deletions.
43 changes: 43 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"publish": "vsce publish"
},
"devDependencies": {
"@types/fs-extra": "^9.0.0",
"@types/glob": "^7.1.1",
"@types/mocha": "^7.0.2",
"@types/node": "^12.12.39",
Expand All @@ -71,6 +72,7 @@
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3",
"fs-extra": "^9.0.0",
"glob": "^7.1.6",
"mocha": "^7.1.1",
"prettier": "^2.0.5",
Expand Down
24 changes: 20 additions & 4 deletions src/test/runTest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as path from 'path';
import * as cp from 'child_process';
import * as fs from 'fs-extra';
import * as os from 'os';

import {
runTests,
Expand All @@ -10,10 +12,21 @@ import {
const VSCODE_VERSION = '1.45.0';

async function main(): Promise<void> {
try {
const extensionDevelopmentPath = path.resolve(__dirname, '../..');
const extensionTestsPath = path.resolve(__dirname, './suite/index');
const extensionDevelopmentPath = path.resolve(__dirname, '../..');
const extensionTestsPath = path.resolve(__dirname, './suite/index');
const fixturePath = path.resolve(
__dirname,
'../../test-fixtures/gradle-project/'
);
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'vscode-user'));
fs.copySync(
path.resolve(__dirname, '../../test-fixtures/vscode-user/User'),
path.join(tmpDir, 'User')
);

console.log('USER DIR', tmpDir);

try {
const vscodeExecutablePath = await downloadAndUnzipVSCode(VSCODE_VERSION);
const cliPath = resolveCliPathFromVSCodeExecutablePath(
vscodeExecutablePath
Expand All @@ -33,7 +46,7 @@ async function main(): Promise<void> {
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: [
path.resolve(__dirname, '../../test-fixtures/gradle-project/'),
fixturePath,
'--disable-extension=vscjava.vscode-java-pack',
'--disable-extension=redhat.java',
'--disable-extension=vscjava.vscode-java-dependency',
Expand All @@ -42,11 +55,14 @@ async function main(): Promise<void> {
'--disable-extension=eamodio.gitlens',
'--disable-extension=sonarsource.sonarlint-vscode',
'--disable-extension=esbenp.prettier-vscode',
`--user-data-dir=${tmpDir}`,
],
});
} catch (err) {
console.error('Failed to run tests', err.message);
process.exit(1);
} finally {
fs.removeSync(tmpDir);
}
}

Expand Down
1 change: 0 additions & 1 deletion test-fixtures/gradle-project/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"source.fixAll.spotlessGradle": true,
},
"java.format.enabled": false,
"update.mode": "none",
"[java]": {
"editor.defaultFormatter": "richardwillis.vscode-spotless-gradle"
},
Expand Down
3 changes: 3 additions & 0 deletions test-fixtures/vscode-user/User/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"update.mode": "none"
}

0 comments on commit 6705828

Please sign in to comment.