I was writing composer test.In my origin codes, the logic.js include request.post which interact with other server. I add var request = require('request') in the beginning to avoid error which is "error 'request' is not defined". in this way, I can translate the package into a .bna file, and work well. But when I try to write some unit test with 'embeded', the error came up with ReferenceError: require is not defined. I add the 'require' package in my package.json file.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
this is because that 'eslint'
is complaining it doesn't know what to do with request when you run npm test
etc.
We shoud add the comment like
/* global getAssetRegistry getFactory emit request */
follow the example: https://github.com/hyperledger/composer-sample-networks/blob/master/packages/basic-sample-network/lib/sample.js#L15