Set Mocha options based on environment settings (#7229)

* Set Mocha options based on environment settings

* fixing copy paste bugs in console logs

* incorporating review feedback
This commit is contained in:
Arvind Ranasaria
2019-09-20 12:04:22 -07:00
committed by GitHub
parent ac6a4e590d
commit 71b80e0817
2 changed files with 35 additions and 7 deletions

View File

@@ -55,8 +55,8 @@
"chai": "3.5.0",
"mocha-junit-reporter": "^1.17.0",
"mocha-multi-reporters": "^1.1.7",
"vscode": "1.1.5",
"uuid": "^3.3.2"
"uuid": "^3.3.2",
"vscode": "1.1.5"
},
"dependencies": {
"azure-keyvault": "^3.0.4",

View File

@@ -2,12 +2,15 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { context } from './testContext';
import { getSuiteType, SuiteType } from 'adstest';
const path = require('path');
const testRunner = require('vscode/lib/testrunner');
import * as testRunner from 'vscode/lib/testrunner';
import * as vscode from 'vscode';
import { SuiteType, getSuiteType } from 'adstest';
import { context } from './testContext';
import path = require('path');
const suite = getSuiteType();
@@ -19,6 +22,31 @@ const options: any = {
if (suite === SuiteType.Stress) {
options.timeout = 7200000; // 2 hours
// StressRuntime sets the default run time in stress/perf mode for those suites. By default ensure that there is sufficient timeout available.
// if ADS_TEST_TIMEOUT is also defined then that value overrides this calculated timeout value. User needs to ensure that ADS_TEST_GREP > StressRuntime if
// both are set.
if (process.env.StressRuntime) {
options.timeout = (120 + 1.2 * parseInt(process.env.StressRuntime)) * 1000; // allow sufficient timeout based on StressRuntime setting
console.log(`setting options.timeout to:${options.timeout} based on process.env.StressRuntime value of ${process.env.StressRuntime} seconds`);
}
}
// set relevant mocha options from the environment
if (process.env.ADS_TEST_GREP) {
options.grep = process.env.ADS_TEST_GREP;
console.log(`setting options.grep to:${options.grep}`);
}
if (process.env.ADS_TEST_INVERT_GREP) {
options.invert = parseInt(process.env.ADS_TEST_INVERT_GREP);
console.log(`setting options.invert to:${options.invert}`);
}
if (process.env.ADS_TEST_TIMEOUT) {
options.timeout = parseInt(process.env.ADS_TEST_TIMEOUT);
console.log(`setting options.timeout to:${options.timeout}`);
}
if (process.env.ADS_TEST_RETRIES) {
options.retries = parseInt(process.env.ADS_TEST_RETRIES);
console.log(`setting options.retries to:${options.retries}`);
}
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {