let Module = require ( 'module' ) ; import { vscodeMock } from './mockVscode.spec' ; const { require : oldRequire } = Module . prototype ; Module . prototype . require = function hijacked ( file ) { if ( file === 'vscode' ) { return vscodeMock ; } else { return oldRequire . apply ( this , arguments ) ; } } ; import * as assert from "assert" ; import vscodeUtilities from '../src/vscodeUtilities' ; import { sep } from 'path' ; import { EOL } from 'os' ; suite ( 'vscode utilities tests' , ( ) => { test ( 'eol as string' , ( ) => { const d = new vscodeMock . TextDocument ( "" , "" ) ; assert . strictEqual ( vscodeUtilities . eol ( < any > d ) , "\n" ) ; d . eol = 2 ; assert . strictEqual ( vscodeUtilities . eol ( < any > d ) , "\r\n" ) ; } ) ; suite ( 'expand path setting' , ( ) => { test ( 'should replace env vars' , ( ) => { process . env [ "foo2435" ] = "a" ; assert . strictEqual ( vscodeUtilities . expandPathSetting ( "${env:foo2435}" ) , "a" ) ; delete process . env [ "foo2435" ] ; } ) ; test ( 'should replace workspacefolder' , ( ) => { assert . strictEqual ( vscodeUtilities . expandPathSetting ( "${workspaceFolder}" ) , sep ) ; } ) ; test ( 'should make relative paths absolute' , ( ) => { assert . strictEqual ( vscodeUtilities . expandPathSetting ( `foo${ sep }.env` ) , `${ sep + sep }foo${ sep }.env` ) ; } ) ; test ( 'should not change absolute paths' , ( ) => { assert . strictEqual ( vscodeUtilities . expandPathSetting ( __dirname ) , __dirname ) ; } ) ; } ) ; } ) ;