In case of promise is NOT fullfilled forever, mocha doens't give any information about this.
See test below.

    describe('test', function () {
        it('test', async () => {
            await new Promise((r, j) => {});
            console.log('hello');
        });
    })

This gives only following result in terminal

    test
      test
Waiting for the debugger to disconnect...
Killed

No more informations!

Environment: Hyperledger Fabric v1.2

Fabric uses 'npm install --production' to build chaincode docker image.
(https://github.com/hyperledger/fabric/blob/release-1.2/core/chaincode/platforms/node/platform.go#L188)

And run CC by using 'npm start -- --peer.address'
(https://github.com/hyperledger/fabric/blob/release-1.2/core/chaincode/container_runtime.go#L147)

So, only following files are needed to be released

  • javascript files
  • package.json
  • package-lock.json

In case of NodeJs, javascript files should be deployed to peer nodes. So, usually uglifying and optimization is required.
And webpack is most popular tool for this requirements.
And in case that all source codes are bundled to one file - bundle.js - then, releasing only three files are enough!

  • bundle.js
  • package.json
  • package-lock.json

And 'npm start' may look like 'node bundle.js'.

        {
            "type": "node",
            "request": "launch",
            "name": "Mocha Current File",
            "program": "${workspaceFolder}/node_modules/.bin/_mocha",   ⇐ “_mocha” NOT “mocha”
            "runtimeArgs": [
                "--nolazy",
                "--max_old_space_size=16384",
                "--preserve-symlinks"    <=== Important. Related with way of resolving module by node.
            ],
            "args": [
                "-r",
                "ts-node/register",
                "--no-timeouts",
                "--colors",
                "src/index.spec.ts"
            ],
            "outFiles": [
                "${workspaceFolder}/build"  <=== This is very important NOT "${workspaceFolder}/build/**/*.js"
            ],
            "console": "integratedTerminal",
            "sourceMaps": true,
            "skipFiles": [
                "node_modules/**/*.js",
                "<node_internals>/**/*.js"
            ],
            "internalConsoleOptions": "neverOpen"
        }


<IMPORTANT NOTE>

if “program” is “ts” file; then
    outFiles: ["${workspaceFolder}/build/**/*.js"]
else if “program” is other executable using ‘ts-node/register’; then
    outFiles SHOULD be removed.
fi

*** In case of Mocha, if ‘outFiles’ are described, breakpoint cannot be reached!

+ Recent posts