File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,9 +15,23 @@ function transformer(file, api) {
1515 return ;
1616 }
1717
18+ // determine the actual path that importPath points to
19+ // TODO: extract these resolutions into classic-file-info and test-file-info
1820 var relative = path_utils . isRelative ( importPath ) ;
1921 if ( relative ) {
20- importPath = path_utils . makeAbsolute ( appName + '/' + file . fileInfo . sourceRelativePath , importPath ) ;
22+ var sourceRelativePath = file . fileInfo . sourceRelativePath ;
23+
24+ if ( sourceRelativePath . startsWith ( 'tests/' ) ) {
25+ importPath = path_utils . makeAbsolute ( appName + '/app/' + sourceRelativePath , importPath ) ;
26+
27+ // see if we stayed within tests
28+ var inTestsPrefix = appName + '/app/tests/' ;
29+ if ( importPath . startsWith ( inTestsPrefix ) ) {
30+ importPath = appName + '/tests/' + importPath . substring ( inTestsPrefix . length ) ;
31+ }
32+ } else {
33+ importPath = path_utils . makeAbsolute ( appName + '/' + sourceRelativePath , importPath ) ;
34+ }
2135 } else {
2236 // check if import path starts with appName and add /app
2337 if ( importPath . startsWith ( appName + '/' ) && ! importPath . startsWith ( appName + '/app/' ) ) {
You can’t perform that action at this time.
0 commit comments