-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Mocha compatibility #1228
Comments
Hi @krzkaczor. Truffle does expose / consume a The syntax is: module.exports = {
networks: {
...etc...
},
mocha: {
someOption: <some-value>,
anotherOption: <another-value>
}
}; Truffle just passes mocha this object so anything that usually works with mocha should theoretically be fine. The An example of mocha extensions working ok with truffle is eth-gas-reporter which uses mocha's third-party-reporter feature. If you have a chance could you see if |
@krzkaczor Do the mocha options in the config work for your use case? Is this closable? |
@cgewecke thanks for your response. So I guess, what I am asking about is: can i run mocha cli ( |
@krzkaczor At the moment no - unless you write your own version of what happens at truffle in the test command. That code is mostly here and the key resources injected into the test environment are here. Mocha's also passed the config options object and accounts are injected into It is possible to write
|
Advantages
All advantages that I can see are around tooling support (mostly IDEs and editors). For example, things that would work out of the box if it was pure mocha:
Implementation problems
The biggest problem right now is that without workarounds like mocha-prepare or changes to mocha itself it's impossible to run all required async tasks before running tests itself.
Another problem, of course, is that
truffle
usescontract
functions to describe tests suites instead of relying ondescribe
. I am curious what's the reasoning behind it and could it be easily replaced withdescribe
?Is there any pressure for bringing full compatibility with mocha?
The text was updated successfully, but these errors were encountered: