diff --git a/packages/github/__tests__/github.proxy.test.ts b/packages/github/__tests__/github.proxy.test.ts index 16b3b905..fd6154bb 100644 --- a/packages/github/__tests__/github.proxy.test.ts +++ b/packages/github/__tests__/github.proxy.test.ts @@ -1,6 +1,6 @@ import * as http from 'http' import * as https from 'https' -import proxy from 'proxy' +import * as proxy from 'proxy' // Default values are set when the module is imported, so we need to set proxy first. const proxyUrl = 'http://127.0.0.1:8081' @@ -16,12 +16,13 @@ describe('@actions/github', () => { beforeAll(async () => { // Start proxy server - proxyServer = proxy() - await new Promise(resolve => { + proxyServer = proxy.createProxy() + await new Promise(resolve => { const port = Number(proxyUrl.split(':')[2]) - proxyServer.listen(port, () => resolve(null)) + proxyServer.listen(port, () => resolve()) }) proxyServer.on('connect', req => { + console.log('connect', req.url) proxyConnects.push(req.url ?? '') }) }) @@ -32,8 +33,8 @@ describe('@actions/github', () => { afterAll(async () => { // Stop proxy server - await new Promise(resolve => { - proxyServer.once('close', () => resolve(null)) + await new Promise(resolve => { + proxyServer.once('close', () => resolve()) proxyServer.close() }) diff --git a/packages/github/__tests__/github.test.ts b/packages/github/__tests__/github.test.ts index 6a5b6bed..c33937b8 100644 --- a/packages/github/__tests__/github.test.ts +++ b/packages/github/__tests__/github.test.ts @@ -1,5 +1,5 @@ import * as http from 'http' -import proxy from 'proxy' +import * as proxy from 'proxy' import {getOctokit} from '../src/github' import {GitHub, getOctokitOptions} from '../src/utils' @@ -12,7 +12,7 @@ describe('@actions/github', () => { beforeAll(async () => { // Start proxy server - proxyServer = proxy() + proxyServer = proxy.createProxy() await new Promise(resolve => { const port = Number(proxyUrl.split(':')[2]) proxyServer.listen(port, () => resolve(null))