Closed bvqbao closed 2 years ago
Odd, not come across that before. No setup required other than npm install
(or yarn install
) to ensure the deps are there.
I presume you've done that?
Yes. I have done npm install
.
git clone ...
cd txforge
npm install
npm run test
Node version: 14.16.1 Npm version: 6.14.12
Can you check in you package-lock file what version of bsv is installed?
In my local repo which works I have version 2.0.4. Try specifying that version in package.json
.
tbh I'd be surprised if this is the problem, but it's worth trying to rule it out.
package-lock.json says 2.0.10.
The error here seems to be: import bsv from 'bsv'
.
It doesn't work for some reasons, so bsv
is undefined.
VSCode has a following notice: "Could not find a declaration file for module 'bsv'. bsv.cjs.js implicitly has an 'any' type".
Update: I have changed the import line to const bsv = require('bsv')
, and the error disappears for cast.test.js
(other files still have the error). txforge uses import syntax, so I don't think this is a good fix.
Ok. I changed import bsv from 'bsv'
to import * as bsv from 'bsv'
and it works!
Not sure if you are ok with this change? I will submit a pull request if necessary.
Anyway, the main thing is I want to submit a pull request to fix a bug in p2ms.js
.
So if you are ok with the import changes, I will make two pull requests.
I guess the bsv
maintainers have made a change that has removed the global export. This can only be recent - maybe specifically in 2.0.10
.
Please dont do a PR for the bsv import as I want to ask them if it is intentional. They'll probably break all my libraries with this change so I would rather they revert the change.
However, happy to see the PR for any p2ms fixes 🙏
Hi,
I would like to modify the txforge library but I cannot run any test. Here is the error:
I tried to run the tests for txforge on both Ubuntu and Windows. Same error!
It seems that there are problems with the bsv library. Is there any special setup that I missed in order to run the tests?
Thanks,