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

Fix npm audit errors and convert to using Jest. #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

michelnev
Copy link
Contributor

@michelnev michelnev commented Sep 7, 2020

This change updates the packages used for testing to remove most audit concerns and, as a result, switches to Jest for testing.

NOTE: I'd suggesting using mocks instead of what is currently being done, but I left it as-is to get the audit issues addressed. This will also allow the test coverage to be more complete.

…536. Received whois.nic.do.' uncaught exception caused by regular express issue and uncaught exception when creating a socket.
@moneals
Copy link
Owner

moneals commented Sep 10, 2020

Thanks for the PR. I run into issues when running npm test on your branch:

npx jest

Unexpected token {
npm ERR! Test failed. See above for more details.

@michelnev
Copy link
Contributor Author

michelnev commented Sep 11, 2020 via email

@michelnev
Copy link
Contributor Author

michelnev commented Sep 15, 2020

@moneals if you delete the node_modules directory and install, do you have any issues? Here's what I did in the forked repo:

dalal@nevelex-desk-100:~/src/whois-raw$ git branch
* jest-patch
  master
dalal@nevelex-desk-100:~/src/whois-raw$ rm -rf node_modules/
dalal@nevelex-desk-100:~/src/whois-raw$ npm i
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 702 packages from 348 contributors in 5.63s

19 packages are looking for funding
  run `npm fund` for details

dalal@nevelex-desk-100:~/src/whois-raw$ git diff
dalal@nevelex-desk-100:~/src/whois-raw$ npm test

> whois-raw@0.1.6 test /home/dalal/src/whois-raw
> npx jest

 PASS  test/test.js (15.61 s)
  #lookup()
    ✓ should work with google.com (507 ms)
    ✓ should work with 50.116.8.109 (316 ms)
    ✓ should work with 2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d (428 ms)
    ✓ should honor specified WHOIS server (865 ms)
    ✓ should honor specified WHOIS server with port override (445 ms)
    ✓ should follow specified number of redirects for domain (424 ms)
    ✓ should follow specified number of redirects for IP address (664 ms)
    ✓ should work with nic.sh (874 ms)
    ✓ should work with nic.io (757 ms)
    ✓ should work with nic.ac (878 ms)
    ✓ should work with nic.tm (829 ms)
    ✓ should work with nic.global (650 ms)
    ✓ should work with srs.net.nz (811 ms)
    ✓ should work with redundant follow (475 ms)
    ✓ should work with küche.de (517 ms)
    ✓ should work with google.co.jp in english (608 ms)
    ✓ should work with registry.pro (728 ms)
    ✓ should fail with google.com due to timeout (2 ms)
    ✓ should succeed with google.com with timeout (493 ms)
    ✓ should work with åre.no (561 ms)
    ✓ should work with nic.digital (338 ms)
    ✓ should work with whois.nic.ai (384 ms)
    ✓ should work with currentzoology.org (553 ms)
    ✓ should work with clz.do (430 ms)
    ✓ should work with orpheusmusic.com.ng (688 ms)
    ✓ should work with cityradio.co.bw (1114 ms)

Test Suites: 1 passed, 1 total
Tests:       26 passed, 26 total
Snapshots:   0 total
Time:        15.648 s, estimated 34 s
Ran all test suites.

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

Successfully merging this pull request may close these issues.

None yet

2 participants