Add junit test result files to typescript functional and unit tests (#2846)

This commit is contained in:
BrennanConroy 2018-08-22 12:05:35 -07:00 committed by GitHub
parent f8a46faf9d
commit 070bc945f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 251 additions and 1394 deletions

File diff suppressed because it is too large Load Diff

View File

@ -11,19 +11,20 @@
},
"devDependencies": {
"@types/debug": "0.0.30",
"@types/jasmine": "^2.8.6",
"@types/karma": "^1.7.3",
"@types/node": "^9.4.6",
"@types/jasmine": "^2.8.8",
"@types/karma": "^1.7.5",
"@types/node": "^9.6.28",
"debug": "^3.1.0",
"es6-promise": "^4.2.2",
"jasmine": "^3.1.0",
"jasmine-core": "^3.1.0",
"karma": "^2.0.4",
"es6-promise": "^4.2.4",
"jasmine": "^3.2.0",
"jasmine-core": "^3.2.1",
"karma": "^3.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-edge-launcher": "^0.4.2",
"karma-firefox-launcher": "^1.1.0",
"karma-ie-launcher": "^1.0.0",
"karma-jasmine": "^1.1.2",
"karma-junit-reporter": "^1.2.0",
"karma-mocha-reporter": "^2.2.5",
"karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^1.2.0",

View File

@ -1,7 +1,7 @@
try {
const path = require("path");
let defaultReporters = ["progress", "summary"];
let defaultReporters = ["progress", "summary", "junit"];
/** Creates the Karma config function based on the provided options
*
@ -45,6 +45,11 @@ try {
// Apply the default reporters along with whatever was passed in
reporters: [...defaultReporters, ...(config.reporters || [])],
junitReporter: {
outputDir: "../../../artifacts/logs",
outputFile: `${process.platform}` + ".functionaltest.junit.xml",
},
});
}
}

View File

@ -58,7 +58,7 @@ try {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
}
},
});
} catch (e) {
console.error(e);

View File

@ -4144,6 +4144,48 @@
"source-map-support": "^0.5.0"
}
},
"jest-junit": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-5.1.0.tgz",
"integrity": "sha512-3EVf1puv2ox5wybQDfLX3AEn3IKOgDV4E76y4pO2hBu46DEtAFZZAm//X1pzPQpqKji0zqgMIzqzF/K+uGAX9A==",
"dev": true,
"requires": {
"jest-validate": "^23.0.1",
"mkdirp": "^0.5.1",
"strip-ansi": "^4.0.0",
"xml": "^1.0.1"
},
"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
},
"jest-validate": {
"version": "23.5.0",
"resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-23.5.0.tgz",
"integrity": "sha512-XmStdYhfdiDKacXX5sNqEE61Zz4/yXaPcDsKvVA0429RBu2pkQyIltCVG7UitJIEAzSs3ociQTdyseAW8VGPiA==",
"dev": true,
"requires": {
"chalk": "^2.0.1",
"jest-get-type": "^22.1.0",
"leven": "^2.1.0",
"pretty-format": "^23.5.0"
}
},
"pretty-format": {
"version": "23.5.0",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-23.5.0.tgz",
"integrity": "sha512-iFLvYTXOn+C/s7eV+pr4E8DD7lYa2/klXMEz+lvH14qSDWAJ7S+kFmMe1SIWesATHQxopHTxRcB2nrpExhzaBA==",
"dev": true,
"requires": {
"ansi-regex": "^3.0.0",
"ansi-styles": "^3.2.0"
}
}
}
},
"jest-leak-detector": {
"version": "22.4.3",
"resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-22.4.3.tgz",
@ -8639,6 +8681,12 @@
"async-limiter": "~1.0.0"
}
},
"xml": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
"integrity": "sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=",
"dev": true
},
"xml-name-validator": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",

View File

@ -14,6 +14,7 @@
"@types/node": "^8.5.2",
"@types/webpack": "^4.4.0",
"jest": "^22.4.3",
"jest-junit": "^5.1.0",
"rimraf": "^2.6.2",
"ts-jest": "^22.4.6",
"ts-loader": "^4.4.1",

33
clients/ts/jest.config.js Normal file
View File

@ -0,0 +1,33 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
module.exports = {
globals: {
"ts-jest": {
"tsConfigFile": "./tsconfig.jest.json",
"skipBabel": true,
"enableTsDiagnostics": true
}
},
reporters: [
"default",
["./common/node_modules/jest-junit/index.js", { "output": "../../artifacts/logs/" + `${process.platform}` + ".signalr.junit.xml" }]
],
transform: {
"^.+\\.tsx?$": "./common/node_modules/ts-jest"
},
testEnvironment: "node",
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
moduleNameMapper: {
"^ts-jest$": "<rootDir>/common/node_modules/ts-jest",
"^@aspnet/signalr$": "<rootDir>/signalr/dist/cjs/index.js"
},
moduleFileExtensions: [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
};

View File

@ -6,35 +6,9 @@
"scripts": {
"build": "cd ./signalr && npm run build && cd ../signalr-protocol-msgpack && npm run build",
"pretest": "node ./common/node_modules/tslint/bin/tslint -c ./tslint.json -p ./signalr/tests/tsconfig.json && node ./common/node_modules/tslint/bin/tslint -c ./tslint.json -p ./signalr-protocol-msgpack/tests/tsconfig.json",
"test": "node ./common/node_modules/jest/bin/jest.js",
"coverage": "node ./common/node_modules/jest/bin/jest.js --coverage"
"test": "node ./common/node_modules/jest/bin/jest.js --config ./jest.config.js",
"coverage": "node ./common/node_modules/jest/bin/jest.js --config ./jest.config.js --coverage"
},
"author": "Microsoft",
"license": "Apache-2.0",
"jest": {
"globals": {
"ts-jest": {
"tsConfigFile": "./tsconfig.jest.json",
"skipBabel": true,
"enableTsDiagnostics": true
}
},
"transform": {
"^.+\\.tsx?$": "./common/node_modules/ts-jest"
},
"testEnvironment": "node",
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleNameMapper": {
"^ts-jest$": "<rootDir>/common/node_modules/ts-jest",
"^@aspnet/signalr$": "<rootDir>/signalr/dist/cjs/index.js"
},
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
}
"license": "Apache-2.0"
}

View File

@ -13,7 +13,7 @@ describe("TextMessageFormat", () => {
["Hello\u001e", ["Hello"]],
["Hello,\u001eWorld!\u001e", ["Hello,", "World!"]],
] as Array<[string, string[]]>).forEach(([payload, expectedMessages]) => {
it(`should parse '${payload}' correctly`, () => {
it(`should parse '${encodeURI(payload)}' correctly`, () => {
const messages = TextMessageFormat.parse(payload);
expect(messages).toEqual(expectedMessages);
});
@ -24,7 +24,7 @@ describe("TextMessageFormat", () => {
["ABC", "Message is incomplete."],
["ABC\u001eXYZ", "Message is incomplete."],
] as Array<[string, string]>).forEach(([payload, expectedError]) => {
it(`should fail to parse '${payload}'`, () => {
it(`should fail to parse '${encodeURI(payload)}'`, () => {
expect(() => TextMessageFormat.parse(payload)).toThrow(expectedError);
});
});