1
0
Fork 0

try to fix tests

pull/1526/head
Tatyana Kostromskaya 2023-09-15 15:04:21 +00:00
parent 6477ef1460
commit 6d37c6eb2b
5 changed files with 37 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import * as http from 'http' import * as http from 'http'
import * as https from 'https' import * as https from 'https'
import { proxy } from 'proxy' import { createProxy } from 'proxy'
// Default values are set when the module is imported, so we need to set proxy first. // Default values are set when the module is imported, so we need to set proxy first.
const proxyUrl = 'http://127.0.0.1:8081' const proxyUrl = 'http://127.0.0.1:8081'
@ -16,7 +16,7 @@ describe('@actions/github', () => {
beforeAll(async () => { beforeAll(async () => {
// Start proxy server // Start proxy server
proxyServer = proxy() proxyServer = createProxy()
await new Promise<void>(resolve => { await new Promise<void>(resolve => {
const port = Number(proxyUrl.split(':')[2]) const port = Number(proxyUrl.split(':')[2])
proxyServer.listen(port, () => resolve()) proxyServer.listen(port, () => resolve())

View File

@ -1,5 +1,5 @@
import * as http from 'http' import * as http from 'http'
import { proxy } from 'proxy' import { createProxy } from 'proxy'
import {getOctokit} from '../src/github' import {getOctokit} from '../src/github'
import {GitHub, getOctokitOptions} from '../src/utils' import {GitHub, getOctokitOptions} from '../src/utils'
@ -12,7 +12,7 @@ describe('@actions/github', () => {
beforeAll(async () => { beforeAll(async () => {
// Start proxy server // Start proxy server
proxyServer = proxy() proxyServer = createProxy()
await new Promise(resolve => { await new Promise(resolve => {
const port = Number(proxyUrl.split(':')[2]) const port = Number(proxyUrl.split(':')[2])
proxyServer.listen(port, () => resolve(null)) proxyServer.listen(port, () => resolve(null))

View File

@ -1,4 +1,4 @@
declare module 'proxy' { declare module 'proxy1' {
import * as http from 'http' import * as http from 'http'
function internal(): http.Server function internal(): http.Server
export = internal export = internal

View File

@ -15,6 +15,7 @@
"@octokit/plugin-rest-endpoint-methods": "^7.2.3" "@octokit/plugin-rest-endpoint-methods": "^7.2.3"
}, },
"devDependencies": { "devDependencies": {
"@types/proxy": "^1.0.1",
"proxy": "^2.1.1" "proxy": "^2.1.1"
} }
}, },
@ -161,6 +162,21 @@
"@octokit/openapi-types": "^18.0.0" "@octokit/openapi-types": "^18.0.0"
} }
}, },
"node_modules/@types/node": {
"version": "20.6.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.1.tgz",
"integrity": "sha512-4LcJvuXQlv4lTHnxwyHQZ3uR9Zw2j7m1C9DfuwoTFQQP4Pmu04O6IfLYgMmHoOCt0nosItLLZAH+sOrRE0Bo8g==",
"dev": true
},
"node_modules/@types/proxy": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/proxy/-/proxy-1.0.1.tgz",
"integrity": "sha512-vjRgU9Ke0+6sfVeAXQphHRGb+OgBNpah1fma4aP7Pto2rnlrPDjsq+vyvy7emw+Fc9ppEciQtRh9Gaaxzu1Gzw==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/ansi-styles": { "node_modules/ansi-styles": {
"version": "3.2.1", "version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
@ -516,6 +532,21 @@
"@octokit/openapi-types": "^18.0.0" "@octokit/openapi-types": "^18.0.0"
} }
}, },
"@types/node": {
"version": "20.6.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.1.tgz",
"integrity": "sha512-4LcJvuXQlv4lTHnxwyHQZ3uR9Zw2j7m1C9DfuwoTFQQP4Pmu04O6IfLYgMmHoOCt0nosItLLZAH+sOrRE0Bo8g==",
"dev": true
},
"@types/proxy": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/proxy/-/proxy-1.0.1.tgz",
"integrity": "sha512-vjRgU9Ke0+6sfVeAXQphHRGb+OgBNpah1fma4aP7Pto2rnlrPDjsq+vyvy7emw+Fc9ppEciQtRh9Gaaxzu1Gzw==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"ansi-styles": { "ansi-styles": {
"version": "3.2.1", "version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",

View File

@ -44,6 +44,7 @@
"@octokit/plugin-rest-endpoint-methods": "^7.2.3" "@octokit/plugin-rest-endpoint-methods": "^7.2.3"
}, },
"devDependencies": { "devDependencies": {
"@types/proxy": "^1.0.1",
"proxy": "^2.1.1" "proxy": "^2.1.1"
} }
} }