@@ -2,7 +2,9 @@ import { existsSync } from 'fs'
2
2
import { readFile , rm } from 'fs/promises'
3
3
import { Agent } from 'https'
4
4
import { join } from 'path'
5
+ import process from 'process'
5
6
7
+ import { Headers } from 'node-fetch'
6
8
import { temporaryDirectory } from 'tempy'
7
9
import { beforeEach , describe , expect , test , vi } from 'vitest'
8
10
@@ -18,6 +20,12 @@ describe('integration', () => {
18
20
vi . resetAllMocks ( )
19
21
} )
20
22
23
+ const headers = new Headers ( )
24
+
25
+ if ( process . env . GITHUB_TOKEN ) {
26
+ headers . append ( 'Authorization' , `Bearer ${ process . env . GITHUB_TOKEN } ` )
27
+ }
28
+
21
29
// Do as little tests as necessary here for now, as we run into GH rate limiting
22
30
23
31
test ( 'should download simple file with custom agent' , async ( ) => {
@@ -29,7 +37,7 @@ describe('integration', () => {
29
37
destination : tmpDir ,
30
38
extract : false ,
31
39
} ,
32
- { agent : new Agent ( { keepAlive : false } ) } ,
40
+ { agent : new Agent ( { keepAlive : false } ) , headers } ,
33
41
)
34
42
35
43
const file = join ( tmpDir , 'checksums.txt' )
@@ -44,12 +52,15 @@ describe('integration', () => {
44
52
45
53
test ( 'should download an archive and extract it' , async ( ) => {
46
54
const tmpDir = temporaryDirectory ( )
47
- await fetchLatest ( {
48
- ...baseRelease ,
49
- package : 'live-tunnel-client-linux-386.tar.gz' ,
50
- destination : tmpDir ,
51
- extract : true ,
52
- } )
55
+ await fetchLatest (
56
+ {
57
+ ...baseRelease ,
58
+ package : 'live-tunnel-client-linux-386.tar.gz' ,
59
+ destination : tmpDir ,
60
+ extract : true ,
61
+ } ,
62
+ { headers } ,
63
+ )
53
64
54
65
const file = join ( tmpDir , 'live-tunnel-client' )
55
66
0 commit comments