qase-tms / qase-javascript

Qase TMS JavaScript SDK
https://developers.qase.io
49 stars 43 forks source link

Deasync module causing 'Could not load reporter by name' error by not finding the bindings file #74

Closed ecoPortalMarkR closed 2 years ago

ecoPortalMarkR commented 2 years ago

Cypress is running from the 'spec' folder in a Ruby on Rails project. Running QASE_REPORTER=1 npx cypress run --browser chrome --headless causes the following error and stack trace.

Could not load reporter by name: cypress-qase-reporter

We searched for the reporter in these paths:

- /Users/markrodgers/Desktop/ecoPortal/spec/cypress-qase-reporter
- /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/cypress-qase-reporter

The error we received was:

Error: Could not locate the bindings file. Tried:
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/build/deasync.node
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/build/Debug/deasync.node
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/build/Release/deasync.node
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/out/Debug/deasync.node
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/Debug/deasync.node
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/out/Release/deasync.node
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/Release/deasync.node
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/build/default/deasync.node
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/compiled/14.17.0/darwin/x64/deasync.node
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/addon-build/release/install-root/deasync.node
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/addon-build/debug/install-root/deasync.node
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/addon-build/default/install-root/deasync.node
 → /Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/lib/binding/node-v97-darwin-x64/deasync.node
    at bindings (/Users/markrodgers/Desktop/ecoPortal/spec/node_modules/bindings/bindings.js:126:9)
    at Object.<anonymous> (/Users/markrodgers/Desktop/ecoPortal/spec/node_modules/deasync/index.js:30:31)
    at Module._compile (internal/modules/cjs/loader.js:1083:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1113:10)
    at Module.load (internal/modules/cjs/loader.js:940:32)
    at Module._load (internal/modules/cjs/loader.js:781:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Function.Module._load (/Users/markrodgers/Library/Caches/Cypress/8.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/override_require.js:15:27)
    at Module.require (internal/modules/cjs/loader.js:964:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/markrodgers/Desktop/ecoPortal/spec/node_modules/cypress-qase-reporter/dist/index.js:34:17)
    at Module._compile (internal/modules/cjs/loader.js:1083:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1113:10)
    at Module.load (internal/modules/cjs/loader.js:940:32)
    at Module._load (internal/modules/cjs/loader.js:781:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Function.Module._load (/Users/markrodgers/Library/Caches/Cypress/8.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/override_require.js:15:27)
    at Module.require (internal/modules/cjs/loader.js:964:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Function.loadReporter (/Users/markrodgers/Library/Caches/Cypress/8.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/reporter.js:524:14)
    at ProjectBase.initializeReporter (/Users/markrodgers/Library/Caches/Cypress/8.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/project-base.js:399:32)
    at ProjectBase.startWebsockets (/Users/markrodgers/Library/Caches/Cypress/8.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/project-base.js:417:39)
    at ProjectBase.<anonymous> (/Users/markrodgers/Library/Caches/Cypress/8.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/project-base.js:166:18)
    at Generator.next (<anonymous>:null:null)
    at fulfilled (/Users/markrodgers/Library/Caches/Cypress/8.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/tslib/tslib.js:114:62)

The problem seems to be with the deasync node module. It builds in the build folder but then renames it bin; cypress-qase-reporter looks for a binding file in the build folder which has been renamed to bin which contains many deasync.node files.

sasha-t commented 2 years ago

@ecoPortalMarkR I had had the same problem and I have tried everything.

My solution to this problem strange, but its works:

  1. create local reporter file reporter.js with compiled qase-cypress-reporter/src/index.ts
  2. remove deasync dependency and use Atomics.wait instead of deasync.sleep
  3. change qase-cypress-reporter on %project_dir%/reporter.js in cypress.json/reporter
ecoPortalMarkR commented 2 years ago

Thanks, @sasha-t, that worked like a charm.