Skip to content

Make CLI more reusable #2578

@rijnhard

Description

@rijnhard

Hi

In our use case mocha is basically the underlying engine for a behavioural framework we wrote that tests a bunch of async systems we use in-house.

We did a lot, but for brevity we write the behaviours in mocha specs, and use it to assert the systems output during a test case run. This allows us to test that the system is behaving the way that it should since it's basically a giant async state machine constantly spewing out state change notifications.

In our test case we want our framework to work as much as is possible with other mocha tools.
The problem is that using the Runner class you basically lose all of the third party tool support unless you want to reimplement the entire mocha cli on your own.

I have used Commander extensively in many other projects, so I have figured out how to make the CLI more reusable.

More details are in the PR (#2553)

I am willing to make any changes requested myself. And the functionality of the cli has not changed, so if you choose not to expose a CLI component for reuse then this can be looked at as just a code cleanup.

I know I shouldn't have made these changes without speaking to you first, but as the PR says I didn't even know if it would be possible or work, so I dug into it face first and by the time I proved it could be done, I had it working.

FYI I am using my PR in said testing framework and its working well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs reviewa maintainer should (re-)review this pull requesttype: featureenhancement proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions