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 am trying to use official demo with power-assert. After Mocha run the unit test, it output func.apply(thisObj, args) insted of the descriptive assertion messages.
spec.js
constassert=require('power-assert');describe('Array',function(){letary;beforeEach(()=>{ary=[1,2,3];});describe('#indexOf()',()=>{it('should return index when the value is present',()=>{constzero=0,two=2;assert(ary.indexOf(zero)===two);});it('should return -1 when the value is not present',()=>{constminusOne=-1,two=2;assert.ok(ary.indexOf(two)===minusOne,'THIS IS AN ASSERTION MESSAGE');});});});describe('various types',()=>{lettypes;classPerson{constructor(name,age){this.name=name;this.age=age;}}beforeEach(()=>{types=['string',98.6,true,false,null,undefined,['nested','array'],{object: true},NaN,Infinity,/^not/,newPerson('alice',3)];});it('demo',()=>{constindex=types.length-1,bob=newPerson('bob',5);assert(types[index].name===bob.name);});});
ouput
Array
#indexOf()
1) should return index when the value is present
2) should return -1 when the value is not present
various types
3) demo
0 passing (15ms)
3 failing
1) Array
#indexOf()
should return index when the value is present:
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
func.apply(thisObj, args)
+ expected - actual
-false
+true
at Decorator._callFunc (node_modules/empower-core/lib/decorator.js:110:20)
at Decorator.concreteAssert (node_modules/empower-core/lib/decorator.js:103:17)
at decoratedAssert (node_modules/empower-core/lib/decorate.js:51:30)
at powerAssert (node_modules/empower-core/index.js:63:32)
at Context.it (test/index.spec.js:11:7)
2) Array
#indexOf()
should return -1 when the value is not present:
AssertionError [ERR_ASSERTION]: THIS IS AN ASSERTION MESSAGE
+ expected - actual
-false
+true
at Decorator._callFunc (node_modules/empower-core/lib/decorator.js:110:20)
at Decorator.concreteAssert (node_modules/empower-core/lib/decorator.js:103:17)
at Function.decoratedAssert [as ok] (node_modules/empower-core/lib/decorate.js:51:30)
at Context.it (test/index.spec.js:15:14)
3) various types
demo:
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
func.apply(thisObj, args)
+ expected - actual
-false
+true
at Decorator._callFunc (node_modules/empower-core/lib/decorator.js:110:20)
at Decorator.concreteAssert (node_modules/empower-core/lib/decorator.js:103:17)
at decoratedAssert (node_modules/empower-core/lib/decorate.js:51:30)
at powerAssert (node_modules/empower-core/index.js:63:32)
at Context.it (test/index.spec.js:41:5)
Mocha v6.1.4
power-assert v1.6.1
Node v10.15.2
The text was updated successfully, but these errors were encountered:
I am trying to use official demo with
power-assert
. After Mocha run the unit test, it outputfunc.apply(thisObj, args)
insted of the descriptive assertion messages.spec.js
ouput
Mocha v6.1.4
power-assert v1.6.1
Node v10.15.2
The text was updated successfully, but these errors were encountered: