Comments (7)
Truffle 5 was released yesterday woop woop https://truffleframework.com/blog/truffle-v5-has-arrived - I am happy to help fix and test this @rzadp - just point me in the right direction as had a look but I am not that familiar with how it all fits together. Let me know if I can help out or if you have any time to look at this.
from bn-chai.
Hello,
I did not hear about should.js before, so bn-chai probably won't work with it.
Is it working for you if you try the expect style?
expect(myValue).to.be.eq.BN(0)
from bn-chai.
Thanks for the quick response @rzadp - I have tried, and I get the following output Invalid Chai property: eq.BN. See docs for proper usage of "eq".
when switching to expect(myValue).to.be.eq.BN(0)
?
from bn-chai.
OK, so it looks like should.js is interfering / overwriting Chai properties created by bn-chai.
I guess it's worth trying a different order of initialization, as in:
require('chai')
.use(require('chai-as-promised'))
.should();
.use(bnChai(web3.utils.BN))
If it doesn't help then unfortunately looks like these libs do not work with each other in their current state.
from bn-chai.
Looks like that ordering is possible, I get this require(...).use(...).should(...).use is not a function
from bn-chai.
Attaching a quick debugger it looks to me like all the flag checks return true
- not sure if this helps.
from bn-chai.
@jamesmorgan
I looked at this, and I'm not sure where this issue with all flags checked is coming from.
But the way I see it, since you're using should.js, maybe you should be adding eq
and other assertions using Assertion.add()
from should.js, instead of using this lib which uses chai.Assertion.addProperty
?
If this is a blocker then I guess you can just (bn1.eq(bn2)).should.be.true
etc, instead of using the lib - after all, the lib doesn't do anything more than wrap this to try and make it a little more expressive like bn1.should.eq.BN(bn2)
At Ethworks we are focusing more on Waffle, which has BN assertions build-in. You can check it out and see if it is of any interest to you.
from bn-chai.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bn-chai.