@@ -3,9 +3,18 @@ import { Yok } from "../../lib/common/yok";
3
3
import * as stubs from "../stubs" ;
4
4
import { assert } from "chai" ;
5
5
import * as constants from "../../lib/constants" ;
6
- import * as path from "path" ;
6
+ const path = require ( "path" ) ;
7
+ const originalResolve = path . resolve ;
7
8
8
9
describe ( "extensibilityService" , ( ) => {
10
+ before ( ( ) => {
11
+ path . resolve = ( p : string ) => p ;
12
+ } ) ;
13
+
14
+ after ( ( ) => {
15
+ path . resolve = originalResolve ;
16
+ } ) ;
17
+
9
18
const getTestInjector = ( ) : IInjector => {
10
19
const testInjector = new Yok ( ) ;
11
20
testInjector . register ( "fs" , { } ) ;
@@ -450,7 +459,7 @@ describe("extensibilityService", () => {
450
459
const fs : IFileSystem = testInjector . resolve ( "fs" ) ;
451
460
fs . exists = ( pathToCheck : string ) : boolean => true ;
452
461
const npm : INodePackageManager = testInjector . resolve ( "npm" ) ;
453
- npm . uninstall = async ( packageName : string , config ?: any , path ?: string ) : Promise < any > => {
462
+ npm . uninstall = async ( packageName : string , config ?: any , p ?: string ) : Promise < any > => {
454
463
throw new Error ( expectedErrorMessage ) ;
455
464
} ;
456
465
@@ -469,9 +478,9 @@ describe("extensibilityService", () => {
469
478
470
479
const npm : INodePackageManager = testInjector . resolve ( "npm" ) ;
471
480
const argsPassedToNpmInstall : any = { } ;
472
- npm . uninstall = async ( packageName : string , config ?: any , path ?: string ) : Promise < any > => {
481
+ npm . uninstall = async ( packageName : string , config ?: any , p ?: string ) : Promise < any > => {
473
482
argsPassedToNpmInstall . packageName = packageName ;
474
- argsPassedToNpmInstall . pathToSave = path ;
483
+ argsPassedToNpmInstall . pathToSave = p ;
475
484
argsPassedToNpmInstall . config = config ;
476
485
return [ userSpecifiedValue ] ;
477
486
} ;
@@ -523,7 +532,7 @@ describe("extensibilityService", () => {
523
532
fs . readDirectory = ( dir : string ) : string [ ] => [ extensionName ] ;
524
533
525
534
const npm : INodePackageManager = testInjector . resolve ( "npm" ) ;
526
- npm . uninstall = async ( packageName : string , config ?: any , path ?: string ) : Promise < any > => [ extensionName ] ;
535
+ npm . uninstall = async ( packageName : string , config ?: any , p ?: string ) : Promise < any > => [ extensionName ] ;
527
536
528
537
const extensibilityService : IExtensibilityService = testInjector . resolve ( ExtensibilityService ) ;
529
538
await extensibilityService . uninstallExtension ( extensionName ) ;
0 commit comments