11namespace ts . tscWatch {
22 describe ( "unittests:: tsc-watch:: Emit times and Error updates in builder after program changes" , ( ) => {
3- const currentDirectory = "/user/username/projects/myproject" ;
43 const config : File = {
5- path : `${ currentDirectory } /tsconfig.json` ,
4+ path : `${ projectRoot } /tsconfig.json` ,
65 content : `{}`
76 } ;
87 function getOutputFileStampAndError ( host : WatchedSystem , watch : Watch , file : File ) {
@@ -83,7 +82,7 @@ namespace ts.tscWatch {
8382 const nonLibFiles = [ ...filesWithNewEmit , ...filesWithOnlyErrorRefresh , ...filesNotTouched ] ;
8483 const files = [ ...nonLibFiles , configFile , libFile ] ;
8584 const compilerOptions = ( JSON . parse ( configFile . content ) . compilerOptions || { } ) as CompilerOptions ;
86- const host = createWatchedSystem ( files , { currentDirectory } ) ;
85+ const host = createWatchedSystem ( files , { currentDirectory : projectRoot } ) ;
8786 const watch = createWatchOfConfigFile ( "tsconfig.json" , host ) ;
8887 checkProgramActualFiles ( watch ( ) , [ ...nonLibFiles . map ( f => f . path ) , libFile . path ] ) ;
8988 checkOutputErrorsInitial ( host , getInitialErrors ( watch ) ) ;
@@ -167,7 +166,7 @@ namespace ts.tscWatch {
167166
168167 describe ( "deep import changes" , ( ) => {
169168 const aFile : File = {
170- path : `${ currentDirectory } /a.ts` ,
169+ path : `${ projectRoot } /a.ts` ,
171170 content : `import {B} from './b';
172171declare var console: any;
173172let b = new B();
@@ -203,15 +202,15 @@ console.log(b.c.d);`
203202
204203 describe ( "updates errors when deep import file changes" , ( ) => {
205204 const bFile : File = {
206- path : `${ currentDirectory } /b.ts` ,
205+ path : `${ projectRoot } /b.ts` ,
207206 content : `import {C} from './c';
208207export class B
209208{
210209 c = new C();
211210}`
212211 } ;
213212 const cFile : File = {
214- path : `${ currentDirectory } /c.ts` ,
213+ path : `${ projectRoot } /c.ts` ,
215214 content : `export class C
216215{
217216 d = 1;
@@ -222,15 +221,15 @@ export class B
222221
223222 describe ( "updates errors when deep import through declaration file changes" , ( ) => {
224223 const bFile : File = {
225- path : `${ currentDirectory } /b.d.ts` ,
224+ path : `${ projectRoot } /b.d.ts` ,
226225 content : `import {C} from './c';
227226export class B
228227{
229228 c: C;
230229}`
231230 } ;
232231 const cFile : File = {
233- path : `${ currentDirectory } /c.d.ts` ,
232+ path : `${ projectRoot } /c.d.ts` ,
234233 content : `export class C
235234{
236235 d: number;
@@ -242,7 +241,7 @@ export class B
242241
243242 describe ( "updates errors in file not exporting a deep multilevel import that changes" , ( ) => {
244243 const aFile : File = {
245- path : `${ currentDirectory } /a.ts` ,
244+ path : `${ projectRoot } /a.ts` ,
246245 content : `export interface Point {
247246 name: string;
248247 c: Coords;
@@ -253,13 +252,13 @@ export interface Coords {
253252}`
254253 } ;
255254 const bFile : File = {
256- path : `${ currentDirectory } /b.ts` ,
255+ path : `${ projectRoot } /b.ts` ,
257256 content : `import { Point } from "./a";
258257export interface PointWrapper extends Point {
259258}`
260259 } ;
261260 const cFile : File = {
262- path : `${ currentDirectory } /c.ts` ,
261+ path : `${ projectRoot } /c.ts` ,
263262 content : `import { PointWrapper } from "./b";
264263export function getPoint(): PointWrapper {
265264 return {
@@ -272,12 +271,12 @@ export function getPoint(): PointWrapper {
272271};`
273272 } ;
274273 const dFile : File = {
275- path : `${ currentDirectory } /d.ts` ,
274+ path : `${ projectRoot } /d.ts` ,
276275 content : `import { getPoint } from "./c";
277276getPoint().c.x;`
278277 } ;
279278 const eFile : File = {
280- path : `${ currentDirectory } /e.ts` ,
279+ path : `${ projectRoot } /e.ts` ,
281280 content : `import "./d";`
282281 } ;
283282 verifyEmitAndErrorUpdates ( {
@@ -301,14 +300,14 @@ getPoint().c.x;`
301300
302301 describe ( "updates errors when file transitively exported file changes" , ( ) => {
303302 const config : File = {
304- path : `${ currentDirectory } /tsconfig.json` ,
303+ path : `${ projectRoot } /tsconfig.json` ,
305304 content : JSON . stringify ( {
306305 files : [ "app.ts" ] ,
307306 compilerOptions : { baseUrl : "." }
308307 } )
309308 } ;
310309 const app : File = {
311- path : `${ currentDirectory } /app.ts` ,
310+ path : `${ projectRoot } /app.ts` ,
312311 content : `import { Data } from "lib2/public";
313312export class App {
314313 public constructor() {
@@ -317,11 +316,11 @@ export class App {
317316}`
318317 } ;
319318 const lib2Public : File = {
320- path : `${ currentDirectory } /lib2/public.ts` ,
319+ path : `${ projectRoot } /lib2/public.ts` ,
321320 content : `export * from "./data";`
322321 } ;
323322 const lib2Data : File = {
324- path : `${ currentDirectory } /lib2/data.ts` ,
323+ path : `${ projectRoot } /lib2/data.ts` ,
325324 content : `import { ITest } from "lib1/public";
326325export class Data {
327326 public test() {
@@ -333,15 +332,15 @@ export class Data {
333332}`
334333 } ;
335334 const lib1Public : File = {
336- path : `${ currentDirectory } /lib1/public.ts` ,
335+ path : `${ projectRoot } /lib1/public.ts` ,
337336 content : `export * from "./tools/public";`
338337 } ;
339338 const lib1ToolsPublic : File = {
340- path : `${ currentDirectory } /lib1/tools/public.ts` ,
339+ path : `${ projectRoot } /lib1/tools/public.ts` ,
341340 content : `export * from "./tools.interface";`
342341 } ;
343342 const lib1ToolsInterface : File = {
344- path : `${ currentDirectory } /lib1/tools/tools.interface.ts` ,
343+ path : `${ projectRoot } /lib1/tools/tools.interface.ts` ,
345344 content : `export interface ITest {
346345 title: string;
347346}`
@@ -372,7 +371,7 @@ export class Data {
372371
373372 describe ( "when there are circular import and exports" , ( ) => {
374373 const lib2Data : File = {
375- path : `${ currentDirectory } /lib2/data.ts` ,
374+ path : `${ projectRoot } /lib2/data.ts` ,
376375 content : `import { ITest } from "lib1/public"; import { Data2 } from "./data2";
377376export class Data {
378377 public dat?: Data2; public test() {
@@ -384,7 +383,7 @@ export class Data {
384383}`
385384 } ;
386385 const lib2Data2 : File = {
387- path : `${ currentDirectory } /lib2/data2.ts` ,
386+ path : `${ projectRoot } /lib2/data2.ts` ,
388387 content : `import { Data } from "./data";
389388export class Data2 {
390389 public dat?: Data;
0 commit comments