-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mocha reporter #6
Conversation
0997a9a
to
feb89d6
Compare
feb89d6
to
cba2ad5
Compare
This comment was marked as outdated.
This comment was marked as outdated.
I'm starting to wonder if I should have the reporter itself output the github/git fields if it can detect if it's in github and only have the action add them if they aren't present. Would allow you to do something like generate a report in 1 job and upload in another without misreporting the data. There could be issues with this though since the data is all gleaned from environment variables. My tests for example override some of those environment variables in order to run the test correctly. Something I can look at in a future PR. Just rambling. |
const makeLocation = (filePath) => { | ||
const path = relative(process.cwd(), filePath); | ||
const pathParts = path.split(platformSeparator); | ||
|
||
return join(...pathParts); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be something I can pull out into a common helper for reporters.
const getOperatingSystem = () => { | ||
switch (type()) { | ||
case 'Linux': | ||
return 'linux'; | ||
case 'Darwin': | ||
return 'macos'; | ||
case 'Windows_NT': | ||
return 'windows'; | ||
default: | ||
throw new Error('Unknown operating system'); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be something I can pull out into a common helper for reporters.
Added flaky stuff. Report now looks like this {
"reportId": "4c5a0e8f-8294-4104-a159-ba39c34694a9",
"reportVersion": 1,
"summary": {
"operatingSystem": "windows",
"framework": "mocha",
"started": "2023-12-13T22:27:16.865Z",
"totalDuration": 2025,
"state": "passed",
"countPassed": 8,
"countFailed": 0,
"countSkipped": 1,
"countFlaky": 1
},
"details": [
{
"name": "github > logger logs",
"started": "2023-12-13T22:27:16.869Z",
"location": "test/github.test.js",
"retries": 0,
"totalDuration": 1,
"status": "passed",
"duration": 1
},
{
"name": "github > get context > pull request",
"started": "2023-12-13T22:27:16.871Z",
"location": "test/github.test.js",
"retries": 0,
"totalDuration": 3,
"status": "passed",
"duration": 3
},
{
"name": "github > get context > branch",
"started": "2023-12-13T22:27:16.876Z",
"location": "test/github.test.js",
"retries": 0,
"totalDuration": 1,
"status": "passed",
"duration": 1
},
{
"name": "github > get context > fails > missing input",
"started": "2023-12-13T22:27:16.877Z",
"location": "test/github.test.js",
"retries": 0,
"totalDuration": 0,
"status": "passed",
"duration": 0
},
{
"name": "github > get inputs > succeeds",
"started": "2023-12-13T22:27:16.879Z",
"location": "test/github.test.js",
"retries": 0,
"totalDuration": 1,
"status": "passed",
"duration": 1
},
{
"name": "github > get inputs > fails > empty input",
"started": "2023-12-13T22:27:16.881Z",
"location": "test/github.test.js",
"retries": 0,
"totalDuration": 1,
"status": "passed",
"duration": 1
},
{
"name": "github > get inputs > fails > non-existent report path",
"started": "2023-12-13T22:27:16.882Z",
"location": "test/github.test.js",
"retries": 0,
"totalDuration": 1,
"status": "passed",
"duration": 1
},
{
"name": "reporter > skipped test",
"started": "2023-12-13T22:27:16.884Z",
"location": "test/reporter.test.js",
"retries": 0,
"totalDuration": 0,
"status": "skipped",
"duration": 0
},
{
"name": "reporter > flaky test",
"started": "2023-12-13T22:27:16.884Z",
"location": "test/reporter.test.js",
"retries": 2,
"totalDuration": 2003,
"status": "passed",
"duration": 0
}
]
} |
Had to merge |
To get lms information it maybe a mix of the output from the framework reporter and the github runner. For example in playwright-ui repo the base url is set in a config file so it would be best to get it from the report. But things like lms version with have to come from the runner. If needed Sam figured out how to use this API in a github workflow, https://instance-metadata.d2l.dev/ |
Adds a reporter for mocha. Doesn't output anything related to
lms
stuff or for each testtool
,experience
,type
orbrowser
. Coming soon. Covers all the require fields. Eventually will move the mocha report out into it's own repo/package (probablytest-reporting-node
/@d2l/test-reporting
or@brightspace/test-reporting
). Looking at adding ad2l-test-reporting.config.json
type of file to help with the missing elements. LMS stuff will probably have to be from environment variables or set directly on the action upload stuff.