@@ -790,44 +790,41 @@ runInEachFileSystem(() => {
790790 it ( 'should track each time a source file is visited' , ( ) => {
791791 const addDependency =
792792 jasmine . createSpy < DependencyTracker [ 'addDependency' ] > ( 'DependencyTracker' ) ;
793- const { expression, checker, program } = makeExpression (
793+ const { expression, checker} = makeExpression (
794794 `class A { static foo = 42; } function bar() { return A.foo; }` , 'bar()' ) ;
795- const entryPath = getSourceFileOrError ( program , _ ( '/entry.ts' ) ) . fileName ;
796795 const evaluator = makeEvaluator ( checker , { ...fakeDepTracker , addDependency} ) ;
797796 evaluator . evaluate ( expression ) ;
798797 expect ( addDependency ) . toHaveBeenCalledTimes ( 2 ) ; // two declaration visited
799798 expect (
800799 addDependency . calls . allArgs ( ) . map (
801800 ( args : Parameters < typeof addDependency > ) => [ args [ 0 ] . fileName , args [ 1 ] . fileName ] ) )
802- . toEqual ( [ [ entryPath , entryPath ] , [ entryPath , entryPath ] ] ) ;
801+ . toEqual ( [ [ _ ( '/entry.ts' ) , _ ( '/entry.ts' ) ] , [ _ ( '/entry.ts' ) , _ ( '/entry.ts' ) ] ] ) ;
803802 } ) ;
804803
805804 it ( 'should track imported source files' , ( ) => {
806805 const addDependency =
807806 jasmine . createSpy < DependencyTracker [ 'addDependency' ] > ( 'DependencyTracker' ) ;
808- const { expression, checker, program } =
807+ const { expression, checker} =
809808 makeExpression ( `import {Y} from './other'; const A = Y;` , 'A' , [
810809 { name : _ ( '/other.ts' ) , contents : `export const Y = 'test';` } ,
811810 { name : _ ( '/not-visited.ts' ) , contents : `export const Z = 'nope';` }
812811 ] ) ;
813- const entryPath = getSourceFileOrError ( program , _ ( '/entry.ts' ) ) . fileName ;
814- const otherPath = getSourceFileOrError ( program , _ ( '/other.ts' ) ) . fileName ;
815812 const evaluator = makeEvaluator ( checker , { ...fakeDepTracker , addDependency} ) ;
816813 evaluator . evaluate ( expression ) ;
817814 expect ( addDependency ) . toHaveBeenCalledTimes ( 2 ) ;
818815 expect (
819816 addDependency . calls . allArgs ( ) . map (
820817 ( args : Parameters < typeof addDependency > ) => [ args [ 0 ] . fileName , args [ 1 ] . fileName ] ) )
821818 . toEqual ( [
822- [ entryPath , entryPath ] ,
823- [ entryPath , otherPath ] ,
819+ [ _ ( '/entry.ts' ) , _ ( '/entry.ts' ) ] ,
820+ [ _ ( '/entry.ts' ) , _ ( '/other.ts' ) ] ,
824821 ] ) ;
825822 } ) ;
826823
827824 it ( 'should track files passed through during re-exports' , ( ) => {
828825 const addDependency =
829826 jasmine . createSpy < DependencyTracker [ 'addDependency' ] > ( 'DependencyTracker' ) ;
830- const { expression, checker, program } =
827+ const { expression, checker} =
831828 makeExpression ( `import * as mod from './direct-reexport';` , 'mod.value.property' , [
832829 { name : _ ( '/const.ts' ) , contents : 'export const value = {property: "test"};' } ,
833830 {
@@ -844,19 +841,16 @@ runInEachFileSystem(() => {
844841 } ,
845842 ] ) ;
846843 const evaluator = makeEvaluator ( checker , { ...fakeDepTracker , addDependency} ) ;
847- const entryPath = getSourceFileOrError ( program , _ ( '/entry.ts' ) ) . fileName ;
848- const directReexportPath = getSourceFileOrError ( program , _ ( '/direct-reexport.ts' ) ) . fileName ;
849- const constPath = getSourceFileOrError ( program , _ ( '/const.ts' ) ) . fileName ;
850844 evaluator . evaluate ( expression ) ;
851845 expect ( addDependency ) . toHaveBeenCalledTimes ( 2 ) ;
852846 expect (
853847 addDependency . calls . allArgs ( ) . map (
854848 ( args : Parameters < typeof addDependency > ) => [ args [ 0 ] . fileName , args [ 1 ] . fileName ] ) )
855849 . toEqual ( [
856- [ entryPath , directReexportPath ] ,
850+ [ _ ( '/entry.ts' ) , _ ( '/direct-reexport.ts' ) ] ,
857851 // Not '/indirect-reexport.ts' or '/def.ts'.
858852 // TS skips through them when finding the original symbol for `value`
859- [ entryPath , constPath ] ,
853+ [ _ ( '/entry.ts' ) , _ ( '/const.ts' ) ] ,
860854 ] ) ;
861855 } ) ;
862856 } ) ;
0 commit comments