fix: probe types in test file #1502

Closed
opened 2026-04-05 16:27:50 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @fedealconada on 11/13/2023

Fix Probe

I initially created the PR the fix the below bug but then I realised that there was something going on with this.

I discovered that ports are not supported by node-ping (see here) so I removed the ports test cases and also took advantage to refactor a bit the code PingMonitor.ts code as well as the tests.

NOTE: one could add support to ports probably by using other library or using sockets (and the net) but didn't add it here because it was a bit out of the scope.

Initial bug:

> probe@1.0.0 test
> jest --passWithNoTests

ts-jest[versions] (WARN) Version 5.0.4 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
FAIL Tests/Utils/PingMonitor.test.ts
  ● Test suite failed to run

    Tests/Utils/PingMonitor.test.ts:7:8 - error TS6137: Cannot import type declaration files. Consider importing 'jest' instead of '@types/jest'.

    7 import '@types/jest';

Pull Request Checklist:

  • Please make sure all jobs pass before requesting a review.
  • Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).
  • Have you lint your code locally before submission?
  • Did you write tests where appropriate?

Screenshots (if appropriate):

*Originally created by @fedealconada on 11/13/2023* ### Fix Probe I initially created the PR the fix the below bug but then I realised that there was something going on with this. I discovered that ports are not supported by `node-ping` (see [here](https://github.com/danielzzz/node-ping/issues/66)) so I removed the ports test cases and also took advantage to refactor a bit the code `PingMonitor.ts` code as well as the tests. NOTE: one could add support to ports probably by using other library or using `sockets` (and the `net`) but didn't add it here because it was a bit out of the scope. Initial bug: ``` > probe@1.0.0 test > jest --passWithNoTests ts-jest[versions] (WARN) Version 5.0.4 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions. FAIL Tests/Utils/PingMonitor.test.ts ● Test suite failed to run Tests/Utils/PingMonitor.test.ts:7:8 - error TS6137: Cannot import type declaration files. Consider importing 'jest' instead of '@types/jest'. 7 import '@types/jest'; ``` ### Pull Request Checklist: - [ ] Please make sure all jobs pass before requesting a review. - [ ] Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if such). - [ ] Have you lint your code locally before submission? - [ ] Did you write tests where appropriate? ### Related Issue? ### Screenshots (if appropriate):
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/oneuptime#1502