Skip to content
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(ui): allow run individual tests/suites from the UI #6641

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

userquin
Copy link
Member

@userquin userquin commented Oct 4, 2024

Description

We need this PR #6405

Since we don't have the full tree in the state (missing parent in task), the client will send the task id, the children ids and all parent ids: parent ids are required to avoid mark the test not being run as skipped and so their state will not change.

We also need to reset configOverride.testNamePattern when re-running some file (including all files), otherwise we can only re-run previous test/suite run, maybe we can have some side effect here (I need to do some additional tests).

Caution

Right now the command line will skip other tests/suites not matching the pattern (using t + regexp): the problem with the UI is about enabling/disabling re-run button, disabled when test/suite without state or state with skip or todo value (check command line filter behaviour screenshot below)

Warning

We should add the test "path" when filtering tests/suites (check filtering from command line screenshot below)

resolves #6638

filtering from command line

imagen

command line filter behaviour

imagen

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@userquin userquin marked this pull request as ready for review October 5, 2024 12:19
await this.changeNamePattern(
task.name,
[task.file.filepath],
this.isSuite(task) ? 'rerun suite' : 'rerun test',
Copy link
Member

@sheremet-va sheremet-va Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

task.type === 'suite' is how you check for suite, no need for extra function


async rerunTask(id: string) {
const task = this.state.idMap.get(id)
if (task) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should throw an error if task it not found?

Copy link
Member Author

@userquin userquin Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I'll ask you about this... or maybe we can rerun all files or passing the filename back again and rerun all tasks in the file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an error is better

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just throw an error?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, something like Task ${id} was not found

sheremet-va
sheremet-va previously approved these changes Nov 7, 2024
@sheremet-va
Copy link
Member

Looks good! There are a few conflicts though

@sheremet-va sheremet-va added this to the 2.2.0 milestone Nov 7, 2024
…l-tests-and-suites

# Conflicts:
#	packages/ui/client/components/explorer/ExplorerItem.vue
#	packages/ui/client/composables/client/index.ts
#	packages/vitest/src/node/core.ts
Copy link

netlify bot commented Nov 7, 2024

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit 06aaf99
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/6734ed6abc5b9600086da212
😎 Deploy Preview https://deploy-preview-6641--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@sheremet-va sheremet-va changed the title feat(vitest,ui): allow run individual tests/suites from the UI feat(ui): allow run individual tests/suites from the UI Nov 8, 2024
@sheremet-va
Copy link
Member

Sorry to ask, but can you resolve the conflict again?

@vitest-dev vitest-dev deleted a comment from Karthik0521 Nov 13, 2024
…l-tests-and-suites

# Conflicts:
#	packages/vitest/src/node/core.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UI] Allow running individual tests/suites
2 participants