ci: Publish test results when running tests in pipelines (#297)

The expected test report artifact was not being generated with our existing script configuration. This PR updates the scripts to ensure the artifact is generated as expected.

![image](https://github.com/microsoft/FluidHelloWorld/assets/54606601/ff3c337e-d4cc-4111-b794-00c7a6dc9a37)

Also improves a code comment that I encountered while looking at the code.
This commit is contained in:
Joshua Smithrud 2023-07-31 13:10:12 -07:00 коммит произвёл GitHub
Родитель 170738478d
Коммит 51b170b05a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 206 добавлений и 4 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -1,4 +1,5 @@
dist
node_modules
*.log
**/*.tsbuildinfo
**/*.tsbuildinfo
nyc

Просмотреть файл

@ -38,7 +38,7 @@ steps:
displayName: Test
inputs:
command: "custom"
customCommand: "run test"
customCommand: "run ci:test"
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:

Просмотреть файл

@ -8,5 +8,6 @@ module.exports = {
globals: {
PATH: `http://localhost:8080`,
},
reporters: ["jest-junit"],
verbose: true,
};

192
package-lock.json сгенерированный
Просмотреть файл

@ -18,6 +18,7 @@
"concurrently": "^5.3.0",
"html-webpack-plugin": "^4.3.0",
"jest": "^26.6.3",
"jest-junit": "^10.0.0",
"jest-puppeteer": "^4.3.0",
"prettier": "^2.7.1",
"puppeteer": "^1.20.0",
@ -10551,6 +10552,102 @@
"node": ">=8"
}
},
"node_modules/jest-junit": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-10.0.0.tgz",
"integrity": "sha512-dbOVRyxHprdSpwSAR9/YshLwmnwf+RSl5hf0kCGlhAcEeZY9aRqo4oNmaT0tLC16Zy9D0zekDjWkjHGjXlglaQ==",
"dev": true,
"dependencies": {
"jest-validate": "^24.9.0",
"mkdirp": "^0.5.1",
"strip-ansi": "^5.2.0",
"uuid": "^3.3.3",
"xml": "^1.0.1"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/jest-junit/node_modules/@jest/types": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/@jest/types/-/types-24.9.0.tgz",
"integrity": "sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==",
"dev": true,
"dependencies": {
"@types/istanbul-lib-coverage": "^2.0.0",
"@types/istanbul-reports": "^1.1.1",
"@types/yargs": "^13.0.0"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/jest-junit/node_modules/@types/istanbul-reports": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.2.tgz",
"integrity": "sha512-P/W9yOX/3oPZSpaYOCQzGqgCQRXn0FFO/V8bWrCQs+wLmvVVxk6CRBXALEvNs9OHIatlnlFokfhuDo2ug01ciw==",
"dev": true,
"dependencies": {
"@types/istanbul-lib-coverage": "*",
"@types/istanbul-lib-report": "*"
}
},
"node_modules/jest-junit/node_modules/@types/yargs": {
"version": "13.0.12",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.12.tgz",
"integrity": "sha512-qCxJE1qgz2y0hA4pIxjBR+PelCH0U5CK1XJXFwCNqfmliatKp47UCXXE9Dyk1OXBDLvsCF57TqQEJaeLfDYEOQ==",
"dev": true,
"dependencies": {
"@types/yargs-parser": "*"
}
},
"node_modules/jest-junit/node_modules/jest-get-type": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.9.0.tgz",
"integrity": "sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q==",
"dev": true,
"engines": {
"node": ">= 6"
}
},
"node_modules/jest-junit/node_modules/jest-validate": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.9.0.tgz",
"integrity": "sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ==",
"dev": true,
"dependencies": {
"@jest/types": "^24.9.0",
"camelcase": "^5.3.1",
"chalk": "^2.0.1",
"jest-get-type": "^24.9.0",
"leven": "^3.1.0",
"pretty-format": "^24.9.0"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/jest-junit/node_modules/pretty-format": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.9.0.tgz",
"integrity": "sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==",
"dev": true,
"dependencies": {
"@jest/types": "^24.9.0",
"ansi-regex": "^4.0.0",
"ansi-styles": "^3.2.0",
"react-is": "^16.8.4"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/jest-junit/node_modules/react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
"dev": true
},
"node_modules/jest-leak-detector": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-26.6.2.tgz",
@ -18555,6 +18652,12 @@
}
}
},
"node_modules/xml": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
"integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==",
"dev": true
},
"node_modules/xml-name-validator": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
@ -27417,6 +27520,89 @@
}
}
},
"jest-junit": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-10.0.0.tgz",
"integrity": "sha512-dbOVRyxHprdSpwSAR9/YshLwmnwf+RSl5hf0kCGlhAcEeZY9aRqo4oNmaT0tLC16Zy9D0zekDjWkjHGjXlglaQ==",
"dev": true,
"requires": {
"jest-validate": "^24.9.0",
"mkdirp": "^0.5.1",
"strip-ansi": "^5.2.0",
"uuid": "^3.3.3",
"xml": "^1.0.1"
},
"dependencies": {
"@jest/types": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/@jest/types/-/types-24.9.0.tgz",
"integrity": "sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw==",
"dev": true,
"requires": {
"@types/istanbul-lib-coverage": "^2.0.0",
"@types/istanbul-reports": "^1.1.1",
"@types/yargs": "^13.0.0"
}
},
"@types/istanbul-reports": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.2.tgz",
"integrity": "sha512-P/W9yOX/3oPZSpaYOCQzGqgCQRXn0FFO/V8bWrCQs+wLmvVVxk6CRBXALEvNs9OHIatlnlFokfhuDo2ug01ciw==",
"dev": true,
"requires": {
"@types/istanbul-lib-coverage": "*",
"@types/istanbul-lib-report": "*"
}
},
"@types/yargs": {
"version": "13.0.12",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.12.tgz",
"integrity": "sha512-qCxJE1qgz2y0hA4pIxjBR+PelCH0U5CK1XJXFwCNqfmliatKp47UCXXE9Dyk1OXBDLvsCF57TqQEJaeLfDYEOQ==",
"dev": true,
"requires": {
"@types/yargs-parser": "*"
}
},
"jest-get-type": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.9.0.tgz",
"integrity": "sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q==",
"dev": true
},
"jest-validate": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.9.0.tgz",
"integrity": "sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ==",
"dev": true,
"requires": {
"@jest/types": "^24.9.0",
"camelcase": "^5.3.1",
"chalk": "^2.0.1",
"jest-get-type": "^24.9.0",
"leven": "^3.1.0",
"pretty-format": "^24.9.0"
}
},
"pretty-format": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.9.0.tgz",
"integrity": "sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==",
"dev": true,
"requires": {
"@jest/types": "^24.9.0",
"ansi-regex": "^4.0.0",
"ansi-styles": "^3.2.0",
"react-is": "^16.8.4"
}
},
"react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
"dev": true
}
}
},
"jest-leak-detector": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-26.6.2.tgz",
@ -33615,6 +33801,12 @@
"integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
"requires": {}
},
"xml": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
"integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==",
"dev": true
},
"xml-name-validator": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",

Просмотреть файл

@ -8,6 +8,8 @@
"scripts": {
"build": "webpack --env prod --env clean",
"build:dev": "webpack --env clean",
"ci:test": "start-server-and-test start:server 7070 ci:test:jest",
"ci:test:jest": "jest --ci --reporters=default --reporters=jest-junit",
"start": "start-server-and-test start:server 7070 start:client",
"start:client": "webpack serve",
"start:server": "tinylicious",
@ -16,7 +18,8 @@
"lint:fix": "npm run prettier:fix",
"prettier": "prettier --check . --ignore-path ./.prettierignore",
"prettier:fix": "prettier --write . --ignore-path ./.prettierignore",
"test": "start-server-and-test start:server 7070 jest"
"test": "start-server-and-test start:server 7070 test:jest",
"test:jest": "jest"
},
"dependencies": {
"@fluidframework/tinylicious-client": "^1.3.6",
@ -33,8 +36,13 @@
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^3.11.0",
"jest": "^26.6.3",
"jest-junit": "^10.0.0",
"jest-puppeteer": "^4.3.0",
"puppeteer": "^1.20.0",
"tinylicious": "^0.4.0"
},
"jest-junit": {
"outputDirectory": "nyc",
"outputName": "jest-junit-report.xml"
}
}

Просмотреть файл

@ -45,7 +45,7 @@ describe("fluid-hello-world", () => {
val1 = value1.codePointAt(0) - 0x267f;
};
// roll dice until value is not change is not equal to 1
// roll dice until value has changed in a way we can easily confirm (i.e. when it is no longer equal to 1)
do {
await rollDice();
} while (val1 === 1);