@@ -9,7 +9,7 @@ const rimraf = require('rimraf');
9
9
const asar = require ( '..' ) ;
10
10
const compDirs = require ( './util/compareDirectories' ) ;
11
11
const compFileLists = require ( './util/compareFileLists' ) ;
12
- const compFiles = require ( './util/compareFiles' ) ;
12
+ const { compFiles, isSymbolicLinkSync } = require ( './util/compareFiles' ) ;
13
13
const transform = require ( './util/transformStream' ) ;
14
14
15
15
async function assertPackageListEquals ( actualList , expectedFilename ) {
@@ -107,38 +107,47 @@ describe('api', function () {
107
107
asar . extractAll ( 'test/input/extractthis-unpack-dir.asar' , 'tmp/extractthis-unpack-dir-api/' ) ;
108
108
return compDirs ( 'tmp/extractthis-unpack-dir-api/' , 'test/expected/extractthis' ) ;
109
109
} ) ;
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
+ ) ;
140
125
} ) ;
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
+ }
142
151
it ( 'should handle multibyte characters in paths' , async ( ) => {
143
152
await asar . createPackageWithOptions (
144
153
'test/input/packthis-unicode-path/' ,
0 commit comments