@@ -15,6 +15,7 @@ const rimraf = require('rimraf')
1515const tar = require ( 'tar' )
1616const spawnNpm = require ( '../lib/util/npm.js' )
1717const GitFetcher = require ( '../lib/git.js' )
18+ const RemoteFetcher = require ( '../lib/remote.js' )
1819
1920// set this up first, so we can use 127.0.0.1 as our "hosted git" service
2021const httpPort = 18000 + ( + process . env . TAP_CHILD_ID || 0 )
@@ -631,6 +632,22 @@ t.test('fetch a private repo where the tgz is a 404', { skip: isWindows && 'posi
631632 return gf . extract ( me + '/no-tgz' )
632633} )
633634
635+ t . test ( 'fetch a private repo where the tgz is a 404 and http error has minified class name' ,
636+ { skip : isWindows && 'posix only' } , async t => {
637+ const gf = new GitFetcher ( `localhost:repo/x#${ REPO_HEAD } ` , opts )
638+ const origExtract = RemoteFetcher . prototype . extract
639+ RemoteFetcher . prototype . extract = ( ) => {
640+ const err = new Error ( '404 Not Found' )
641+ err . statusCode = 404
642+ err . code = 'E404'
643+ return Promise . reject ( err )
644+ }
645+ t . teardown ( ( ) => {
646+ RemoteFetcher . prototype . extract = origExtract
647+ } )
648+ await gf . extract ( me + '/no-tgz' )
649+ } )
650+
634651t . test ( 'fetch a private repo where the tgz is not a tarball' , { skip : isWindows && 'posix only' } ,
635652 t => {
636653 const gf = new GitFetcher ( `localhost:repo/x#${ REPO_HEAD } ` , opts )
0 commit comments