-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(runner): Add full names to tasks #9087
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
feat(runner): Add full names to tasks #9087
Conversation
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 test should most likely never change, so I kept manual assertions for debuggability. Could convert to a snapshot or something more automated if necessary.
packages/runner/src/suite.ts
Outdated
|
|
||
| allChildren.forEach((task) => { | ||
| task.file = file | ||
| task.fullName = createTaskName([file.fullName, task.fullName]) |
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.
Not entirely sure about this. file seems to be "injected" at a later stage, so to include the file path I had to change all children's fullName. Is there a better way of doing this?
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.
yeah, it seems weird that it works like that, maybe we can add the file sooner?
packages/runner/src/utils/tasks.ts
Outdated
|
|
||
| export function getTestName(task: Task, separator = ' > '): string { | ||
| return getNames(task).slice(1).join(separator) | ||
| return createTaskName(getNames(task).slice(1), separator) |
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 just adds more loops, let's keep these two as they were
packages/runner/src/suite.ts
Outdated
|
|
||
| allChildren.forEach((task) => { | ||
| task.file = file | ||
| task.fullName = createTaskName([file.fullName, task.fullName]) |
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.
yeah, it seems weird that it works like that, maybe we can add the file sooner?
sheremet-va
left a comment
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.
Looks good, just some refactoring ideas
packages/runner/src/collect.ts
Outdated
| runner.onCollectStart?.(file) | ||
|
|
||
| clearCollectorContext(filepath, runner) | ||
| clearCollectorContext(filepath, runner, file) |
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.
We can just pass down file first and get file.filepath from it inside the function
packages/runner/src/suite.ts
Outdated
| ): void { | ||
| if (!defaultSuite) { | ||
| defaultSuite = createDefaultSuite(currentRunner) | ||
| defaultSuite = createDefaultSuite(currentRunner, file) |
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.
Maybe it's better to assign it after it's created/read here? (on line 225) If defaultSuite already exists in isolate: false, I think it will have incorrect file at one point
Description
Add
fullNameandfullTestNametoTaskBase.fullNameis the concatenation of any parent suites and the task's name using>as a separator, it includes the file path.fullTestNameis likefullName, excluding the file path. It'sundefinedforFiletasks.This should be the last necessary step towards a fix for #8853.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.