mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
Azure DevOps pipeline - generate unique test result names (#105148)
* Set suite name based on environment variable
This commit is contained in:
parent
25ad7485b3
commit
06730e3e29
|
@ -6,14 +6,24 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const testRunner = require('vscode/lib/testrunner');
|
const testRunner = require('vscode/lib/testrunner');
|
||||||
|
|
||||||
const suite = 'Integration Emmet Tests';
|
|
||||||
|
|
||||||
const options: any = {
|
const options: any = {
|
||||||
ui: 'tdd',
|
ui: 'tdd',
|
||||||
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
||||||
timeout: 60000
|
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) {
|
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||||
options.reporter = 'mocha-multi-reporters';
|
options.reporter = 'mocha-multi-reporters';
|
||||||
options.reporterOptions = {
|
options.reporterOptions = {
|
||||||
|
|
|
@ -6,14 +6,24 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const testRunner = require('vscode/lib/testrunner');
|
const testRunner = require('vscode/lib/testrunner');
|
||||||
|
|
||||||
const suite = 'Integration Git Tests';
|
|
||||||
|
|
||||||
const options: any = {
|
const options: any = {
|
||||||
ui: 'tdd',
|
ui: 'tdd',
|
||||||
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
||||||
timeout: 60000
|
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) {
|
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||||
options.reporter = 'mocha-multi-reporters';
|
options.reporter = 'mocha-multi-reporters';
|
||||||
options.reporterOptions = {
|
options.reporterOptions = {
|
||||||
|
|
|
@ -6,14 +6,24 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const testRunner = require('vscode/lib/testrunner');
|
const testRunner = require('vscode/lib/testrunner');
|
||||||
|
|
||||||
const suite = 'Integration Markdown Tests';
|
|
||||||
|
|
||||||
const options: any = {
|
const options: any = {
|
||||||
ui: 'tdd',
|
ui: 'tdd',
|
||||||
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
||||||
timeout: 60000
|
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) {
|
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||||
options.reporter = 'mocha-multi-reporters';
|
options.reporter = 'mocha-multi-reporters';
|
||||||
options.reporterOptions = {
|
options.reporterOptions = {
|
||||||
|
|
|
@ -6,14 +6,24 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const testRunner = require('vscode/lib/testrunner');
|
const testRunner = require('vscode/lib/testrunner');
|
||||||
|
|
||||||
const suite = 'Integration Single Folder Tests';
|
|
||||||
|
|
||||||
const options: any = {
|
const options: any = {
|
||||||
ui: 'tdd',
|
ui: 'tdd',
|
||||||
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
||||||
timeout: 60000
|
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) {
|
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||||
options.reporter = 'mocha-multi-reporters';
|
options.reporter = 'mocha-multi-reporters';
|
||||||
options.reporterOptions = {
|
options.reporterOptions = {
|
||||||
|
|
|
@ -6,14 +6,24 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const testRunner = require('vscode/lib/testrunner');
|
const testRunner = require('vscode/lib/testrunner');
|
||||||
|
|
||||||
const suite = 'Integration Workspace Tests';
|
|
||||||
|
|
||||||
const options: any = {
|
const options: any = {
|
||||||
ui: 'tdd',
|
ui: 'tdd',
|
||||||
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
||||||
timeout: 60000
|
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) {
|
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||||
options.reporter = 'mocha-multi-reporters';
|
options.reporter = 'mocha-multi-reporters';
|
||||||
options.reporterOptions = {
|
options.reporterOptions = {
|
||||||
|
|
|
@ -6,14 +6,24 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const testRunner = require('vscode/lib/testrunner');
|
const testRunner = require('vscode/lib/testrunner');
|
||||||
|
|
||||||
const suite = 'Integration Notebook Tests';
|
|
||||||
|
|
||||||
const options: any = {
|
const options: any = {
|
||||||
ui: 'tdd',
|
ui: 'tdd',
|
||||||
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
||||||
timeout: 60000
|
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) {
|
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||||
options.reporter = 'mocha-multi-reporters';
|
options.reporter = 'mocha-multi-reporters';
|
||||||
options.reporterOptions = {
|
options.reporterOptions = {
|
||||||
|
|
|
@ -29,7 +29,9 @@ if (optimist.argv.help) {
|
||||||
const width = 1200;
|
const width = 1200;
|
||||||
const height = 800;
|
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 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 browser = await playwright[browserType].launch({ headless: !Boolean(optimist.argv.debug), args });
|
||||||
const context = await browser.newContext();
|
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
|
// Ensure a tmp user-data-dir is used for the tests
|
||||||
const tmpDir = tmp.dirSync({ prefix: 't' });
|
const tmpDir = tmp.dirSync({ prefix: 't' });
|
||||||
|
@ -89,6 +91,7 @@ async function launchServer(): Promise<{ endpoint: url.UrlWithStringQuery, serve
|
||||||
|
|
||||||
const env = {
|
const env = {
|
||||||
VSCODE_AGENT_FOLDER: userDataDir,
|
VSCODE_AGENT_FOLDER: userDataDir,
|
||||||
|
VSCODE_BROWSER: browserType,
|
||||||
...process.env
|
...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);
|
return runTestsInBrowser(optimist.argv.browser, endpoint, server);
|
||||||
}, error => {
|
}, error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
Loading…
Reference in a new issue