MonkeyBonkey
MonkeyBonkey

Reputation: 47881

in webstorm how to create a mocha test configuration for a single test

I want to debug just a single test in webstorm. The mocha options specify a test directory, but I can't seem to point it to just a single test.js file.

How can I debug/run configure a single mocha test using the webstorm debug configuration options?

Upvotes: 1

Views: 798

Answers (4)

arielhad
arielhad

Reputation: 2153

Why not just create a test folder and create your .js test file inside?

Upvotes: 0

MonkeyBonkey
MonkeyBonkey

Reputation: 47881

I solved this by pointing to a random non-test directory as the test directory and passing my single test filename in as an "extra mocha option"

Upvotes: 0

Guilherme Rodrigues
Guilherme Rodrigues

Reputation: 2854

As a hack, you could configure the mocha command directly with the CLI option:

mocha --grep login-failure.js

Also, you can use the only function to skip all other tests:

describe(function () {
  // these tests will be skipped
});
describe.only(function () {
  // these tests will run 
});

Source: http://jaketrent.com/post/run-single-mocha-test/

Upvotes: 1

LazyOne
LazyOne

Reputation: 165178

As far as I'm aware it's not currently supported.

https://youtrack.jetbrains.com/issue/WEB-10067 -- watch this ticket (star/vote/comment) to get notified on progress.

Upvotes: 0

Related Questions