Page MenuHomePhabricator

[mock-chronik-client] Support sub/unsub address method for ws
ClosedPublic

Authored by bytesofman on Mar 2 2024, 23:15.

Details

Summary

Ref D15611, support this new chronik-client functionality in mock-chronik-client

Depends on D15621

Test Plan

npm test

Event Timeline

Publish this as a package

  • Modify CI so that mock-chronik-client dependencies are installed for test suites that require them D15615
  • Then we can get the CI to pass here

Tail of the build log:

  npm audit fix --force

Run `npm audit` for details.

> ecash-herald@1.0.0 test
> mocha --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/ecash-herald-junit.xml --reporter-options testsuitesTitle=Ecash Herald Unit Tests --reporter-options rootSuiteTitle=Ecash Herald


Error: Cannot find module 'ecashaddrjs'
Require stack:
- /work/apps/mock-chronik-client/index.js
- /work/apps/ecash-herald/test/chronik.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/ecash-herald/test/chronik.test.js:6:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/ecash-herald/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/ecash-herald/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/ecash-herald/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/ecash-herald/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/ecash-herald/node_modules/mocha/lib/cli/run.js:370:5)
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='0']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/ecash-herald-junit.xml': No such file or directory
Build ecash-herald-tests failed with exit code 1

Tail of the build log:

- /work/apps/mock-chronik-client/index.js
- /work/apps/alias-server/test/chronik.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/alias-server/test/chronik.test.js:16:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/alias-server/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/alias-server/node_modules/mocha/lib/cli/run.js:370:5)
------------------------|---------|----------|---------|---------|-------------------
File                    | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
------------------------|---------|----------|---------|---------|-------------------
All files               |    7.77 |        0 |       0 |    7.98 |                   
 alias-server           |     100 |      100 |     100 |     100 |                   
  config.js             |     100 |      100 |     100 |     100 |                   
 alias-server/constants |     100 |      100 |     100 |     100 |                   
  alias.js              |     100 |      100 |     100 |     100 |                   
 alias-server/src       |    7.27 |        0 |       0 |    7.47 |                   
  alias.js              |    5.88 |        0 |       0 |    6.06 | 23-369            
  app.js                |   16.66 |        0 |       0 |   16.66 | 23-183            
  chronik.js            |    4.47 |        0 |       0 |    4.76 | 12-196            
  db.js                 |    6.09 |        0 |       0 |    6.09 | 17-308            
  utils.js              |       5 |        0 |       0 |    5.26 | 12-160            
------------------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='29']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='373']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='140']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='40']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='29']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='363']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/alias-server-junit.xml': No such file or directory
Build alias-server-tests failed with exit code 1

Tail of the build log:

found 0 vulnerabilities

> token-server@0.0.0 test
> mocha --recursive --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/token-server-junit.xml --reporter-options testsuitesTitle=Token Server Unit Tests --reporter-options rootSuiteTitle=Token Server


Error: Cannot find module 'ecashaddrjs'
Require stack:
- /work/apps/mock-chronik-client/index.js
- /work/apps/token-server/test/chronik/wsHandler.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/token-server/test/chronik/wsHandler.test.js:8:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/token-server/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/token-server/node_modules/mocha/lib/cli/run.js:370:5)
--------------|---------|----------|---------|---------|-------------------
File          | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
--------------|---------|----------|---------|---------|-------------------
All files     |   33.33 |      100 |       0 |   33.33 |                   
 wsHandler.js |   33.33 |      100 |       0 |   33.33 | 13-22,30          
--------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='9']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='9']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/token-server-junit.xml': No such file or directory
Build token-server-tests failed with exit code 1

Tail of the build log:

      8 |     MockChronikClient: class {

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.require (../apps/mock-chronik-client/index.js:5:18)
      at Object.require (src/components/fixtures/helpers.js:5:1)
      at Object.require (src/components/Etokens/__tests__/CreateToken.test.js:10:1)

FAIL src/hooks/__tests__/useWallet.test.js
  ● Test suite failed to run

    Cannot find module 'ecashaddrjs' from '../apps/mock-chronik-client/index.js'

    Require stack:
      /work/apps/mock-chronik-client/index.js
      src/components/fixtures/helpers.js
      src/hooks/__tests__/useWallet.test.js

      3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
      4 | 'use strict';
    > 5 | const cashaddr = require('ecashaddrjs');
        |                  ^
      6 |
      7 | module.exports = {
      8 |     MockChronikClient: class {

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.require (../apps/mock-chronik-client/index.js:5:18)
      at Object.require (src/components/fixtures/helpers.js:5:1)
      at Object.require (src/hooks/__tests__/useWallet.test.js:18:1)

FAIL src/components/fixtures/__tests__/CashtabTestWrapper.test.js
  ● Test suite failed to run

    Cannot find module 'ecashaddrjs' from '../apps/mock-chronik-client/index.js'

    Require stack:
      /work/apps/mock-chronik-client/index.js
      src/components/fixtures/helpers.js
      src/components/fixtures/__tests__/CashtabTestWrapper.test.js

      3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
      4 | 'use strict';
    > 5 | const cashaddr = require('ecashaddrjs');
        |                  ^
      6 |
      7 | module.exports = {
      8 |     MockChronikClient: class {

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.require (../apps/mock-chronik-client/index.js:5:18)
      at Object.require (src/components/fixtures/helpers.js:5:1)
      at Object.require (src/components/fixtures/__tests__/CashtabTestWrapper.test.js:13:1)


Test Suites: 15 failed, 13 passed, 28 total
Tests:       468 passed, 468 total
Snapshots:   0 total
Time:        11.756 s
Ran all test suites.
Build cashtab-tests failed with exit code 1

Tail of the build log:

- /work/apps/examples/test/sendXec.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/examples/test/sendXec.test.js:20:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/examples/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/examples/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/examples/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/examples/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/examples/node_modules/mocha/lib/cli/run.js:370:5)
-----------------------------|---------|----------|---------|---------|-------------------
File                         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-----------------------------|---------|----------|---------|---------|-------------------
All files                    |   49.26 |    11.11 |   44.44 |    49.5 |                   
 mocks                       |    3.22 |        0 |       0 |    3.22 |                   
  chronikMock.js             |    1.63 |        0 |       0 |    1.63 | 11-160            
  chronikResponses.js        |     100 |      100 |     100 |     100 |                   
 scripts                     |    69.5 |       25 |   88.88 |      70 |                   
  createWallet.js            |     100 |      100 |     100 |     100 |                   
  getDetailsFromTxid.js      |      80 |      100 |     100 |      80 | 20,35             
  getTokenDetails.js         |      80 |      100 |     100 |      80 | 20,34             
  getTxHistoryFromAddress.js |   73.33 |      100 |     100 |   73.33 | 29-36,58          
  getUtxosFromAddress.js     |      75 |      100 |     100 |      75 | 30-32,47          
  listenForConfirmation.js   |      50 |        0 |      50 |      50 | 18-45             
  sendXec.js                 |      60 |     37.5 |     100 |   61.11 | 69-146,205,233    
-----------------------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='100']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='203']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='27']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='16']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='36']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='100']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='202']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/examples-junit.xml': No such file or directory
Build app-dev-examples failed with exit code 1

Tail of the build log:

Error: Cannot find module 'ecashaddrjs'
Require stack:
- /work/apps/mock-chronik-client/index.js
- /work/apps/token-server/test/chronik/wsHandler.test.ts
- /work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js
- /work/apps/token-server/node_modules/mocha/lib/mocha.js
- /work/apps/token-server/node_modules/mocha/lib/cli/one-and-dones.js
- /work/apps/token-server/node_modules/mocha/lib/cli/options.js
- /work/apps/token-server/node_modules/mocha/bin/mocha.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/work/apps/token-server/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at /usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4
    at require.extensions.<computed> (/work/apps/token-server/node_modules/ts-node/src/index.ts:1608:43)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/token-server/test/chronik/wsHandler.test.ts:8:1)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module.m._compile (/work/apps/token-server/node_modules/ts-node/src/index.ts:1618:23)
    at module.exports (/usr/lib/node_modules/nyc/node_modules/default-require-extensions/js.js:7:9)
    at /usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4
    at require.extensions.<computed> (/work/apps/token-server/node_modules/ts-node/src/index.ts:1621:12)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.exports.requireOrImport (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:53:16)
    at async Object.exports.loadFilesAsync (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/token-server/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async Object.exports.handler (/work/apps/token-server/node_modules/mocha/lib/cli/run.js:370:5)
--------------|---------|----------|---------|---------|-------------------
File          | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
--------------|---------|----------|---------|---------|-------------------
All files     |   36.36 |      100 |       0 |   22.22 |                   
 wsHandler.ts |   36.36 |      100 |       0 |   22.22 | 23-33,41          
--------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='4']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='11']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='4']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='2']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='9']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/token-server-junit.xml': No such file or directory
Build token-server-tests failed with exit code 1

Tail of the build log:

Error: Cannot find module 'ecashaddrjs'
Require stack:
- /work/apps/mock-chronik-client/index.js
- /work/apps/token-server/test/chronik/wsHandler.test.ts
- /work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js
- /work/apps/token-server/node_modules/mocha/lib/mocha.js
- /work/apps/token-server/node_modules/mocha/lib/cli/one-and-dones.js
- /work/apps/token-server/node_modules/mocha/lib/cli/options.js
- /work/apps/token-server/node_modules/mocha/bin/mocha.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/work/apps/token-server/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at /usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4
    at require.extensions.<computed> (/work/apps/token-server/node_modules/ts-node/src/index.ts:1608:43)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/token-server/test/chronik/wsHandler.test.ts:8:1)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module.m._compile (/work/apps/token-server/node_modules/ts-node/src/index.ts:1618:23)
    at module.exports (/usr/lib/node_modules/nyc/node_modules/default-require-extensions/js.js:7:9)
    at /usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4
    at require.extensions.<computed> (/work/apps/token-server/node_modules/ts-node/src/index.ts:1621:12)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.exports.requireOrImport (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:53:16)
    at async Object.exports.loadFilesAsync (/work/apps/token-server/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/token-server/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async Object.exports.handler (/work/apps/token-server/node_modules/mocha/lib/cli/run.js:370:5)
--------------|---------|----------|---------|---------|-------------------
File          | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
--------------|---------|----------|---------|---------|-------------------
All files     |   36.36 |      100 |       0 |   22.22 |                   
 wsHandler.ts |   36.36 |      100 |       0 |   22.22 | 23-33,41          
--------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='4']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='11']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='4']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='2']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='9']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/token-server-junit.xml': No such file or directory
Build token-server-tests failed with exit code 1

Tail of the build log:

- /work/apps/mock-chronik-client/index.js
- /work/apps/alias-server/test/chronik.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/alias-server/test/chronik.test.js:16:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/alias-server/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/alias-server/node_modules/mocha/lib/cli/run.js:370:5)
------------------------|---------|----------|---------|---------|-------------------
File                    | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
------------------------|---------|----------|---------|---------|-------------------
All files               |    7.77 |        0 |       0 |    7.98 |                   
 alias-server           |     100 |      100 |     100 |     100 |                   
  config.js             |     100 |      100 |     100 |     100 |                   
 alias-server/constants |     100 |      100 |     100 |     100 |                   
  alias.js              |     100 |      100 |     100 |     100 |                   
 alias-server/src       |    7.27 |        0 |       0 |    7.47 |                   
  alias.js              |    5.88 |        0 |       0 |    6.06 | 23-369            
  app.js                |   16.66 |        0 |       0 |   16.66 | 23-183            
  chronik.js            |    4.47 |        0 |       0 |    4.76 | 12-196            
  db.js                 |    6.09 |        0 |       0 |    6.09 | 17-308            
  utils.js              |       5 |        0 |       0 |    5.26 | 12-160            
------------------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='29']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='373']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='140']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='40']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='29']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='363']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/alias-server-junit.xml': No such file or directory
Build alias-server-tests failed with exit code 1

Tail of the build log:

- /work/apps/examples/test/sendXec.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/examples/test/sendXec.test.js:20:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/examples/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/examples/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/examples/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/examples/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/examples/node_modules/mocha/lib/cli/run.js:370:5)
-----------------------------|---------|----------|---------|---------|-------------------
File                         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-----------------------------|---------|----------|---------|---------|-------------------
All files                    |   49.26 |    11.11 |   44.44 |    49.5 |                   
 mocks                       |    3.22 |        0 |       0 |    3.22 |                   
  chronikMock.js             |    1.63 |        0 |       0 |    1.63 | 11-160            
  chronikResponses.js        |     100 |      100 |     100 |     100 |                   
 scripts                     |    69.5 |       25 |   88.88 |      70 |                   
  createWallet.js            |     100 |      100 |     100 |     100 |                   
  getDetailsFromTxid.js      |      80 |      100 |     100 |      80 | 20,35             
  getTokenDetails.js         |      80 |      100 |     100 |      80 | 20,34             
  getTxHistoryFromAddress.js |   73.33 |      100 |     100 |   73.33 | 29-36,58          
  getUtxosFromAddress.js     |      75 |      100 |     100 |      75 | 30-32,47          
  listenForConfirmation.js   |      50 |        0 |      50 |      50 | 18-45             
  sendXec.js                 |      60 |     37.5 |     100 |   61.11 | 69-146,205,233    
-----------------------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='100']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='203']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='27']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='16']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='36']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='100']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='202']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/examples-junit.xml': No such file or directory
Build app-dev-examples failed with exit code 1

Tail of the build log:

  npm audit fix --force

Run `npm audit` for details.

> ecash-herald@1.0.0 test
> mocha --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/ecash-herald-junit.xml --reporter-options testsuitesTitle=Ecash Herald Unit Tests --reporter-options rootSuiteTitle=Ecash Herald


Error: Cannot find module 'ecashaddrjs'
Require stack:
- /work/apps/mock-chronik-client/index.js
- /work/apps/ecash-herald/test/chronik.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/mock-chronik-client/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/work/apps/ecash-herald/test/chronik.test.js:6:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async formattedImport (/work/apps/ecash-herald/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/ecash-herald/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/ecash-herald/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/ecash-herald/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/ecash-herald/node_modules/mocha/lib/cli/run.js:370:5)
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='0']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/ecash-herald-junit.xml': No such file or directory
Build ecash-herald-tests failed with exit code 1

fix backwards if else condition in js-mocha

bytesofman published this revision for review.Mar 5 2024, 20:17
bytesofman added inline comments.
contrib/teamcity/build-configurations.yml
75 ↗(On Diff #45941)

I got this backward in my post-review mods to D15615

imo best to keep it here as this is the diff that breaks without the CI implemented properly

emack added a subscriber: emack.

accepted with note

apps/mock-chronik-client/test/index.test.js
187 ↗(On Diff #45941)

small nit, throughout the mono repo there are both ecashaddr and cashaddr initializations. I'd suggest let's stick with ecashaddr going forward to make it easier in the future if we need to deprecate all uses of this library.

This revision is now accepted and ready to land.Mar 5 2024, 21:53