@@ -4,7 +4,10 @@ import { createHash, randomUUID } from 'node:crypto';
44import fs from 'node:fs' ;
55import http , { type IncomingMessage , type ServerResponse } from 'node:http' ;
66import path from 'node:path' ;
7- import { uploadArtifact } from '../upload-client.ts' ;
7+ import { uploadArtifact as uploadArtifactOnHost } from '../upload-client.ts' ;
8+
9+ const uploadArtifact = ( options : Omit < Parameters < typeof uploadArtifactOnHost > [ 0 ] , 'env' > ) =>
10+ uploadArtifactOnHost ( { ...options , env : process . env } ) ;
811import type { UploadProgressEvent } from '../upload-progress.ts' ;
912import { runCmdSync , withCommandExecutorOverride } from '@agent-device/host-kit/command' ;
1013import { closeLoopbackServer , listenOnLoopback , mkdtempForTestSync } from '@agent-device/test-kit' ;
@@ -61,7 +64,6 @@ test('uploadArtifact returns preflight uploadId without uploading bytes on cache
6164
6265 try {
6366 const uploadId = await uploadArtifact ( {
64- env : process . env ,
6567 localPath : artifactPath ,
6668 baseUrl : server . baseUrl ,
6769 token : TEST_TOKEN ,
@@ -105,7 +107,6 @@ test('uploadArtifact uploads with hash headers after preflight cache miss', asyn
105107
106108 try {
107109 const uploadId = await uploadArtifact ( {
108- env : process . env ,
109110 localPath : artifactPath ,
110111 baseUrl : server . baseUrl ,
111112 token : TEST_TOKEN ,
@@ -145,7 +146,6 @@ test('uploadArtifact falls back to upload when preflight is unsupported', async
145146
146147 try {
147148 const uploadId = await uploadArtifact ( {
148- env : process . env ,
149149 localPath : artifactPath ,
150150 baseUrl : server . baseUrl ,
151151 token : TEST_TOKEN ,
@@ -194,7 +194,6 @@ test('uploadArtifact falls back to upload when preflight fails', async () => {
194194
195195 try {
196196 const uploadId = await uploadArtifact ( {
197- env : process . env ,
198197 localPath : artifactPath ,
199198 baseUrl : server . baseUrl ,
200199 token : TEST_TOKEN ,
@@ -248,7 +247,6 @@ test('uploadArtifact follows up to five upload redirects', async () => {
248247
249248 try {
250249 const uploadId = await uploadArtifact ( {
251- env : process . env ,
252250 localPath : artifactPath ,
253251 baseUrl : server . baseUrl ,
254252 token : TEST_TOKEN ,
@@ -301,7 +299,6 @@ test('uploadArtifact fails cleanly on the sixth upload redirect', async () => {
301299 await assert . rejects (
302300 async ( ) =>
303301 await uploadArtifact ( {
304- env : process . env ,
305302 localPath : artifactPath ,
306303 baseUrl : server . baseUrl ,
307304 token : TEST_TOKEN ,
@@ -365,7 +362,6 @@ test('uploadArtifact falls back to legacy upload when direct upload exceeds redi
365362
366363 try {
367364 const uploadId = await uploadArtifact ( {
368- env : process . env ,
369365 localPath : artifactPath ,
370366 baseUrl : server . baseUrl ,
371367 token : TEST_TOKEN ,
@@ -448,7 +444,6 @@ test('uploadArtifact uses direct upload ticket and finalize flow', async () => {
448444
449445 try {
450446 const uploadId = await uploadArtifact ( {
451- env : process . env ,
452447 localPath : artifactPath ,
453448 baseUrl : server . baseUrl ,
454449 token : TEST_TOKEN ,
@@ -537,7 +532,6 @@ test.each([
537532
538533 try {
539534 const uploadId = await uploadArtifact ( {
540- env : process . env ,
541535 localPath : artifactPath ,
542536 baseUrl : server . baseUrl ,
543537 token : TEST_TOKEN ,
@@ -620,7 +614,6 @@ test('uploadArtifact resumes a direct upload from the server-reported offset', a
620614
621615 try {
622616 const uploadId = await uploadArtifact ( {
623- env : process . env ,
624617 localPath : artifactPath ,
625618 baseUrl : server . baseUrl ,
626619 token : TEST_TOKEN ,
@@ -722,7 +715,6 @@ test('uploadArtifact re-preflights and resumes after an interrupted direct uploa
722715
723716 try {
724717 const uploadId = await uploadArtifact ( {
725- env : process . env ,
726718 localPath : artifactPath ,
727719 baseUrl : server . baseUrl ,
728720 token : TEST_TOKEN ,
@@ -795,7 +787,6 @@ test('uploadArtifact preflights and legacy-uploads compressed app bundle directo
795787
796788 try {
797789 const uploadId = await uploadArtifact ( {
798- env : process . env ,
799790 localPath : appPath ,
800791 baseUrl : server . baseUrl ,
801792 token : TEST_TOKEN ,
@@ -842,7 +833,6 @@ test('uploadArtifact disables macOS AppleDouble entries when archiving app bundl
842833 } ,
843834 async ( ) =>
844835 await uploadArtifact ( {
845- env : process . env ,
846836 localPath : appPath ,
847837 baseUrl : server . baseUrl ,
848838 token : TEST_TOKEN ,
@@ -896,7 +886,6 @@ test('uploadArtifact uploads APK, AAB, and IPA files without wrapping them', asy
896886
897887 try {
898888 await uploadArtifact ( {
899- env : process . env ,
900889 localPath : artifactPath ,
901890 baseUrl : server . baseUrl ,
902891 token : TEST_TOKEN ,
@@ -932,7 +921,6 @@ test.each([
932921 for ( const leaseId of [ 'lease-1' , undefined ] ) {
933922 leases = new Map ( ) ;
934923 await uploadArtifact ( {
935- env : process . env ,
936924 localPath,
937925 baseUrl : server . baseUrl ,
938926 token : TEST_TOKEN ,
0 commit comments