@@ -14,7 +14,7 @@ import {
14
14
versionBump ,
15
15
VSIX ,
16
16
LicenseProcessor ,
17
- printAndValidatePackagedFiles ,
17
+ printAndValidatePackagedFiles , pack
18
18
} from '../package' ;
19
19
import { ManifestPackage } from '../manifest' ;
20
20
import * as path from 'path' ;
@@ -2286,13 +2286,13 @@ describe('ManifestProcessor', () => {
2286
2286
} ) ;
2287
2287
2288
2288
it ( 'should not throw error for engine version with x (e.g. 1.95.x)' , async ( ) => {
2289
- const root = fixture ( 'uuid' ) ;
2290
- const manifest = JSON . parse ( await fs . promises . readFile ( path . join ( root , 'package.json' ) , 'utf8' ) ) ;
2291
- manifest . engines . vscode = '1.95.x' ; // Non-strict semver, but acceptable
2289
+ const root = fixture ( 'uuid' ) ;
2290
+ const manifest = JSON . parse ( await fs . promises . readFile ( path . join ( root , 'package.json' ) , 'utf8' ) ) ;
2291
+ manifest . engines . vscode = '1.95.x' ; // Non-strict semver, but acceptable
2292
2292
2293
- assert . doesNotThrow ( ( ) => new ManifestProcessor ( manifest , { target : 'web' } ) ) ;
2294
- assert . doesNotThrow ( ( ) => new ManifestProcessor ( manifest , { preRelease : true } ) ) ;
2295
- } ) ;
2293
+ assert . doesNotThrow ( ( ) => new ManifestProcessor ( manifest , { target : 'web' } ) ) ;
2294
+ assert . doesNotThrow ( ( ) => new ManifestProcessor ( manifest , { preRelease : true } ) ) ;
2295
+ } ) ;
2296
2296
} ) ;
2297
2297
2298
2298
describe ( 'MarkdownProcessor' , ( ) => {
@@ -3196,3 +3196,42 @@ describe('version', function () {
3196
3196
assert . strictEqual ( newManifest . version , '1.0.0' ) ;
3197
3197
} ) ;
3198
3198
} ) ;
3199
+
3200
+ describe ( 'writeVsix' , function ( ) {
3201
+ this . timeout ( 60_000 ) ;
3202
+
3203
+ it ( 'should be reproducible' , async ( ) => {
3204
+ const exampleProject = fixture ( 'manifestFiles' ) ;
3205
+ const fixtureDir = fixture ( '' ) ;
3206
+
3207
+ const testDir = tmp . dirSync ( { unsafeCleanup : true , tmpdir : fixtureDir } ) ;
3208
+ const cwd = testDir . name
3209
+
3210
+ try {
3211
+ fs . cpSync ( exampleProject , cwd , { recursive : true } ) ;
3212
+
3213
+ const createVsix = async ( vsixPath : string , epoch : number ) => {
3214
+ process . env [ "SOURCE_DATE_EPOCH" ] = `${ epoch } ` ;
3215
+ await pack ( { cwd, packagePath : vsixPath } ) ;
3216
+ }
3217
+
3218
+ const vsix1 = testDir . name + '/vsix1.vsix' ;
3219
+ const vsix2 = testDir . name + '/vsix2.vsix' ;
3220
+ const vsix3 = testDir . name + '/vsix3.vsix' ;
3221
+
3222
+ await createVsix ( vsix1 , 1000000000 ) ;
3223
+ await createVsix ( vsix2 , 1000000000 ) ;
3224
+ await createVsix ( vsix3 , 1000000002 ) ;
3225
+
3226
+ const vsix1bytes = fs . readFileSync ( vsix1 ) ;
3227
+ const vsix2bytes = fs . readFileSync ( vsix2 ) ;
3228
+ const vsix3bytes = fs . readFileSync ( vsix3 ) ;
3229
+
3230
+ assert . deepStrictEqual ( vsix1bytes , vsix2bytes ) ;
3231
+ assert . notDeepStrictEqual ( vsix1bytes , vsix3bytes ) ;
3232
+
3233
+ } finally {
3234
+ testDir . removeCallback ( ) ;
3235
+ }
3236
+ } ) ;
3237
+ } ) ;
0 commit comments