@@ -9,7 +9,7 @@ const rimraf = require('rimraf');
99const asar = require ( '..' ) ;
1010const compDirs = require ( './util/compareDirectories' ) ;
1111const compFileLists = require ( './util/compareFileLists' ) ;
12- const compFiles = require ( './util/compareFiles' ) ;
12+ const { compFiles, isSymbolicLinkSync } = require ( './util/compareFiles' ) ;
1313const transform = require ( './util/transformStream' ) ;
1414
1515async function assertPackageListEquals ( actualList , expectedFilename ) {
@@ -107,38 +107,47 @@ describe('api', function () {
107107 asar . extractAll ( 'test/input/extractthis-unpack-dir.asar' , 'tmp/extractthis-unpack-dir-api/' ) ;
108108 return compDirs ( 'tmp/extractthis-unpack-dir-api/' , 'test/expected/extractthis' ) ;
109109 } ) ;
110- it ( 'should extract an archive with symlink' , async ( ) => {
111- await asar . createPackageWithOptions (
112- 'test/input/packthis-with-symlink/' ,
113- 'tmp/packthis-with-symlink.asar' ,
114- { dot : false } ,
115- ) ;
116- asar . extractAll ( 'tmp/packthis-with-symlink.asar' , 'tmp/packthis-with-symlink/' ) ;
117- return compFiles (
118- 'tmp/packthis-with-symlink/real.txt' ,
119- 'test/input/packthis-with-symlink/real.txt' ,
120- ) ;
121- } ) ;
122- it ( 'should extract an archive with symlink having the same prefix' , async ( ) => {
123- await asar . createPackageWithOptions (
124- 'test/input/packthis-with-symlink-same-prefix/' ,
125- 'tmp/packthis-with-symlink-same-prefix.asar' ,
126- { dot : false } ,
127- ) ;
128- asar . extractAll (
129- 'tmp/packthis-with-symlink-same-prefix.asar' ,
130- 'tmp/packthis-with-symlink-same-prefix/' ,
131- ) ;
132- return compFiles (
133- 'tmp/packthis-with-symlink-same-prefix/real.txt' ,
134- 'test/input/packthis-with-symlink-same-prefix/real.txt' ,
135- ) ;
136- } ) ;
137- it ( 'should not extract an archive with a bad symlink' , async ( ) => {
138- assert . throws ( ( ) => {
139- asar . extractAll ( 'test/input/bad-symlink.asar' , 'tmp/bad-symlink/' ) ;
110+
111+ // We don't extract symlinks on Windows, so skip these tests
112+ if ( os . platform ( ) !== 'win32' ) {
113+ it ( 'should extract an archive with symlink' , async ( ) => {
114+ assert . strictEqual ( isSymbolicLinkSync ( 'test/input/packthis-with-symlink/real.txt' ) , true ) ;
115+ await asar . createPackageWithOptions (
116+ 'test/input/packthis-with-symlink/' ,
117+ 'tmp/packthis-with-symlink.asar' ,
118+ { dot : false } ,
119+ ) ;
120+ asar . extractAll ( 'tmp/packthis-with-symlink.asar' , 'tmp/packthis-with-symlink/' ) ;
121+ return compFiles (
122+ 'tmp/packthis-with-symlink/real.txt' ,
123+ 'test/input/packthis-with-symlink/real.txt' ,
124+ ) ;
140125 } ) ;
141- } ) ;
126+ it ( 'should extract an archive with symlink having the same prefix' , async ( ) => {
127+ assert . strictEqual (
128+ isSymbolicLinkSync ( 'test/input/packthis-with-symlink-same-prefix/real.txt' ) ,
129+ true ,
130+ ) ;
131+ await asar . createPackageWithOptions (
132+ 'test/input/packthis-with-symlink-same-prefix/' ,
133+ 'tmp/packthis-with-symlink-same-prefix.asar' ,
134+ { dot : false } ,
135+ ) ;
136+ asar . extractAll (
137+ 'tmp/packthis-with-symlink-same-prefix.asar' ,
138+ 'tmp/packthis-with-symlink-same-prefix/' ,
139+ ) ;
140+ return compFiles (
141+ 'tmp/packthis-with-symlink-same-prefix/real.txt' ,
142+ 'test/input/packthis-with-symlink-same-prefix/real.txt' ,
143+ ) ;
144+ } ) ;
145+ it ( 'should not extract an archive with a bad symlink' , async ( ) => {
146+ assert . throws ( ( ) => {
147+ asar . extractAll ( 'test/input/bad-symlink.asar' , 'tmp/bad-symlink/' ) ;
148+ } ) ;
149+ } ) ;
150+ }
142151 it ( 'should handle multibyte characters in paths' , async ( ) => {
143152 await asar . createPackageWithOptions (
144153 'test/input/packthis-unicode-path/' ,
0 commit comments