hyperledger / cacti

Hyperledger Cacti is a new approach to the blockchain interoperability problem
https://wiki.hyperledger.org/display/cactus
Apache License 2.0
322 stars 275 forks source link

test(weaver/interoperation-node-sdk): fix broken nyc tests #3305

Open petermetz opened 2 weeks ago

petermetz commented 2 weeks ago

Description

cd ./weaver/sdks/fabric/interoperation-node-sdk

$ yarn test
/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/ts-node/dist/index.js:851
            return old(m, filename);
                   ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/get-func-name/index.js from /home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/chai/lib/chai/utils/inspect.js not supported.
Instead change the require of index.js in /home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/chai/lib/chai/utils/inspect.js to a dynamic import() which is available in all CommonJS modules.
    at require.extensions.<computed> [as .js] (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/ts-node/dist/index.js:851:20)
    at Object.<anonymous> (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/chai/lib/chai/utils/inspect.js:4:15)
    at require.extensions.<computed> [as .js] (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/ts-node/dist/index.js:851:20)
    at Object.<anonymous> (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/chai/lib/chai/utils/objDisplay.js:11:15)
    at require.extensions.<computed> [as .js] (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/ts-node/dist/index.js:851:20)
    at Object.<anonymous> (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/chai/lib/chai/utils/getMessage.js:13:18)
    at require.extensions.<computed> [as .js] (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/ts-node/dist/index.js:851:20)
    at Object.<anonymous> (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/chai/lib/chai/utils/index.js:34:22)
    at require.extensions.<computed> [as .js] (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/ts-node/dist/index.js:851:20)
    at Object.<anonymous> (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/chai/lib/chai.js:25:12)
    at require.extensions.<computed> [as .js] (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/ts-node/dist/index.js:851:20)
    at Object.<anonymous> (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/chai/index.js:1:18)
    at require.extensions.<computed> [as .js] (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/ts-node/dist/index.js:851:20)
    at Object.<anonymous> (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/test/AssetManager.js:51:12)
    at m._compile (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/ts-node/dist/index.js:857:29)
    at require.extensions.<computed> [as .js] (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/ts-node/dist/index.js:859:16)
    at /home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/mocha/lib/mocha.js:250:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/mocha/lib/mocha.js:247:14)
    at Mocha.run (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/mocha/lib/mocha.js:576:10)
    at Object.<anonymous> (/home/peter/a/cacti-upstream/weaver/sdks/fabric/interoperation-node-sdk/node_modules/mocha/bin/_mocha:637:18) {
  code: 'ERR_REQUIRE_ESM'
}

=============================== Coverage summary ===============================
Statements   : 0% ( 0/184 )
Branches     : 0% ( 0/57 )
Functions    : 0% ( 0/19 )
Lines        : 0% ( 0/182 )
================================================================================
Handlebars: Access has been denied to resolve the property "statements" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "branches" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "functions" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
Handlebars: Access has been denied to resolve the property "lines" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details

(add more description and relevant links)

Acceptance Criteria

  1. Tests are passing OK

cc: @VRamakrishna @sandeepnRES

petermetz commented 2 weeks ago

The real reason why I stumped upon this is that I wanted to upgrade nyc and when I tried to verify that the tests were still working after the upgrade I realized that they were broken to begin with.

We need to upgrade the nyc dependency because of security vulnerabilities in it's transitive dependencies.

petermetz commented 2 weeks ago

https://github.com/hyperledger/cacti/security/dependabot/1038

hollermay commented 1 week ago

Can i work around this issue? I can try

petermetz commented 1 week ago

Can i work around this issue? I can try

@hollermay You are welcome to work on a fix! Give it a shot and let me know how it goes and if you'd like to take it to the finish line.

hollermay commented 1 week ago

Sure! On it