mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 06:17:18 +00:00
publish tests in tfs
This commit is contained in:
parent
8a4e893f25
commit
003d469d26
|
@ -22,9 +22,12 @@ phases:
|
|||
npm run compile
|
||||
name: build
|
||||
- powershell: |
|
||||
.\scripts\test.bat
|
||||
.\scripts\test.bat --tfs
|
||||
.\scripts\test-integration.bat
|
||||
name: test
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testResultsFiles: '.build\tests\unit-test-results.xml'
|
||||
|
||||
- phase: Linux
|
||||
queue: Hosted Linux Preview
|
||||
|
@ -57,9 +60,12 @@ phases:
|
|||
npm run compile
|
||||
name: build
|
||||
- script: |
|
||||
DISPLAY=:10 ./scripts/test.sh
|
||||
DISPLAY=:10 ./scripts/test.sh --tfs
|
||||
# DISPLAY=:10 ./scripts/test-integration.sh
|
||||
name: test
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testResultsFiles: '.build/tests/unit-test-results.xml'
|
||||
|
||||
- phase: macOS
|
||||
queue: Hosted macOS Preview
|
||||
|
@ -83,6 +89,9 @@ phases:
|
|||
npm run compile
|
||||
name: build
|
||||
- script: |
|
||||
./scripts/test.sh
|
||||
./scripts/test.sh --tfs
|
||||
./scripts/test-integration.sh
|
||||
name: test
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testResultsFiles: '.build/tests/unit-test-results.xml'
|
||||
|
|
|
@ -101,6 +101,8 @@
|
|||
"minimatch": "^2.0.10",
|
||||
"mkdirp": "^0.5.0",
|
||||
"mocha": "^2.2.5",
|
||||
"mocha-junit-reporter": "^1.17.0",
|
||||
"mocha-multi-reporters": "^1.1.7",
|
||||
"object-assign": "^4.0.1",
|
||||
"optimist": "0.3.5",
|
||||
"p-all": "^1.0.0",
|
||||
|
|
|
@ -10,6 +10,8 @@ const path = require('path');
|
|||
const mocha = require('mocha');
|
||||
const events = require('events');
|
||||
|
||||
const defaultReporterName = process.platform === 'win32' ? 'list' : 'spec';
|
||||
|
||||
const optimist = require('optimist')
|
||||
.describe('grep', 'only run tests matching <pattern>').alias('grep', 'g').alias('grep', 'f').string('grep')
|
||||
.describe('run', 'only run tests from <file>').string('run')
|
||||
|
@ -17,7 +19,9 @@ const optimist = require('optimist')
|
|||
.describe('build', 'run with build output (out-build)').boolean('build')
|
||||
.describe('coverage', 'generate coverage report').boolean('coverage')
|
||||
.describe('debug', 'open dev tools, keep window open, reuse app data').string('debug')
|
||||
.describe('reporter', 'the mocha reporter').string('reporter').default('reporter', process.platform === 'win32' ? 'list' : 'spec')
|
||||
.describe('reporter', 'the mocha reporter').string('reporter').default('reporter', defaultReporterName)
|
||||
.describe('reporter-options', 'the mocha reporter options').string('reporter-options').default('reporter-options', '')
|
||||
.describe('tfs').boolean('tfs')
|
||||
.describe('help', 'show the help').alias('help', 'h');
|
||||
|
||||
const argv = optimist.argv;
|
||||
|
@ -33,6 +37,9 @@ if (!argv.debug) {
|
|||
|
||||
function deserializeSuite(suite) {
|
||||
return {
|
||||
root: suite.root,
|
||||
suites: suite.suites,
|
||||
tests: suite.tests,
|
||||
title: suite.title,
|
||||
fullTitle: () => suite.fullTitle,
|
||||
timeout: () => suite.timeout,
|
||||
|
@ -84,6 +91,11 @@ class IPCRunner extends events.EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
function parseReporterOption(value) {
|
||||
let r = /^([^=]+)=(.*)$/.exec(value);
|
||||
return r ? { [r[1]]: r[2] } : {};
|
||||
}
|
||||
|
||||
app.on('ready', () => {
|
||||
|
||||
const win = new BrowserWindow({
|
||||
|
@ -106,18 +118,39 @@ app.on('ready', () => {
|
|||
|
||||
win.loadURL(`file://${__dirname}/renderer.html`);
|
||||
|
||||
const reporterPath = path.join(path.dirname(require.resolve('mocha')), 'lib', 'reporters', argv.reporter);
|
||||
let Reporter;
|
||||
|
||||
try {
|
||||
Reporter = require(reporterPath);
|
||||
} catch (err) {
|
||||
console.warn(`could not load reporter: ${argv.reporter}`);
|
||||
Reporter = process.platform === 'win32' ? mocha.reporters.List : mocha.reporters.Spec;
|
||||
}
|
||||
|
||||
const runner = new IPCRunner();
|
||||
new Reporter(runner);
|
||||
|
||||
if (argv.tfs) {
|
||||
const Reporter = require('mocha-multi-reporters');
|
||||
const reporterOptions = {
|
||||
reporterEnabled: `${defaultReporterName}, mocha-junit-reporter`,
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: '.build/tests/unit-test-results.xml'
|
||||
}
|
||||
};
|
||||
|
||||
new Reporter(runner, { reporterOptions });
|
||||
} else {
|
||||
const reporterPath = path.join(path.dirname(require.resolve('mocha')), 'lib', 'reporters', argv.reporter);
|
||||
let Reporter;
|
||||
|
||||
try {
|
||||
Reporter = require(reporterPath);
|
||||
} catch (err) {
|
||||
try {
|
||||
Reporter = require(argv.reporter);
|
||||
} catch (err) {
|
||||
Reporter = process.platform === 'win32' ? mocha.reporters.List : mocha.reporters.Spec;
|
||||
console.warn(`could not load reporter: ${argv.reporter}, using ${Reporter.name}`);
|
||||
}
|
||||
}
|
||||
|
||||
let reporterOptions = argv['reporter-options'];
|
||||
reporterOptions = typeof reporterOptions === 'string' ? [reporterOptions] : reporterOptions;
|
||||
reporterOptions = reporterOptions.reduce((r, o) => Object.assign(r, parseReporterOption(o)), {});
|
||||
|
||||
new Reporter(runner, { reporterOptions });
|
||||
}
|
||||
|
||||
if (!argv.debug) {
|
||||
ipcMain.on('all done', () => app.exit(runner.didFail ? 1 : 0));
|
||||
|
|
|
@ -187,6 +187,9 @@ function loadTests(opts) {
|
|||
|
||||
function serializeSuite(suite) {
|
||||
return {
|
||||
root: suite.root,
|
||||
suites: suite.suites.map(serializeSuite),
|
||||
tests: suite.tests.map(serializeRunnable),
|
||||
title: suite.title,
|
||||
fullTitle: suite.fullTitle(),
|
||||
timeout: suite.timeout(),
|
||||
|
|
51
yarn.lock
51
yarn.lock
|
@ -607,6 +607,10 @@ chalk@^2.3.0:
|
|||
escape-string-regexp "^1.0.5"
|
||||
supports-color "^4.0.0"
|
||||
|
||||
charenc@~0.0.1:
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
|
||||
|
||||
cheerio@^1.0.0-rc.1:
|
||||
version "1.0.0-rc.2"
|
||||
resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.2.tgz#4b9f53a81b27e4d5dac31c0ffd0cfa03cc6830db"
|
||||
|
@ -890,6 +894,10 @@ cross-spawn@^5.0.1:
|
|||
shebang-command "^1.2.0"
|
||||
which "^1.2.9"
|
||||
|
||||
crypt@~0.0.1:
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
|
||||
|
||||
cryptiles@0.2.x:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-0.2.2.tgz#ed91ff1f17ad13d3748288594f8a48a0d26f325c"
|
||||
|
@ -1059,6 +1067,12 @@ debug@2.6.9, debug@2.X, debug@^2.1.1, debug@^2.1.3, debug@^2.2.0:
|
|||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debug@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||
|
@ -2840,6 +2854,10 @@ is-buffer@^1.0.2:
|
|||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b"
|
||||
|
||||
is-buffer@~1.1.1:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
|
||||
|
||||
is-builtin-module@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe"
|
||||
|
@ -3511,6 +3529,10 @@ lodash@^4.0.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.3.0:
|
|||
version "4.17.4"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
||||
|
||||
lodash@^4.16.4:
|
||||
version "4.17.5"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
|
||||
|
||||
lodash@~0.9.2:
|
||||
version "0.9.2"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-0.9.2.tgz#8f3499c5245d346d682e5b0d3b40767e09f1a92c"
|
||||
|
@ -3607,6 +3629,14 @@ math-expression-evaluator@^1.2.14:
|
|||
version "1.2.17"
|
||||
resolved "https://registry.yarnpkg.com/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz#de819fdbcd84dccd8fae59c6aeb79615b9d266ac"
|
||||
|
||||
md5@^2.1.0:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/md5/-/md5-2.2.1.tgz#53ab38d5fe3c8891ba465329ea23fac0540126f9"
|
||||
dependencies:
|
||||
charenc "~0.0.1"
|
||||
crypt "~0.0.1"
|
||||
is-buffer "~1.1.1"
|
||||
|
||||
mdurl@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e"
|
||||
|
@ -3767,6 +3797,23 @@ mksnapshot@^0.3.0:
|
|||
fs-extra "0.26.7"
|
||||
request "^2.79.0"
|
||||
|
||||
mocha-junit-reporter@^1.17.0:
|
||||
version "1.17.0"
|
||||
resolved "https://registry.yarnpkg.com/mocha-junit-reporter/-/mocha-junit-reporter-1.17.0.tgz#2e5149ed40fc5d2e3ca71e42db5ab1fec9c6d85c"
|
||||
dependencies:
|
||||
debug "^2.2.0"
|
||||
md5 "^2.1.0"
|
||||
mkdirp "~0.5.1"
|
||||
strip-ansi "^4.0.0"
|
||||
xml "^1.0.0"
|
||||
|
||||
mocha-multi-reporters@^1.1.7:
|
||||
version "1.1.7"
|
||||
resolved "https://registry.yarnpkg.com/mocha-multi-reporters/-/mocha-multi-reporters-1.1.7.tgz#cc7f3f4d32f478520941d852abb64d9988587d82"
|
||||
dependencies:
|
||||
debug "^3.1.0"
|
||||
lodash "^4.16.4"
|
||||
|
||||
mocha@^2.0.1, mocha@^2.2.5:
|
||||
version "2.5.3"
|
||||
resolved "https://registry.yarnpkg.com/mocha/-/mocha-2.5.3.tgz#161be5bdeb496771eb9b35745050b622b5aefc58"
|
||||
|
@ -6098,6 +6145,10 @@ xml2js@^0.4.19:
|
|||
sax ">=0.6.0"
|
||||
xmlbuilder "~9.0.1"
|
||||
|
||||
xml@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
|
||||
|
||||
xmlbuilder@0.4.3:
|
||||
version "0.4.3"
|
||||
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-0.4.3.tgz#c4614ba74e0ad196e609c9272cd9e1ddb28a8a58"
|
||||
|
|
Loading…
Reference in a new issue