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

improve failure reporting for the whole project #146

Merged
merged 3 commits into from
Oct 1, 2017

Conversation

connectdotz
Copy link
Collaborator

This PR addressed the issues discussed in #129, mainly to make managing tests easier (especially for monorepo projects) by providing the test state for the "whole-project" in addition to the "changed", plus a few usability/stability enhancement.

change outline

  • added an initial full test run (a.k.a. non-watch-mode) phase when the runner first started, followed by the watch-mode run so the subsequent changes can be tested efficiently without losing sight of the whole project state.
  • all the failed tests will be shown in the problem inspectors independent of the editors.
    • note, consequently, only the line position is available in the inspector.
  • fixed an issue that, under some race condition, caused the spinner to spin forever.
  • added more information on the status bar, such as watch-mode/initial run, number of failed test suites etc.
  • upgraded almost all the dependencies to the latest versions
  • some refactoring to improve efficiency, stability, and readability.
  • improve test coverage

Note

  • This PR depends on jest #4572.

Follow up

  • it might be helpful to document the limit of vscode-jest monorepo support, such as it doesn't support lerna style package-level-testing, i.e. multiple jest processes/output; and that it requires one jest config for the whole project...
  • large project might take a bit longer for the initial full test run, wondering if we should add an option to turn this feature on/off. If we do allow "partial" test reporting, we should clearly state it in the statusBar to avoid confusion/misleading.

@connectdotz connectdotz changed the title add failure reporting for the whole project improve failure reporting for the whole project Oct 1, 2017
Copy link
Member

@orta orta left a comment

Choose a reason for hiding this comment

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

👍 looks great to me, I won't merge until the next jest patch release though (when someone installs the extension it will get deps from NPM, so the dep needs to exist in npm (not just on my computer for deploys)

/cc @cpojer

status.success()
} else {
status.failed()
status.failed(` (${failedFileCount} test suite${failedFileCount > 1 ? 's' : ''} failed)`)
Copy link
Member

Choose a reason for hiding this comment

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

nice move 👍

import { TestFileAssertionStatus } from 'jest-editor-support'
import { TestReconciliationState } from './TestReconciliationState'

export function updateDiagnositics(testResults: TestFileAssertionStatus[], diagnostics: vscode.DiagnosticCollection) {
Copy link
Member

Choose a reason for hiding this comment

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

updateDiagnositics, typo: updateDiagnostics

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, indeed... Looks like you already merged it, I will submit a new PR then

export function failedSuiteCount(diagnostics: vscode.DiagnosticCollection): number {
let sum = 0
diagnostics.forEach(() => sum++)
return sum
Copy link
Member

Choose a reason for hiding this comment

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

interesting, I didn't know reduce was not a part of the JS core library

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Array.prototype.reduce() is indeed part of JS core, unfortunately diagnostics is a vscode.DiagnosticCollection, which only exposes forEach() iterator... I know it looked stupid but we have no choice here...

Copy link
Member

Choose a reason for hiding this comment

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

👍

setTimeout(() => initial(), 2000)
}

function updateStatus(message: string) {
function updateStatus(message: string, details?: string) {
Copy link
Member

Choose a reason for hiding this comment

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

nice move

@cpojer
Copy link

cpojer commented Oct 1, 2017

Published 21.3.0-alpha.eff7a1cf for you guys.

@orta
Copy link
Member

orta commented Oct 1, 2017

ohhh yeahhh, thanks!

@orta orta merged commit ae82a41 into jest-community:master Oct 1, 2017
@connectdotz connectdotz deleted the monorepo-support branch October 1, 2017 22:27
legend1202 pushed a commit to legend1202/vscode-jest that referenced this pull request Jun 18, 2023
improve failure reporting for the whole project
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.

3 participants