As amazing as power-assert is, it's constantly causing my team problems. Often it results in reeeeally weird behavior (for example, sometimes suddenly AVA thinks we have infinite tests and runs them like it's got a mind of its own until we kill the process). Often the issues involve JSX, enzyme wrappers, objects with circular references, and upcoming JS features.
Many of the problems that have come up with power-assert in the past have been fixed which is awesome, but it's still just too much magic for my team to stay productive and still causes us a great deal of grief. I love it when it works, but I just don't think that we can keep using it. We're seriously considering changing frameworks because of this (and some perf issues which I know are being worked on).
Expose a config to disable power-assert:
{
"ava": {
"powerAssert": false
}
}
Then this:
var defaultPlugins = lazy(function () {
return [
espowerPlugin(),
require('babel-plugin-ava-throws-helper'),
rewritePlugin(),
require('babel-plugin-transform-runtime')
];
});
function build(babelConfig, filePath, code) {
// ...
objectAssign(options, {
inputSourceMap: sourceMap,
filename: filePath,
sourceMaps: true,
ast: false
});
// ...
options.plugins = (options.plugins || []).concat(defaultPlugins());
// ...
}
Could be changed to this:
var defaultPlugins = lazy(function (options) {
return [
options.powerAssert ? espowerPlugin() : null,
require('babel-plugin-ava-throws-helper'),
rewritePlugin(),
require('babel-plugin-transform-runtime')
].filter(plugin => !!plugin); // filter out null plugins
});
function build(babelConfig, filePath, code) {
// ...
objectAssign(options, {
inputSourceMap: sourceMap,
filename: filePath,
sourceMaps: true,
ast: false,
powerAssert: true
});
// ...
options.plugins = (options.plugins || []).concat(defaultPlugins(options));
// ...
}
Here's a diff:
- var defaultPlugins = lazy(function () {
+ var defaultPlugins = lazy(function (options) {
return [
- espowerPlugin()
+ options.powerAssert ? espowerPlugin() : null,
require('babel-plugin-ava-throws-helper'),
rewritePlugin(),
require('babel-plugin-transform-runtime')
- ]
+ ].filter(plugin => !!plugin); // filter out null plugins
});
function build(babelConfig, filePath, code) {
// ...
objectAssign(options, {
inputSourceMap: sourceMap,
filename: filePath,
sourceMaps: true,
- ast: false
+ ast: false,
+ powerAssert: true
});
// ...
- options.plugins = (options.plugins || []).concat(defaultPlugins());
+ options.plugins = (options.plugins || []).concat(defaultPlugins(options));
// ...
}
Without actually testing this, it seems to me like it would work. Thoughts? 馃挱
My personal favorite power-assert issue from last week was failing the same test over and over again

Makes sense to me. I've run into some problems with power-assert in the past too.
That doesn't mean you shouldn't report issues regarding power-assert, though. @xjamundx Can you open a separate issue about that?
I'd like to work on this. I want to get more accustomed to the AVA codebase.
Should this only be a setting available in the config, or also using the CLI?
If also in the CLI, what should the flag be named? --no-power-assert?
Sounds good to me
If also in the CLI, what should the flag be named? --no-power-assert?
馃憤
Created an issue instead: https://github.com/avajs/ava/issues/1138
Most helpful comment
I'd like to work on this. I want to get more accustomed to the AVA codebase.