Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function main(): Promise {
try {
let version: string = 'stable';
if (process.env.VERSION) {
version = process.env.VERSION;
}
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath: string = path.resolve(__dirname, '..', '..');
// The path to the extension test runner script
// Passed to --extensionTestsPath
const extensionTestsPath: string = path.resolve(__dirname);
console.log('downloading vscode');
await downloadAndUnzipVSCode(version);
// Download VS Code, unzip it and run the integration test
console.log('setting up tests');
await runTests({extensionDevelopmentPath, extensionTestsPath, version: version});
} catch (err) {
console.error('Failed to run tests', err);
process.exit(1);
}
}
async function main(): Promise {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath: string = path.resolve(__dirname, '../../');
const vscodeExecutablePath: string = await downloadAndUnzipVSCode('stable');
const cliPath: string = resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath);
cp.spawnSync(cliPath, ['--install-extension', 'redhat.java'], {
encoding: 'utf-8',
stdio: 'inherit',
});
cp.spawnSync(cliPath, ['--install-extension', 'vscjava.vscode-java-debug'], {
encoding: 'utf-8',
stdio: 'inherit',
});
// Run Maven JUnit 4 Code Lens tests
await runTests({
vscodeExecutablePath,
extensionDevelopmentPath,
try {
let version: string = 'stable';
if (process.env.VERSION) {
version = process.env.VERSION;
}
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath: string = path.resolve(__dirname, '..', '..');
// The path to the extension test runner script
// Passed to --extensionTestsPath
const extensionTestsPath: string = path.resolve(__dirname);
const workspacePath: string = path.resolve(__dirname, '..', '..', 'cucumber', 'data', 'cucumber.code-workspace');
const vscodeExecutablePath: string = await downloadAndUnzipVSCode(version);
const cliPath: string = resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath);
// Use cp.spawn / cp.exec for custom setup
cp.spawnSync(cliPath, ['--install-extension', 'oshri6688.javascript-test-runner'], {
encoding: 'utf-8',
stdio: 'inherit'
});
// Download VS Code, unzip it and run the integration test
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: [workspacePath],
version: version
});
for (const arg of process.argv) {
if (arg == '--fast') fastMode = true;
}
ltexDirPath = Path.resolve(__dirname, '..', '..');
let codeVersion: string = 'stable';
let codePlatform: string | undefined;
if (process.platform == 'win32') {
codeVersion = '1.35.1';
codePlatform = 'win32-x64-archive';
}
console.log('Downloading and installing VS Code...');
vscodeExecutablePath = await CodeTest.downloadAndUnzipVSCode(codeVersion, codePlatform);
console.log('Resolving CLI path to VS Code...');
cliPath = CodeTest.resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath);
for (let testIteration: number = 0; testIteration < 4; testIteration++) {
if (fastMode && (testIteration != 1)) continue;
await runTestIteration(testIteration);
}
return Promise.resolve();
}
async function go() {
const vscodeExecutablePath = await vscodetest.downloadAndUnzipVSCode();
console.log('vscodeExecutablePath ====>', vscodeExecutablePath);
const executablePath = getExecutable(vscodeExecutablePath);
console.log('executablePath ====>', executablePath);
shell.exec(`'${executablePath}' --install-extension dbaeumer.vscode-eslint`);
process.env.VSCODE_BINARY_PATH = executablePath;
console.log(
'process.env.VSCODE_BINARY_PATH => ',
process.env.VSCODE_BINARY_PATH
);
const testRunnerPath = path.join(
function downloadExecutableAndRunTests() {
downloadAndUnzipVSCode(process.env.CODE_VERSION).then(executablePath => {
runTests(executablePath)
}).catch(err => {
console.error('Failed to run test with error:')
console.log(err);
process.exit(1);
})
}
gulp.task('ext:test', async function () {
let workspace = process.env['WORKSPACE'];
if (!workspace) {
workspace = process.cwd();
}
process.env.JUNIT_REPORT_PATH = workspace + '/test-reports/ext_xunit.xml';
var args = ['--verbose', '--disable-gpu', '--disable-telemetry', '--disable-updates', '-n'];
let vscodeVersion = packageJson.engines.vscode.slice(1);
let vscodePath = await vscodeTest.downloadAndUnzipVSCode(vscodeVersion);
let extensionTestsPath = `${workspace}/out/test`;
try {
await vscodeTest.runTests({
vscodeExecutablePath: vscodePath,
extensionDevelopmentPath: workspace,
extensionTestsPath: extensionTestsPath,
launchArgs: args
});
} catch (error) {
console.log(`stdout: ${process.stdout}`);
console.log(`stderr: ${process.stderr}`);
console.error(`exec error: ${error}`);
throw(error);
}
});
import cp = require('child_process');
import path = require('path');
import { platform } from 'os';
const downloadAndUnzipVSCode = require('vscode-test').downloadAndUnzipVSCode;
downloadAndUnzipVSCode().then((executable: string) => {
if (platform() === 'darwin') {
executable = `'${path.join(executable.substring(0, executable.indexOf('.app')+4), 'Contents', 'Resources', 'app', 'bin', 'code')}'`;
} else {
executable = path.join(path.dirname(executable), 'bin', 'code');
}
cp.execSync(`${executable} --install-extension ms-kubernetes-tools.vscode-kubernetes-tools`);
});