Skip to content

Commit ddc9c52

Browse files
committed
revert octokit changes
1 parent 6d37c6e commit ddc9c52

File tree

5 files changed

+326
-408
lines changed

5 files changed

+326
-408
lines changed

packages/github/__tests__/github.proxy.test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import * as http from 'http'
22
import * 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.
66
const proxyUrl = 'http://127.0.0.1:8081'
77
const originalProxyUrl = process.env['https_proxy']
88
process.env['https_proxy'] = proxyUrl
99
// eslint-disable-next-line import/first
10-
import { getOctokit } from '../src/github'
10+
import {getOctokit} from '../src/github'
1111

1212
describe('@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

packages/github/__tests__/github.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as http from 'http'
2-
import { createProxy } from 'proxy'
2+
import proxy from 'proxy'
33
import {getOctokit} from '../src/github'
44
import {GitHub, getOctokitOptions} from '../src/utils'
55

@@ -12,7 +12,7 @@ describe('@actions/github', () => {
1212

1313
beforeAll(async () => {
1414
// Start proxy server
15-
proxyServer = createProxy()
15+
proxyServer = proxy()
1616
await new Promise(resolve => {
1717
const port = Number(proxyUrl.split(':')[2])
1818
proxyServer.listen(port, () => resolve(null))

packages/github/__tests__/proxy1.d.ts renamed to packages/github/__tests__/proxy.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
declare module 'proxy1' {
1+
declare module 'proxy' {
22
import * as http from 'http'
33
function internal(): http.Server
44
export = internal

0 commit comments

Comments
 (0)