You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a project that uses power-assert together with karma, mocha, rollup and coffeescript. To make it all work together, I needed to make rollup the only preprocessor to karma, use the coffeescript plugin for rollup, and add power-assert support through the babel preset, which in turn I enabled through the babel plugin for rollup. Since everything needs to run in the browser, I'm also using rollup-plugin-node-polyfills, which ends up providing its own version of the Node.js standard assert module.
With this setup, I ran into the following problem. Wherever assert(...) expressions in my test code are instrumented, it is replaced by complex powerAssert(...) expressions. This presumes that powerAssert is a function. However, the source module is assigning a non-callable object to module.exports as well as module.exports.default. Both of these should actually be the assert.ok function.
Using patch-package, I generated the following diff, which solved my problem. Note that this is a non-breaking change: module.exports and module.exports.default still have all the assert.* functions as properties.
Note that I also replaced the direct assignment of the default property by a define call. I explained the reason for this in more detail in twada/power-assert-runtime#26.
Thanks for making power-assert possible!
I'm working on a project that uses power-assert together with karma, mocha, rollup and coffeescript. To make it all work together, I needed to make rollup the only preprocessor to karma, use the coffeescript plugin for rollup, and add power-assert support through the babel preset, which in turn I enabled through the babel plugin for rollup. Since everything needs to run in the browser, I'm also using rollup-plugin-node-polyfills, which ends up providing its own version of the Node.js standard assert module.
With this setup, I ran into the following problem. Wherever
assert(...)
expressions in my test code are instrumented, it is replaced by complexpowerAssert(...)
expressions. This presumes thatpowerAssert
is a function. However, the source module is assigning a non-callable object tomodule.exports
as well asmodule.exports.default
. Both of these should actually be theassert.ok
function.Using patch-package, I generated the following diff, which solved my problem. Note that this is a non-breaking change:
module.exports
andmodule.exports.default
still have all theassert.*
functions as properties.Note that I also replaced the direct assignment of the
default
property by adefine
call. I explained the reason for this in more detail in twada/power-assert-runtime#26.This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: