Azure DevOps pipeline - generate unique test result names (#105148)

* Set suite name based on environment variable
This commit is contained in:
Ladislau Szomoru 2020-08-21 15:05:15 +02:00 committed by GitHub
parent 25ad7485b3
commit 06730e3e29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 78 additions and 15 deletions

View file

@ -6,14 +6,24 @@
const path = require('path');
const testRunner = require('vscode/lib/testrunner');
const suite = 'Integration Emmet Tests';
const options: any = {
ui: 'tdd',
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000
};
// These integration tests is being run in multiple environments (electron, web, remote)
// so we need to set the suite name based on the environment as the suite name is used
// for the test results file name
let suite = '';
if (process.env.VSCODE_BROWSER) {
suite = `${process.env.VSCODE_BROWSER} Browser Integration Emmet Tests`;
} else if (process.env.REMOTE_VSCODE) {
suite = 'Remote Integration Emmet Tests';
} else {
suite = 'Integration Emmet Tests';
}
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
options.reporter = 'mocha-multi-reporters';
options.reporterOptions = {

View file

@ -6,14 +6,24 @@
const path = require('path');
const testRunner = require('vscode/lib/testrunner');
const suite = 'Integration Git Tests';
const options: any = {
ui: 'tdd',
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000
};
// These integration tests is being run in multiple environments (electron, web, remote)
// so we need to set the suite name based on the environment as the suite name is used
// for the test results file name
let suite = '';
if (process.env.VSCODE_BROWSER) {
suite = `${process.env.VSCODE_BROWSER} Browser Integration Git Tests`;
} else if (process.env.REMOTE_VSCODE) {
suite = 'Remote Integration Git Tests';
} else {
suite = 'Integration Git Tests';
}
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
options.reporter = 'mocha-multi-reporters';
options.reporterOptions = {

View file

@ -6,14 +6,24 @@
const path = require('path');
const testRunner = require('vscode/lib/testrunner');
const suite = 'Integration Markdown Tests';
const options: any = {
ui: 'tdd',
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000
};
// These integration tests is being run in multiple environments (electron, web, remote)
// so we need to set the suite name based on the environment as the suite name is used
// for the test results file name
let suite = '';
if (process.env.VSCODE_BROWSER) {
suite = `${process.env.VSCODE_BROWSER} Browser Integration Markdown Tests`;
} else if (process.env.REMOTE_VSCODE) {
suite = 'Remote Integration Markdown Tests';
} else {
suite = 'Integration Markdown Tests';
}
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
options.reporter = 'mocha-multi-reporters';
options.reporterOptions = {

View file

@ -6,14 +6,24 @@
const path = require('path');
const testRunner = require('vscode/lib/testrunner');
const suite = 'Integration Single Folder Tests';
const options: any = {
ui: 'tdd',
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000
};
// These integration tests is being run in multiple environments (electron, web, remote)
// so we need to set the suite name based on the environment as the suite name is used
// for the test results file name
let suite = '';
if (process.env.VSCODE_BROWSER) {
suite = `${process.env.VSCODE_BROWSER} Browser Integration Single Folder Tests`;
} else if (process.env.REMOTE_VSCODE) {
suite = 'Remote Integration Single Folder Tests';
} else {
suite = 'Integration Single Folder Tests';
}
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
options.reporter = 'mocha-multi-reporters';
options.reporterOptions = {

View file

@ -6,14 +6,24 @@
const path = require('path');
const testRunner = require('vscode/lib/testrunner');
const suite = 'Integration Workspace Tests';
const options: any = {
ui: 'tdd',
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000
};
// These integration tests is being run in multiple environments (electron, web, remote)
// so we need to set the suite name based on the environment as the suite name is used
// for the test results file name
let suite = '';
if (process.env.VSCODE_BROWSER) {
suite = `${process.env.VSCODE_BROWSER} Browser Integration Workspace Tests`;
} else if (process.env.REMOTE_VSCODE) {
suite = 'Remote Integration Workspace Tests';
} else {
suite = 'Integration Workspace Tests';
}
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
options.reporter = 'mocha-multi-reporters';
options.reporterOptions = {

View file

@ -6,14 +6,24 @@
const path = require('path');
const testRunner = require('vscode/lib/testrunner');
const suite = 'Integration Notebook Tests';
const options: any = {
ui: 'tdd',
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000
};
// These integration tests is being run in multiple environments (electron, web, remote)
// so we need to set the suite name based on the environment as the suite name is used
// for the test results file name
let suite = '';
if (process.env.VSCODE_BROWSER) {
suite = `${process.env.VSCODE_BROWSER} Browser Integration Notebook Tests`;
} else if (process.env.REMOTE_VSCODE) {
suite = 'Remote Integration Notebook Tests';
} else {
suite = 'Integration Notebook Tests';
}
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
options.reporter = 'mocha-multi-reporters';
options.reporterOptions = {

View file

@ -29,7 +29,9 @@ if (optimist.argv.help) {
const width = 1200;
const height = 800;
async function runTestsInBrowser(browserType: 'chromium' | 'firefox' | 'webkit', endpoint: url.UrlWithStringQuery, server: cp.ChildProcess): Promise<void> {
type BrowserType = 'chromium' | 'firefox' | 'webkit';
async function runTestsInBrowser(browserType: BrowserType, endpoint: url.UrlWithStringQuery, server: cp.ChildProcess): Promise<void> {
const args = process.platform === 'linux' && browserType === 'chromium' ? ['--no-sandbox'] : undefined; // disable sandbox to run chrome on certain Linux distros
const browser = await playwright[browserType].launch({ headless: !Boolean(optimist.argv.debug), args });
const context = await browser.newContext();
@ -78,7 +80,7 @@ function pkill(pid: number): Promise<void> {
});
}
async function launchServer(): Promise<{ endpoint: url.UrlWithStringQuery, server: cp.ChildProcess }> {
async function launchServer(browserType: BrowserType): Promise<{ endpoint: url.UrlWithStringQuery, server: cp.ChildProcess }> {
// Ensure a tmp user-data-dir is used for the tests
const tmpDir = tmp.dirSync({ prefix: 't' });
@ -89,6 +91,7 @@ async function launchServer(): Promise<{ endpoint: url.UrlWithStringQuery, serve
const env = {
VSCODE_AGENT_FOLDER: userDataDir,
VSCODE_BROWSER: browserType,
...process.env
};
@ -130,7 +133,7 @@ async function launchServer(): Promise<{ endpoint: url.UrlWithStringQuery, serve
});
}
launchServer().then(async ({ endpoint, server }) => {
launchServer(optimist.argv.browser).then(async ({ endpoint, server }) => {
return runTestsInBrowser(optimist.argv.browser, endpoint, server);
}, error => {
console.error(error);