Skip to content

Commit

Permalink
Fix/tests for node 20 (#2669)
Browse files Browse the repository at this point in the history
  • Loading branch information
niclim authored Jan 18, 2024
1 parent 12387f8 commit 987d26f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest-16-core
strategy:
matrix:
node_version: [16, 18] # todo: get 20 passing
node_version: [16, 18, 20]
env:
YARN_IGNORE_NODE: 1 # silence node 16 complaints
steps:
Expand Down
1 change: 0 additions & 1 deletion projects/optic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"@types/url-join": "^4.0.1",
"babel-jest": "^29.3.1",
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"bent": "^7.3.12",
"jest": "^29.3.1",
"prettier": "^3.0.0",
"ts-jest": "^29.0.3",
Expand Down
24 changes: 17 additions & 7 deletions projects/optic/src/commands/oas/captures/proxy.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { it, describe, expect, beforeAll, afterAll } from '@jest/globals';

import * as mockttp from 'mockttp';
import bent from 'bent';
import { collect } from '../lib/async-tools';
import fetch from 'node-fetch';
import https from 'https';
import UrlJoin from 'url-join';
import { httpsOverHttp } from 'tunnel';
import { ProxyInteractions, ProxyCertAuthority } from './proxy';
import portfinder from 'portfinder';

describe('ProxyInteractions', () => {
let target: mockttp.Mockttp;
Expand All @@ -27,11 +27,16 @@ describe('ProxyInteractions', () => {
const [interactions, proxyUrl] = await ProxyInteractions.create(
target.url,
abortController.signal,
{ mode: 'reverse-proxy' }
{
mode: 'reverse-proxy',
proxyPort: await portfinder.getPortPromise({
port: 8000,
stopPort: 8999,
}),
}
);

const get = bent(proxyUrl);
const response = (await get('/some-path', 'string')) as bent.BentResponse;
const response = await fetch(`${proxyUrl}/some-path`);

expect(await response.text()).toBe('Test response');

Expand All @@ -49,11 +54,16 @@ describe('ProxyInteractions', () => {
const [interactions, proxyUrl] = await ProxyInteractions.create(
target.url,
abortController.signal,
{ mode: 'reverse-proxy' }
{
mode: 'reverse-proxy',
proxyPort: await portfinder.getPortPromise({
port: 9000,
stopPort: 9999,
}),
}
);

const requestDelete = bent(proxyUrl, 'DELETE', 204);
await requestDelete('/some-path');
await fetch(`${proxyUrl}/some-path`, { method: 'DELETE' });

abortController.abort();

Expand Down
26 changes: 0 additions & 26 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3799,7 +3799,6 @@ __metadata:
axax: "npm:^0.2.2"
babel-jest: "npm:^29.3.1"
babel-plugin-transform-inline-environment-variables: "npm:^0.4.3"
bent: "npm:^7.3.12"
bottleneck: "npm:^2.19.5"
chalk: "npm:^4.1.2"
commander: "npm:^11.0.0"
Expand Down Expand Up @@ -4483,17 +4482,6 @@ __metadata:
languageName: node
linkType: hard

"bent@npm:^7.3.12":
version: 7.3.12
resolution: "bent@npm:7.3.12"
dependencies:
bytesish: "npm:^0.4.1"
caseless: "npm:~0.12.0"
is-stream: "npm:^2.0.0"
checksum: 20f77364bcb462a6eb0ea7322442a1125ca6181ea6b94ad498b8348c678a2adf56c231a653bcac016c5d017aee91ff55b2169b69d8263a4b3c710f4121cbe615
languageName: node
linkType: hard

"binary-extensions@npm:^2.0.0":
version: 2.2.0
resolution: "binary-extensions@npm:2.2.0"
Expand Down Expand Up @@ -4700,13 +4688,6 @@ __metadata:
languageName: node
linkType: hard

"bytesish@npm:^0.4.1":
version: 0.4.4
resolution: "bytesish@npm:0.4.4"
checksum: 469088f0020797dfbb61b6ce3972c91d95d79df8aacca55841ea93ac59ef3209bb04be8212b6265dfbafb7583a58dd73ca2f14e4feae36d3333a4f1509dd2eef
languageName: node
linkType: hard

"cacache@npm:^15.2.0":
version: 15.3.0
resolution: "cacache@npm:15.3.0"
Expand Down Expand Up @@ -4825,13 +4806,6 @@ __metadata:
languageName: node
linkType: hard

"caseless@npm:~0.12.0":
version: 0.12.0
resolution: "caseless@npm:0.12.0"
checksum: ccf64bcb6c0232cdc5b7bd91ddd06e23a4b541f138336d4725233ac538041fb2f29c2e86c3c4a7a61ef990b665348db23a047060b9414c3a6603e9fa61ad4626
languageName: node
linkType: hard

"chalk@npm:5.3.0":
version: 5.3.0
resolution: "chalk@npm:5.3.0"
Expand Down

0 comments on commit 987d26f

Please sign in to comment.