No way to use custom mocha ui
See original GitHub issueCurrently it’s impossible to use custom mocha ui.
What I want is extra config option which allow to specify which files I want to load before bootstraping mocha (before adapter.js
)
var initMocha = function (files, mochaConfig) {
var mochaPath = path.dirname(require.resolve('mocha'))
files.unshift(createPattern(__dirname + '/adapter.js'))
// HERE: I want to iterate over config.mochaFiles and add them right after mocha.js
files.unshift(createPattern(mochaPath + '/mocha.js'))
if (mochaConfig && mochaConfig.reporter) {
files.unshift(createPattern(mochaPath + '/mocha.css'))
}
}
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Mocha - the fun, simple, flexible JavaScript test framework
Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun.
Read more >Is there a way to start Mocha tests from a React UI?
I am looking for a way to run Mocha either through the web or programmatically. React has made this a bit of a...
Read more >Allow custom mocha runner interface to be specified
Mocha allows using custom 3rd-party test interfaces (there lots of them) but there is no way to use anything than you have in...
Read more >Getting Started with Node.js and Mocha - Semaphore Tutorial
Mocha is a simple, extensible and fast testing library for Node.js. This article will walk you through its installation, configuration and usage.
Read more >Testing Node.js with Mocha and Chai
Mocha does not discriminate, regardless of which assertion library you choose to use. If you're using Mocha in a Node.js environment, you can ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@stalniy I’ve had some success getting your https://github.com/stalniy/bdd-lazy-var
mocha ui
to work by making the following changes tolib/index.js#initMocha
:I’ve generalised this solution, by using @dtothefp idea of a
require
array:lib/index.js#initMocha
Also need to exclude the require array from being sent to mocha in the adapter. Will throw a PR together asap.
Think this is related but it would be nice to have a
require
option similar togulp-mocha
where we could hook into the--require
functionality.ex.
Specifically this would be useful for me to do something like https://labnotes.org/yield-to-the-test-using-mocha-with-es6-generators/ where you could hook into something like
mocha.Runnable.prototype.run
before instantiation