@@ -30,26 +30,44 @@ describe('lib/tasks/unzip', function () {
3030
3131 afterEach ( function ( ) {
3232 stdout . restore ( )
33+ } )
34+
35+ it ( 'throws when cannot unzip' , async function ( ) {
36+ try {
37+ await unzip . start ( {
38+ zipFilePath : path . join ( 'test' , 'fixture' , 'bad_example.zip' ) ,
39+ installDir,
40+ } )
41+ } catch ( err ) {
42+ logger . error ( err )
3343
34- // return fs.removeAsync(installationDir)
44+ return snapshot ( normalize ( this . stdout . toString ( ) ) )
45+ }
46+
47+ throw new Error ( 'should have failed' )
3548 } )
3649
37- it ( 'throws when cannot unzip' , function ( ) {
38- const ctx = this
50+ it ( 'throws max path length error when cannot unzip due to realpath ENOENT on windows' , async function ( ) {
51+ const err = new Error ( 'failed' )
3952
40- return unzip
41- . start ( {
42- zipFilePath : path . join ( 'test' , 'fixture' , 'bad_example.zip' ) ,
43- installDir,
44- } )
45- . then ( ( ) => {
46- throw new Error ( 'should have failed' )
47- } )
48- . catch ( ( err ) => {
53+ err . code = 'ENOENT'
54+ err . syscall = 'realpath'
55+
56+ os . platform . returns ( 'win32' )
57+ sinon . stub ( fs , 'ensureDirAsync' ) . rejects ( err )
58+
59+ try {
60+ await unzip . start ( {
61+ zipFilePath : path . join ( 'test' , 'fixture' , 'bad_example.zip' ) ,
62+ installDir,
63+ } )
64+ } catch ( err ) {
4965 logger . error ( err )
5066
51- snapshot ( 'unzip error 1' , normalize ( ctx . stdout . toString ( ) ) )
52- } )
67+ return snapshot ( normalize ( this . stdout . toString ( ) ) )
68+ }
69+
70+ throw new Error ( 'should have failed' )
5371 } )
5472
5573 it ( 'can really unzip' , function ( ) {
0 commit comments