Is there any way to run specific spec file of atom/spec?


#1

I added some code to atom/src/workspace.coffee and some specs to atom/sepc/workspace-spec.coffee .

So I was wondering if there is a way to run only that specific spec file.

The only way to run spec that I know is atom test. But this is too slow. :frowning:


#2

I know of 2 ways:

  1. Move all other -spec.coffee files out of the spec folder while you’re testing
  2. Edit this line to only match the spec files you want. This only works because you’re working in atom’s source code.

Obviously you should move the spec files back or reset the line after testing :wink:

EDIT: Sorry didn’t know about fdescribe


#3

Use the fdescribe, ffdescribe, fffdescribe, fit, ffit and fffit methods to put the focus on a test or a suite of tests.
So if you want to run only the tests in a given file replace the describe at top level by fdescribe.

As for how it works:

  • If you have one or many fff... tests or suites only those tests will run, even if there is ff... or f... tests.
  • If you have one or many ff... tests or suites only those tests will run, even if there is f... tests.
  • If you have one or many f... tests or suites only those tests will run.
  • Without any f..., ff..., fff... tests, the whole suite run.

Also note, that if you leave these focused tests in your files while pushing on travis, the build will fail with a: it encountered a declaration exception Error: Focused spec is running on CI.