@@ -3,9 +3,18 @@ import { Yok } from "../../lib/common/yok";
33import * as stubs from "../stubs" ;
44import { assert } from "chai" ;
55import * as constants from "../../lib/constants" ;
6- import * as path from "path" ;
6+ const path = require ( "path" ) ;
7+ const originalResolve = path . resolve ;
78
89describe ( "extensibilityService" , ( ) => {
10+ before ( ( ) => {
11+ path . resolve = ( p : string ) => p ;
12+ } ) ;
13+
14+ after ( ( ) => {
15+ path . resolve = originalResolve ;
16+ } ) ;
17+
918 const getTestInjector = ( ) : IInjector => {
1019 const testInjector = new Yok ( ) ;
1120 testInjector . register ( "fs" , { } ) ;
@@ -450,7 +459,7 @@ describe("extensibilityService", () => {
450459 const fs : IFileSystem = testInjector . resolve ( "fs" ) ;
451460 fs . exists = ( pathToCheck : string ) : boolean => true ;
452461 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 > => {
454463 throw new Error ( expectedErrorMessage ) ;
455464 } ;
456465
@@ -469,9 +478,9 @@ describe("extensibilityService", () => {
469478
470479 const npm : INodePackageManager = testInjector . resolve ( "npm" ) ;
471480 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 > => {
473482 argsPassedToNpmInstall . packageName = packageName ;
474- argsPassedToNpmInstall . pathToSave = path ;
483+ argsPassedToNpmInstall . pathToSave = p ;
475484 argsPassedToNpmInstall . config = config ;
476485 return [ userSpecifiedValue ] ;
477486 } ;
@@ -523,7 +532,7 @@ describe("extensibilityService", () => {
523532 fs . readDirectory = ( dir : string ) : string [ ] => [ extensionName ] ;
524533
525534 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 ] ;
527536
528537 const extensibilityService : IExtensibilityService = testInjector . resolve ( ExtensibilityService ) ;
529538 await extensibilityService . uninstallExtension ( extensionName ) ;
0 commit comments