mochajs / mocha

☕️ simple, flexible, fun javascript test framework for node.js & the browser
https://mochajs.org
MIT License
22.54k stars 3.01k forks source link

🚀 Feature: Show a meaningful error when the HTML reporter is used via the CLI #4137

Open thisismydesign opened 4 years ago

thisismydesign commented 4 years ago

Description

$ npx mocha --opts ./mocha.opts --reporter=html
document is not defined

The real issue here is that html reporter is not even an option from the CLI.

$ npx mocha --reporters

    doc         - HTML documentation
    dot         - dot matrix representation
    json        - single JSON object
    json-stream - newline delimited JSON events
    landing     - Unicode landing strip
    list        - like "spec" reporter but flat
    markdown    - GitHub Flavored Markdown
    min         - essentially just a summary
    nyan        - "nyan cat"
    progress    - a progress bar
    spec        - hierarchical & verbose [default]
    tap         - TAP-compatible output
    xunit       - XUnit-compatible XML output

Using the HTML reporter is recommended in some places without context (e.g. https://stackoverflow.com/a/26635182/2771889).

There seem to be quite a few people confused by this:

Versions

6.2.0

thisismydesign commented 4 years ago

On second look, this seems to only be an issue with the html reporter. Otherwise, I get Unknown "reporter": htmllll.

juergba commented 4 years ago

HTML is a valid reporter, but not intended for CL usage, see docs

related: #1906

thisismydesign commented 4 years ago

HTML is a valid reporter, but not intended for CL usage, see docs

So doesn't that make it invalid in that context? We can argue about the wording but I trust that you get my point..