mochajs / mocha

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

Using Mocha Programmatically should support more than paths #3284

Closed Starmann closed 10 months ago

Starmann commented 6 years ago

Prerequisites

Description

Mocha's programmatic API currently only supports adding files via a path. The problem with this is that the developer might want to process the Javascript first. Although support for Streams would be the ideal, simply being able to evaluate strings via Mocha would be greatly appreciated.

boneskull commented 6 years ago

@Starmann What's the real use case here?

Starmann commented 6 years ago

@boneskull Glad you asked. I'm trying to modify the code first using an Abstract Syntax Tree.

YoSev commented 4 years ago

I am looking for such a solution as well. If i understood @Starmann right, he would like to execute tests programmatically to be able to evaluate the results for further processing. Same goes for me. Those tests are coming via an api (so the webinterface), having access to mocha results as json(streams) would be very handy for a lot of things like notifications etc. (i use mocha for scheduled tests against remote RestAPI's for example)

JoshuaKGoldberg commented 10 months ago

This seems like a very niche request. It would probably be resolved by #1457... but without more detail, it's hard to say.

Closing as wontfix. But if someone reading this really wants this feature, please do file a new issue with our new feature template & describe your situation. I'd be interested to know more. Thanks!