mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-10 05:28:19 -05:00
unit tests: use mocha junit reporter
This commit is contained in:
@@ -37,12 +37,18 @@ phases:
|
||||
displayName: Run Smoke Tests
|
||||
continueOnError: true
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Publish Smoketest Artifacts
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts'
|
||||
ArtifactName: build-artifacts-win32
|
||||
publishLocation: Container
|
||||
continueOnError: true
|
||||
condition: eq(variables['System.PullRequest.IsFork'], 'False')
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish Tests Results
|
||||
inputs:
|
||||
testResultsFiles: '*-test-results.xml'
|
||||
searchFolder: '$(Build.ArtifactStagingDirectory)/test-results'
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- phase: Linux
|
||||
queue: Hosted Linux Preview
|
||||
@@ -84,6 +90,12 @@ phases:
|
||||
- script: |
|
||||
DISPLAY=:10 ./scripts/test.sh --tfs
|
||||
displayName: Run Unit Tests
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish Tests Results
|
||||
inputs:
|
||||
testResultsFiles: '*-test-results.xml'
|
||||
searchFolder: '$(Build.ArtifactStagingDirectory)/test-results'
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- phase: macOS
|
||||
queue: Hosted macOS Preview
|
||||
@@ -123,9 +135,15 @@ phases:
|
||||
displayName: Run Smoke Tests
|
||||
continueOnError: true
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Publish Smoketest Artifacts
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts'
|
||||
ArtifactName: build-artifacts-darwin
|
||||
publishLocation: Container
|
||||
continueOnError: true
|
||||
condition: eq(variables['System.PullRequest.IsFork'], 'False')
|
||||
condition: eq(variables['System.PullRequest.IsFork'], 'False')
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish Tests Results
|
||||
inputs:
|
||||
testResultsFiles: '*-test-results.xml'
|
||||
searchFolder: '$(Build.ArtifactStagingDirectory)/test-results'
|
||||
condition: succeededOrFailed()
|
||||
@@ -105,6 +105,7 @@
|
||||
"minimatch": "^2.0.10",
|
||||
"mkdirp": "^0.5.0",
|
||||
"mocha": "^2.2.5",
|
||||
"mocha-junit-reporter": "^1.17.0",
|
||||
"object-assign": "^4.0.1",
|
||||
"optimist": "0.3.5",
|
||||
"p-all": "^1.0.0",
|
||||
|
||||
@@ -9,6 +9,7 @@ const { join } = require('path');
|
||||
const path = require('path');
|
||||
const mocha = require('mocha');
|
||||
const events = require('events');
|
||||
const MochaJUnitReporter = require('mocha-junit-reporter');
|
||||
|
||||
const defaultReporterName = process.platform === 'win32' ? 'list' : 'spec';
|
||||
|
||||
@@ -101,18 +102,9 @@ class TFSReporter extends mocha.reporters.Base {
|
||||
constructor(runner) {
|
||||
super(runner);
|
||||
|
||||
runner.on('pending', test => {
|
||||
console.log('PEND', test.fullTitle());
|
||||
});
|
||||
runner.on('pass', test => {
|
||||
console.log('OK ', test.fullTitle(), `(${test.duration}ms)`);
|
||||
});
|
||||
runner.on('fail', test => {
|
||||
console.log('FAIL', test.fullTitle(), `(${test.duration}ms)`);
|
||||
});
|
||||
runner.once('end', () => {
|
||||
this.epilogue();
|
||||
});
|
||||
runner.on('pending', test => console.log('PEND', test.fullTitle()));
|
||||
runner.on('fail', test => console.log('FAIL', test.fullTitle(), `(${test.duration}ms)`));
|
||||
runner.once('end', () => this.epilogue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,6 +134,13 @@ app.on('ready', () => {
|
||||
|
||||
if (argv.tfs) {
|
||||
new TFSReporter(runner);
|
||||
|
||||
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||
const mochaFile = path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, 'test-results/unit-test-results.xml');
|
||||
new MochaJUnitReporter(runner, { reporterOptions: { mochaFile } });
|
||||
} else {
|
||||
console.warn('BUILD_ARTIFACTSTAGINGDIRECTORY not defined')
|
||||
}
|
||||
} else {
|
||||
const reporterPath = path.join(path.dirname(require.resolve('mocha')), 'lib', 'reporters', argv.reporter);
|
||||
let Reporter;
|
||||
|
||||
34
yarn.lock
34
yarn.lock
@@ -674,6 +674,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"
|
||||
@@ -965,6 +969,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"
|
||||
@@ -2929,6 +2937,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"
|
||||
@@ -3687,6 +3699,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"
|
||||
@@ -3844,6 +3864,16 @@ 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@^2.0.1, mocha@^2.2.5:
|
||||
version "2.5.3"
|
||||
resolved "https://registry.yarnpkg.com/mocha/-/mocha-2.5.3.tgz#161be5bdeb496771eb9b35745050b622b5aefc58"
|
||||
@@ -6335,6 +6365,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"
|
||||
|
||||
Reference in New Issue
Block a user