11import * as http from 'http'
22import * as https from 'https'
3- import { createProxy } from 'proxy'
3+ import proxy from 'proxy'
44
55// Default values are set when the module is imported, so we need to set proxy first.
66const proxyUrl = 'http://127.0.0.1:8081'
77const originalProxyUrl = process . env [ 'https_proxy' ]
88process . env [ 'https_proxy' ] = proxyUrl
99// eslint-disable-next-line import/first
10- import { getOctokit } from '../src/github'
10+ import { getOctokit } from '../src/github'
1111
1212describe ( '@actions/github' , ( ) => {
1313 let proxyConnects : string [ ]
@@ -16,13 +16,12 @@ describe('@actions/github', () => {
1616
1717 beforeAll ( async ( ) => {
1818 // Start proxy server
19- proxyServer = createProxy ( )
20- await new Promise < void > ( resolve => {
19+ proxyServer = proxy ( )
20+ await new Promise ( resolve => {
2121 const port = Number ( proxyUrl . split ( ':' ) [ 2 ] )
2222 proxyServer . listen ( port , ( ) => resolve ( ) )
2323 } )
2424 proxyServer . on ( 'connect' , req => {
25- console . log ( 'connect' , req . url )
2625 proxyConnects . push ( req . url ?? '' )
2726 } )
2827 } )
@@ -33,7 +32,7 @@ describe('@actions/github', () => {
3332
3433 afterAll ( async ( ) => {
3534 // Stop proxy server
36- await new Promise < void > ( resolve => {
35+ await new Promise ( resolve => {
3736 proxyServer . once ( 'close' , ( ) => resolve ( ) )
3837 proxyServer . close ( )
3938 } )
@@ -70,7 +69,7 @@ describe('@actions/github', () => {
7069 const repository = await octokit . graphql (
7170 '{repository(owner:"actions", name:"toolkit"){name}}'
7271 )
73- expect ( repository ) . toEqual ( { repository : { name : 'toolkit' } } )
72+ expect ( repository ) . toEqual ( { repository : { name : 'toolkit' } } )
7473 expect ( proxyConnects ) . toEqual ( [ 'api.github.com:443' ] )
7574 } )
7675
0 commit comments