[nodejs] Re: How to run mocha test with esm

2019-10-19 Thread Corey Cleary
If you're open to using the esm module , you don't need to use the .mjs extension, or Babel for that matter. Once you've installed esm, you just have to do something like: mocha -r esm [test glob pattern] I just wrote a blogpost about this actually, che

[nodejs] Re: writeFileSync stub causing reference error.

2019-11-01 Thread Corey Cleary
`file` and `data` have no value... so that's why you get the ReferenceError. Understanding why you're trying to stub the filesystem method would help (i.e. - what other code are you trying to test that is causing you to need to stub the fs), but from what I can tell given the context here you c