Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this still maintained? #46

Open
steevhise opened this issue May 13, 2022 · 3 comments
Open

Is this still maintained? #46

steevhise opened this issue May 13, 2022 · 3 comments

Comments

@steevhise
Copy link

Just wondering if anybody is still maintaining this.

There's a security issue because mocha-chrome depends on an old version of minimist.

├─┬ [email protected]
│ └─┬ [email protected]
│   └─┬ [email protected]
│     └── [email protected]
@shellscape
Copy link
Owner

Afaik this package is pretty obsolete. If you're using it and need a dep update, please submit a PR and I'll publish a new version.

@alehuo
Copy link

alehuo commented Mar 21, 2023

I have made a PR to make this library compatible with Mocha v10. See #48

This package hosts hundreds of tests in an open source project, and it's mission critical for us to keep this library up to date. We are on the process of migrating our Mocha tests to Playwright.

@p2edwards
Copy link

If you encounter this ECONNREFUSED ::1 error running mocha-chrome 2.2.0 in GitHub CI on Node >=17:

Promise Rejection:  Error: connect ECONNREFUSED ::1:39193
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1606:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 39193
}

This might help:

diff --git a/node_modules/mocha-chrome/lib/client.js b/node_modules/mocha-chrome/lib/client.js
index 7629126..cd3d163 100644
--- a/node_modules/mocha-chrome/lib/client.js
+++ b/node_modules/mocha-chrome/lib/client.js
@@ -9,7 +9,7 @@ module.exports = async function connectClient(instance, log, options) {
     return fs.readFileSync(filePath, 'utf-8');
   }
 
-  const client = await CDP({ port: instance.port });
+  const client = await CDP({ port: instance.port, host: '127.0.0.1' });
   const { DOM, DOMStorage, Console, Network, Page, Runtime } = client;
   const mochaOptions = `window.mochaOptions = ${JSON.stringify(options.mocha)}`;

Footnotes

  1. Thanks to @nsainaney for this comment:

    With Node 16, DNS.lookup would return a IPv4 address. With Node 17 it returns an IPv6 address, which will break most REST clients that hardcode URLs like http://localhost:4040/api if the upstream server only binds to the IPv4 address, e.g. server.listen('127.0.0.1').

  2. npm.im/patch-package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants