-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: assert._capt is not a function #42
Comments
I assume that you are still using normal In this case, please change here, from global.assert = require('assert') to global.assert = require('power-assert') |
Ohhhhh, duh. Thank you. |
Added to FAQ. Thanks! |
FYI: if you are using Babel, you can use babel-plugin-empower-assert to solve this problem. With babel-plugin-empower-assert, you can enhance normal {
"presets": [
. . .
],
"env": {
"development": {
"plugins": [
"babel-plugin-empower-assert",
"babel-plugin-espower"
]
}
}
} |
Thanks @twada. To be honest I still wasn't able to get past this bug when writing a vanilla library. I tried using the "intelli" loader and then power-assert but it didn't work. My only theory is that maybe the loader has to be loaded in a separate file from any requires of power-assert? The repo in question is the same one: github.com/testdouble/scripty if you have a minute to advise me (I'm using a very minimal testing lib that doesn't provide much abstraction) |
@searls Thank you for your question. I've cloned your repo and enabled power-assert. Here is the patch. diff --git a/package.json b/package.json
index 93aaeee..938157b 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,10 @@
},
"homepage": "https://github.com/testdouble/scripty#readme",
"devDependencies": {
+ "espower": "power-assert-js/espower#embedded-recorder",
+ "espower-loader": "^1.0.0",
"intercept-stdout": "^0.1.2",
+ "power-assert": "^1.3.1",
"rimraf": "^2.5.2",
"semver": "^5.1.0",
"standard": "^6.0.8",
diff --git a/test/safe-helper.js b/test/safe-helper.js
index 118208e..21a2d6b 100644
--- a/test/safe-helper.js
+++ b/test/safe-helper.js
@@ -1,5 +1,10 @@
+require('espower-loader')({
+ cwd: process.cwd(),
+ pattern: 'test/safe/**/*.js'
+})
+
var decorateAssertions = require('./decorate-assertions')
-global.assert = decorateAssertions(require('assert'))
+global.assert = decorateAssertions(require('power-assert'))
var log = require('../lib/log')
diff --git a/test/unit-helper.js b/test/unit-helper.js
index c695b96..700cb61 100644
--- a/test/unit-helper.js
+++ b/test/unit-helper.js
@@ -1,7 +1,12 @@
+require('espower-loader')({
+ cwd: process.cwd(),
+ pattern: 'lib/**/*.test.js'
+})
+
global.td = require('testdouble')
var decorateAssertions = require('./decorate-assertions')
-global.assert = decorateAssertions(require('assert'))
+global.assert = decorateAssertions(require('power-assert'))
var log = require('../lib/log')
Thanks. |
Same question, why can't use intelli-espower-loader with assert? |
@popomore Now you can use intelli-espower-loader (espower-loader) with |
@twada Good Job |
I tried to add this really simply to my vanilla Node.js module using intelli-espower-loader, but right from the jump I got this error: "TypeError: assert._capt is not a function"
Any root causes?
To reproduce, you can check out this repo at this commit: testdouble/scripty@4a00d0f
The text was updated successfully, but these errors were encountered: