happo / happo-e2e

Helpers for Happo's e2e integrations (Playwright, Cypress)
1 stars 0 forks source link

Can't run `npx happo-e2e` standalone #4

Open trotzig opened 2 years ago

trotzig commented 2 years ago

When running npx happo-e2e -- <cmd> as a standalone command without first installing happo-e2e and happo.io npm libraries locally, the command fails with the following error:

Error: Cannot find module 'happo.io/build/makeRequest'
Require stack:
- ./happo-e2e/bin/happo-e2e.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (node_modules/happo-e2e/bin/happo-e2e.js:6:21)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)

This is because happo.io isn't listed as a direct dependency of happo-e2e.

When running npx happo-e2e -- <cmd> with both happo.io and happo-e2e installed locally (in node_modules) the command will work.

trotzig commented 2 years ago

A possible workaround is to invoke npx happo-e2e --package happo.io -- <cmd>. This should install the necessary dependency before the command is invoked.