Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 2.38 KB

cli-options.md

File metadata and controls

52 lines (40 loc) · 2.38 KB

roca CLI

Reporting

Roca exclusively reports its state via the Test Anything Protocol, and defaults to a Mocha-like "spec" output. Failed tests cause the roca CLI to return a non-zero exit code, which allows most continuous integration systems to automatically detect pass/fail states.

Other output formats are available! See roca --help for more details.

Usage

roca [options] [file names and/or patterns]

For more information, see Running from the command line.

Options

Option Description
-h/--help The help menu.
-s/--source Path to brs files (if different from source/)
-R/--reporter The reporter to use. In addition to all of the mocha reporters, we also offer a Jest-style reporter. Note: we use the tap-mocha-reporter NPM package for Mocha reporters.
-r/--require Path to a required setup file. This file will be run before unit tests. See the --require section for more details.
-f/--forbid-focused Fails if focused test or suite is detected. Useful for use on CI systems to prevent focused tests from being merged.
-c/--coverage-reporters The istanbul coverage reporters to use. Passing in reporter(s) will enable coverage collection and reporting. Otherwise, it is disabled. See --help for options, and istanbul's docs for descriptions of the reporters.

-r/--require

In order to enable custom unit test helper functions and/or unit test setup code, you can create a BrightScript file that will be run before any of your unit tests.

Usage

If you wanted to define a helper function that you could call in any of your unit tests:

' inside myProject/tests/MySetupFile.brs
function callMeAnywhere()
  return 123
end function

Then in your code, you'd have:

' inside myProject/tests/MyTestFile.test.brs
...
m.it("calls a globally-defined test function", sub()
    print callMeAnywhere() ' => 123
end sub)

And then you'd tell to roca to use the setup file:

roca -r "tests/MySetupFile.brs"