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

address.mac returning undefined and tests failing #38

Open
WeepingClown13 opened this issue Oct 5, 2023 · 3 comments
Open

address.mac returning undefined and tests failing #38

WeepingClown13 opened this issue Oct 5, 2023 · 3 comments

Comments

@WeepingClown13
Copy link

address.mac() method does not seem to work now and are returning undefined. I used the code samples from the repo readme itself to test them. And while running the tests, the tests that fetch mac address are failing because of this as well. Here is the log:

$ npm run test

> address@2.0.1 pretest
> npm run lint -- --fix && npm run prepublishOnly


> address@2.0.1 lint
> eslint src test --ext .ts --fix


> address@2.0.1 prepublishOnly
> tshy && tshy-after


> address@2.0.1 test
> egg-bin test



  test/address.test.ts
    regex check
       should MAC_IP_RE pass
       should MAC_RE pass
    address()
       should return first ethernet addresses
       should return first ethernet addresses from osx
       should return first ethernet addresses from linux
       should return first vnic interface addresses from osx
       should return first local loopback addresses
       should return first local loopback addresses from linux
    interface()
       should return interface with family
    address.mac()
      1) should return mac
       should return mock mac address
       should return null when ip not exists
       should return err when ifconfig cmd exec error
       should return mac mock win32
    address.ip()
       should return 127.0.0.1
       should return the first not 127.0.0.1 interface
       should return utun1
    address.dns()
       should return dns servers from osx
       should return dns servers from linux
       should return err when fs error

  test/promises.test.ts
    2) should address work
    3) should mac work
     should dns work

  test/ts.test.ts
     should works with ts without error (837ms)


  21 passing (889ms)
  3 failing

  1) test/address.test.ts
       address.mac()
         should return mac:
     AssertionError [ERR_ASSERTION]: undefined == true
      at file:///home/weepingclown/testjs/address/test/address.test.ts:130:9
      at Module.mac (file:///home/weepingclown/testjs/address/src/address.ts:188:12)
      at Context.<anonymous> (file:///home/weepingclown/testjs/address/test/address.test.ts:128:18)
      at processImmediate (node:internal/timers:476:21)

  2) test/promises.test.ts
       should address work:
     AssertionError [ERR_ASSERTION]: undefined == true
      at Context.<anonymous> (file:///home/weepingclown/testjs/address/test/promises.test.ts:9:5)

  3) test/promises.test.ts
       should mac work:
     AssertionError [ERR_ASSERTION]: null == true
      at Context.<anonymous> (file:///home/weepingclown/testjs/address/test/promises.test.ts:14:5)



[mochawesome] Report JSON saved to /home/weepingclown/testjs/address/node_modules/.mochawesome-reports/mochawesome.json

[mochawesome] Report HTML saved to /home/weepingclown/testjs/address/node_modules/.mochawesome-reports/mochawesome.html

ForkError: /home/weepingclown/testjs/address/node_modules/mocha/bin/_mocha --exit --timeout=60000 --reporter=/home/weepingclown/testjs/address/node_modules/mochawesome-with-mocha/src/mochawesome.js --reporter-options=reportDir=node_modules/.mochawesome-reports test/address.test.ts test/promises.test.ts test/ts.test.ts exit with code 1
    at ChildProcess.<anonymous> (/home/weepingclown/testjs/address/node_modules/egg-bin/src/cmd/base.ts:117:23)
    at Object.onceWrapper (node:events:632:26)
    at ChildProcess.emit (node:events:517:28)
    at ChildProcess.emit (node:domain:489:12)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:292:12) {
  code: 1
}
@fengmk2
Copy link
Member

fengmk2 commented Oct 5, 2023

Can you show me the Node.js version?

@WeepingClown13
Copy link
Author

WeepingClown13 commented Oct 5, 2023

Can you show me the Node.js version?

$ node -v
v18.18.0
$ npm -v
9.8.1

EDIT: Also confirmed with node v20.8.0 and npm v10.1.0

@WeepingClown13 WeepingClown13 changed the title adress.mac() retruning undefined and tests failing address.mac returning undefined and tests failing Oct 6, 2023
@hungFight
Copy link

I can't get mac address too
node -v
v20.10.0

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

3 participants