mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
smoke: create test_data in tmp
This commit is contained in:
@@ -30,7 +30,6 @@ function configureEnvironment {
|
||||
id -u testuser &>/dev/null || (useradd -m testuser; chpasswd <<< testuser:testpassword)
|
||||
sudo -i -u testuser git config --global user.name "VS Code Agent"
|
||||
sudo -i -u testuser git config --global user.email "monacotools@microsoft.com"
|
||||
chown -R testuser $AGENT_BUILDDIRECTORY
|
||||
}
|
||||
|
||||
step "Configure environment" \
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"rimraf": "^2.6.1",
|
||||
"spectron": "~3.6.4",
|
||||
"strip-json-comments": "^2.0.1",
|
||||
"tmp": "0.0.33",
|
||||
"typescript": "^2.2.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-4
@@ -7,17 +7,21 @@ import * as fs from 'fs';
|
||||
import * as https from 'https';
|
||||
import * as cp from 'child_process';
|
||||
import * as path from 'path';
|
||||
import * as mkdirp from 'mkdirp';
|
||||
import * as minimist from 'minimist';
|
||||
import * as tmp from 'tmp';
|
||||
import * as rimraf from 'rimraf';
|
||||
|
||||
const [, , ...args] = process.argv;
|
||||
const opts = minimist(args, { string: ['build', 'stable-build'] });
|
||||
|
||||
const testDataPath = path.join(__dirname, '..', 'test_data');
|
||||
const tmpDir = tmp.dirSync() as { name: string; removeCallback: Function; };
|
||||
const testDataPath = tmpDir.name;
|
||||
process.once('exit', () => rimraf.sync(testDataPath));
|
||||
|
||||
const workspacePath = path.join(testDataPath, 'smoketest.code-workspace');
|
||||
const testRepoUrl = 'https://github.com/Microsoft/vscode-smoketest-express';
|
||||
const testRepoLocalDir = path.join(testDataPath, 'vscode-smoketest-express');
|
||||
mkdirp.sync(testDataPath);
|
||||
const keybindingsPath = path.join(testDataPath, 'keybindings.json');
|
||||
|
||||
function fail(errorMessage): void {
|
||||
console.error(errorMessage);
|
||||
@@ -67,8 +71,11 @@ if (!fs.existsSync(testCodePath)) {
|
||||
fail(`Can't find Code at ${testCodePath}.`);
|
||||
}
|
||||
|
||||
process.env.VSCODE_USER_DIR = path.join(testDataPath, 'user-dir');
|
||||
process.env.VSCODE_EXTENSIONS_DIR = path.join(testDataPath, 'extensions-dir');
|
||||
process.env.SMOKETEST_REPO = testRepoLocalDir;
|
||||
process.env.VSCODE_WORKSPACE_PATH = workspacePath;
|
||||
process.env.VSCODE_KEYBINDINGS_PATH = keybindingsPath;
|
||||
|
||||
if ((testCodePath.indexOf('Code - Insiders') /* macOS/Windows */ || testCodePath.indexOf('code-insiders') /* Linux */) >= 0) {
|
||||
process.env.VSCODE_EDITION = 'insiders';
|
||||
@@ -91,6 +98,7 @@ function toUri(path: string): string {
|
||||
}
|
||||
|
||||
async function main(): Promise<void> {
|
||||
console.log('*** Test data:', testDataPath);
|
||||
console.log('*** Preparing smoketest setup...');
|
||||
|
||||
const keybindingsUrl = `https://raw.githubusercontent.com/Microsoft/vscode-docs/master/scripts/keybindings/doc.keybindings.${getKeybindingPlatform()}.json`;
|
||||
@@ -98,7 +106,7 @@ async function main(): Promise<void> {
|
||||
|
||||
await new Promise((c, e) => {
|
||||
https.get(keybindingsUrl, res => {
|
||||
const output = fs.createWriteStream(path.join(testDataPath, 'keybindings.json'));
|
||||
const output = fs.createWriteStream(keybindingsPath);
|
||||
res.on('error', e);
|
||||
output.on('error', e);
|
||||
output.on('close', c);
|
||||
|
||||
@@ -10,12 +10,12 @@ import { Workbench } from '../areas/workbench/workbench';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
export const LATEST_PATH = process.env.VSCODE_PATH || '';
|
||||
export const LATEST_PATH = process.env.VSCODE_PATH as string;
|
||||
export const STABLE_PATH = process.env.VSCODE_STABLE_PATH || '';
|
||||
export const WORKSPACE_PATH = process.env.SMOKETEST_REPO || '';
|
||||
export const CODE_WORKSPACE_PATH = process.env.VSCODE_WORKSPACE_PATH || '';
|
||||
export const USER_DIR = path.resolve(path.join(__dirname, '../../test_data/temp_user_dir'));
|
||||
export const EXTENSIONS_DIR = path.resolve(path.join(__dirname, '../../test_data/temp_extensions_dir'));
|
||||
export const WORKSPACE_PATH = process.env.SMOKETEST_REPO as string;
|
||||
export const CODE_WORKSPACE_PATH = process.env.VSCODE_WORKSPACE_PATH as string;
|
||||
export const USER_DIR = process.env.VSCODE_USER_DIR as string;
|
||||
export const EXTENSIONS_DIR = process.env.VSCODE_EXTENSIONS_DIR as string;
|
||||
|
||||
/**
|
||||
* Wraps Spectron's Application instance with its used methods.
|
||||
@@ -129,7 +129,7 @@ export class SpectronApplication {
|
||||
}
|
||||
|
||||
private retrieveKeybindings() {
|
||||
fs.readFile(path.join(__dirname, '../../test_data/keybindings.json'), 'utf8', (err, data) => {
|
||||
fs.readFile(process.env.VSCODE_KEYBINDINGS_PATH as string, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user