Skip to content

Setup challenges when running mocha tests #44013

Open
@kieferrm

Description

@kieferrm

Goals

  • Since I run tests many times, I want to run mocha tests out of the box using a keyboard shortcut or a flat command (i.e. one that doesn't require input).
  • I want to navigate directly to test suites and test cases.
  • I want to jump to the last failed test of the most recent test run with a keyboard shortcut.

Getting to a keyboard shortcut

  • Add a test script to package.json and install the npm extension. Then I can use Cmd+R T to run the npm test script. Somehow I have to learn that the npm extension can be helpful.

  • I can try to use tasks. I need to configure tasks, need to configure the default test task, and I need to assign a keyboard shortcut to the run test task command. That's three big hurdles. We have a tasks menu, but that's only talking about build tasks not test tasks. Steep learning curve.

Issue with the terminal

  • In both cases (npm and tasks) the test execution happens in a terminal. The terminal is reused. When running tests I care about the failing tests. The terminal gives me link detection to where the test failed. Great. When I do this the terminal is scrolled away from its default position, i.e. the most recent line of output. Thus, when click the link and I fix the issue and re-run the tests then I don't see the output of the re-run. I need to go to the terminal and scroll to the bottom to see if the test succeeded or failed. A terminal that shows tests should scroll automatically to the bottom.

  • I can assign a keyboard shortcut to focus the active terminal (there is none by default). However, in order to find the failed tests and the link to the source I use the mouse. I'd like to jump to failing tests directly with a keyboard shortcut.

Navigation issues

  • Show Document Symbols and Show Workspace Symbols are unaware of mocha test suites and test cases. I always use search to navigate to my tests.

Issues when debugging

  • The debug console does not support link detection. Thus, when I run tests in the debugger without hitting a breakpoint, I can not easily navigate the test failure.

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions