Add reporter for unit tests (#1019)
This commit is contained in:
Родитель
fa13f3bd07
Коммит
e586af40f2
|
@ -6,6 +6,7 @@ coverage/
|
|||
out
|
||||
src/**/nodeDebugLocation.json
|
||||
nls.*.json
|
||||
test/*.xml
|
||||
|
||||
# Compiled files
|
||||
src/**/*.js
|
||||
|
|
10
gulpfile.js
10
gulpfile.js
|
@ -98,15 +98,21 @@ function test() {
|
|||
if (options.pattern) {
|
||||
log(`\nTesting cases that match pattern: ${options.pattern}`);
|
||||
} else {
|
||||
log("\nTesting cases that don't match pattern: extensionContext");
|
||||
log("\nTesting cases that don't match pattern: extensionContext|localizationContext");
|
||||
}
|
||||
|
||||
const testResultsPath = path.join(__dirname, "test", "DebuggerTests.xml");
|
||||
process.env.MOCHA_FILE = testResultsPath;
|
||||
return gulp.src(["test/**/*.test.js", "!test/extension/**"])
|
||||
.pipe(mocha({
|
||||
ui: "tdd",
|
||||
useColors: true,
|
||||
invert: !options.pattern,
|
||||
grep: options.pattern || "(extensionContext|localizationContext)"
|
||||
grep: options.pattern || "(extensionContext|localizationContext)",
|
||||
reporter: "mocha-multi-reporters",
|
||||
reporterOptions: {
|
||||
configFile: path.resolve("test/mochaReporterConfig.json"),
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -878,6 +878,12 @@
|
|||
"supports-color": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"charenc": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
|
||||
"integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=",
|
||||
"dev": true
|
||||
},
|
||||
"cheerio": {
|
||||
"version": "1.0.0-rc.2",
|
||||
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.2.tgz",
|
||||
|
@ -1240,6 +1246,12 @@
|
|||
"which": "^1.2.9"
|
||||
}
|
||||
},
|
||||
"crypt": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
|
||||
"integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=",
|
||||
"dev": true
|
||||
},
|
||||
"css": {
|
||||
"version": "2.2.4",
|
||||
"resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz",
|
||||
|
@ -4864,6 +4876,17 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"md5": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz",
|
||||
"integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"charenc": "~0.0.1",
|
||||
"crypt": "~0.0.1",
|
||||
"is-buffer": "~1.1.1"
|
||||
}
|
||||
},
|
||||
"mdurl": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
|
||||
|
@ -5065,13 +5088,61 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"mocha-teamcity-reporter": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mocha-teamcity-reporter/-/mocha-teamcity-reporter-2.5.1.tgz",
|
||||
"integrity": "sha512-5TujBiEii+CupwwangLyidegwuUTOQR1TPWWG2RrYk17kVUlhd50D5oZlS/3MshGmTxqW7TCHuytOBeTs2gPRg==",
|
||||
"mocha-junit-reporter": {
|
||||
"version": "1.22.0",
|
||||
"resolved": "https://registry.npmjs.org/mocha-junit-reporter/-/mocha-junit-reporter-1.22.0.tgz",
|
||||
"integrity": "sha512-nRBCVxzYYhOqQr2XlByLRj5MAAy7djArRkGUSx9dGc+B9NMu4yCeo74uXKALAnMhXjuLmtAL9F8WGe3wQV30IA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mocha": ">=3.5.0"
|
||||
"debug": "^2.2.0",
|
||||
"md5": "^2.1.0",
|
||||
"mkdirp": "~0.5.1",
|
||||
"strip-ansi": "^4.0.0",
|
||||
"xml": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
|
||||
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
|
||||
"dev": true
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
|
||||
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mocha-multi-reporters": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/mocha-multi-reporters/-/mocha-multi-reporters-1.1.7.tgz",
|
||||
"integrity": "sha1-zH8/TTL0eFIJQdhSq7ZNmYhYfYI=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"debug": "^3.1.0",
|
||||
"lodash": "^4.16.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
||||
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
||||
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"mock-fs": {
|
||||
|
@ -7813,6 +7884,12 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"xml": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
|
||||
"integrity": "sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=",
|
||||
"dev": true
|
||||
},
|
||||
"xml2js": {
|
||||
"version": "0.4.19",
|
||||
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
|
||||
|
|
|
@ -564,7 +564,8 @@
|
|||
"isparta": "^4.1.1",
|
||||
"minimist": "^1.2.0",
|
||||
"mocha": "^4.1.0",
|
||||
"mocha-teamcity-reporter": "^2.5.1",
|
||||
"mocha-junit-reporter": "^1.22.0",
|
||||
"mocha-multi-reporters": "^1.1.7",
|
||||
"mock-fs": "^4.4.1",
|
||||
"plugin-error": "^1.0.1",
|
||||
"remap-istanbul": "^0.9.5",
|
||||
|
|
|
@ -6,19 +6,22 @@
|
|||
/* tslint:disable:no-var-keyword no-var-requires */
|
||||
var testRunner = require("vscode/lib/testrunner");
|
||||
/* tslint:enable:no-var-keyword no-var-requires */
|
||||
import * as path from "path";
|
||||
|
||||
let mochaOptions: any = {
|
||||
ui: "tdd",
|
||||
useColors: true,
|
||||
invert: true,
|
||||
grep: "(debuggerContext|localizationContext)", // Do not run tests intended for the debuggerContext and localizationContext
|
||||
reporter: "mocha-multi-reporters",
|
||||
reporterOptions: {
|
||||
reporterEnabled: "spec, mocha-junit-reporter",
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: path.join(__dirname, "ExtensionTests.xml"),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Look for the env variable to decide wheter to use the TeamCity reporter or not
|
||||
if (process.env.VSCODE_REACT_NATIVE_TEAMCITY_TEST) {
|
||||
mochaOptions.reporter = "mocha-teamcity-reporter";
|
||||
}
|
||||
|
||||
// Register Mocha options
|
||||
testRunner.configure(mochaOptions);
|
||||
|
||||
|
|
|
@ -6,18 +6,21 @@
|
|||
/* tslint:disable:no-var-keyword no-var-requires */
|
||||
var testRunner = require("vscode/lib/testrunner");
|
||||
/* tslint:enable:no-var-keyword no-var-requires */
|
||||
import * as path from "path";
|
||||
|
||||
let mochaOption: any = {
|
||||
ui: "tdd",
|
||||
useColors: true,
|
||||
grep: "localizationContext",
|
||||
reporter: "mocha-multi-reporters",
|
||||
reporterOptions: {
|
||||
reporterEnabled: "spec, mocha-junit-reporter",
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: path.join(__dirname, "..", "LocalizationTests.xml"),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Look for the env variable to decide wheter to use the TeamCity reporter or not
|
||||
if (process.env.VSCODE_REACT_NATIVE_TEAMCITY_TEST) {
|
||||
mochaOption.reporter = "mocha-teamcity-reporter";
|
||||
}
|
||||
|
||||
// Register Mocha options
|
||||
testRunner.configure(mochaOption);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"scripts": {
|
||||
"postinstall": "tsc",
|
||||
"watch": "tsc --watch",
|
||||
"mocha": "node ./node_modules/tslint/bin/tslint -c tslint.json --project tsconfig.json 'src/**' && tsc && node ./node_modules/mocha/bin/_mocha --reporter mocha-multi-reporters --reporter-options configFile=mochaReporterConfig.json"
|
||||
"mocha": "node ./node_modules/tslint/bin/tslint -c tslint.json --project tsconfig.json 'src/**' && tsc && node ./node_modules/mocha/bin/_mocha --reporter mocha-multi-reporters --reporter-options configFile=../mochaReporterConfig.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/clipboardy": "^1.1.0",
|
||||
|
|
Загрузка…
Ссылка в новой задаче