Skip to content

Commit

Permalink
fix: remove semver usage (#2531)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Oct 19, 2023
1 parent dd417f0 commit f7216e9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/test_common.js
Expand Up @@ -14,7 +14,6 @@
const http = require('http')
const { expect } = require('chai')
const sinon = require('sinon')
const semver = require('semver')
const nock = require('..')

const common = require('../lib/common')
Expand Down Expand Up @@ -477,8 +476,12 @@ it('`percentEncode()` encodes extra reserved characters', () => {
describe('`normalizeClientRequestArgs()`', () => {
it('should throw for invalid URL', () => {
// See https://github.com/nodejs/node/pull/38614 release in node v16.2.0
const isNewErrorText = semver.gte(process.versions.node, '16.2.0')
const errorText = isNewErrorText ? 'Invalid URL' : 'example.test'
const [major, minor, patch] = process.versions.node.split('.').map(parseInt)
const useNewErrorText =
major > 16 ||
(major === 16 && minor > 2) ||
(major === 16 && minor === 2 && patch > 0)
const errorText = useNewErrorText ? 'Invalid URL' : 'example.test'

// no schema
expect(() => http.get('example.test')).to.throw(TypeError, errorText)
Expand Down

0 comments on commit f7216e9

Please sign in to comment.