@@ -134,97 +134,6 @@ fn disabled() {
134134 }
135135}
136136
137- #[ test]
138- fn manual ( ) {
139- let f = super :: fixture_root ( ) . join ( "tsconfig/cases/project-references" ) ;
140-
141- // The following resolver's `config_file` has defined it's own paths alias which has higher priority
142- // some cases will work without references
143- let resolver = Resolver :: new ( ResolveOptions {
144- tsconfig : Some ( TsconfigDiscovery :: Manual ( TsconfigOptions {
145- config_file : f. join ( "app" ) ,
146- references : TsconfigReferences :: Paths ( vec ! [ "../project-a/conf.json" . into( ) ] ) ,
147- } ) ) ,
148- ..ResolveOptions :: default ( )
149- } ) ;
150-
151- #[ rustfmt:: skip]
152- let pass = [
153- // Test normal paths alias
154- ( f. join ( "app" ) , "@/index.ts" , Ok ( f. join ( "app/aliased/index.ts" ) ) ) ,
155- ( f. join ( "app" ) , "@/../index.ts" , Ok ( f. join ( "app/index.ts" ) ) ) ,
156- // Test project reference
157- ( f. join ( "project-a" ) , "@/index.ts" , Ok ( f. join ( "project-a/aliased/index.ts" ) ) ) ,
158- ( f. join ( "project-b/src" ) , "@/index.ts" , Ok ( f. join ( "app/aliased/index.ts" ) ) ) ,
159- // Does not have paths alias
160- ( f. join ( "project-a" ) , "./index.ts" , Ok ( f. join ( "project-a/index.ts" ) ) ) ,
161- ( f. join ( "project-c" ) , "./index.ts" , Ok ( f. join ( "project-c/index.ts" ) ) ) ,
162- ] ;
163-
164- for ( path, request, expected) in pass {
165- let resolved_path = resolver. resolve ( & path, request) . map ( |f| f. full_path ( ) ) ;
166- assert_eq ! ( resolved_path, expected, "{request} {path:?}" ) ;
167- }
168-
169- // The following resolver's `config_file` has no `paths` alias with `references` enabled
170- let no_paths_resolver = Resolver :: new ( ResolveOptions {
171- tsconfig : Some ( TsconfigDiscovery :: Manual ( TsconfigOptions {
172- config_file : f. join ( "app/tsconfig.nopaths.json" ) ,
173- references : TsconfigReferences :: Paths ( vec ! [ "../project-a/conf.json" . into( ) ] ) ,
174- } ) ) ,
175- ..ResolveOptions :: default ( )
176- } ) ;
177-
178- #[ rustfmt:: skip]
179- let pass = [
180- // Test normal paths alias
181- ( f. join ( "app" ) , "@/index.ts" , Err ( ResolveError :: NotFound ( "@/index.ts" . into ( ) ) ) ) ,
182- ( f. join ( "app" ) , "@/../index.ts" , Ok ( f. join ( "app/index.ts" ) ) ) ,
183- // Test project reference
184- ( f. join ( "project-a" ) , "@/index.ts" , Ok ( f. join ( "project-a/aliased/index.ts" ) ) ) ,
185- ( f. join ( "project-b/src" ) , "@/index.ts" , Err ( ResolveError :: NotFound ( "@/index.ts" . into ( ) ) ) ) ,
186- // Does not have paths alias
187- ( f. join ( "project-a" ) , "./index.ts" , Ok ( f. join ( "project-a/index.ts" ) ) ) ,
188- ( f. join ( "project-c" ) , "./index.ts" , Ok ( f. join ( "project-c/index.ts" ) ) ) ,
189- ] ;
190-
191- for ( path, request, expected) in pass {
192- let resolved_path = no_paths_resolver. resolve ( & path, request) . map ( |f| f. full_path ( ) ) ;
193- assert_eq ! ( resolved_path, expected, "{request} {path:?}" ) ;
194- }
195- }
196-
197- #[ test]
198- fn self_reference ( ) {
199- let f = super :: fixture_root ( ) . join ( "tsconfig/cases/project-references" ) ;
200-
201- #[ rustfmt:: skip]
202- let pass = [
203- ( f. join ( "app" ) , vec ! [ "./tsconfig.json" . into( ) ] ) ,
204- ( f. join ( "app/tsconfig.json" ) , vec ! [ "./tsconfig.json" . into( ) ] ) ,
205- ( f. join ( "app" ) , vec ! [ f. join( "app" ) ] ) ,
206- ( f. join ( "app/tsconfig.json" ) , vec ! [ f. join( "app" ) ] ) ,
207- ( f. join ( "app/tsconfig.json" ) , vec ! [ f. join( "project-b" ) , f. join( "app" ) ] ) ,
208- ] ;
209-
210- for ( config_file, reference_paths) in pass {
211- let resolver = Resolver :: new ( ResolveOptions {
212- tsconfig : Some ( TsconfigDiscovery :: Manual ( TsconfigOptions {
213- config_file : config_file. clone ( ) ,
214- references : TsconfigReferences :: Paths ( reference_paths. clone ( ) ) ,
215- } ) ) ,
216- ..ResolveOptions :: default ( )
217- } ) ;
218- let path = f. join ( "app" ) ;
219- let resolved_path = resolver. resolve ( & path, "@/index.ts" ) . map ( |f| f. full_path ( ) ) ;
220- assert_eq ! (
221- resolved_path,
222- Err ( ResolveError :: TsconfigSelfReference ( f. join( "app/tsconfig.json" ) ) ) ,
223- "{config_file:?} {reference_paths:?}"
224- ) ;
225- }
226- }
227-
228137#[ test]
229138fn references_with_extends ( ) {
230139 let f = super :: fixture_root ( ) . join ( "tsconfig/cases/project-references/extends" ) ;
0 commit comments