Skip to content

Commit

Permalink
Fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Mourtada authored and Jonathan Mourtada committed Jan 24, 2017
1 parent 9a9578b commit 297ae78
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/config-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ export function configLoader({
}: ConfigLoaderParams) {

if (explicitParams) {

const absoluteBaseUrl = path.isAbsolute(explicitParams.baseUrl)
? explicitParams.baseUrl
: path.join(cwd, explicitParams.baseUrl);

return {
absoluteBaseUrl,
paths: explicitParams.paths
Expand Down
4 changes: 2 additions & 2 deletions src/tsconfig-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export function tsConfigLoader({

const TS_NODE_PROJECT = getEnv("TS_NODE_PROJECT");

const searchStart = TS_NODE_PROJECT || cwd;
const loadResult = loadSync(searchStart, undefined);
// tsconfig.loadSync handles if TS_NODE_PROJECT is a file or directory
const loadResult = loadSync(cwd, TS_NODE_PROJECT);
return loadResult;

}
Expand Down
4 changes: 2 additions & 2 deletions tests/tsconfig-loader-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ describe('tsconfig-loader', function () {
const result = tsConfigLoader({
cwd: "/foo/bar",
getEnv: (key: string) => key === "TS_NODE_PROJECT" ? "/foo/baz" : undefined,
loadSync: (cwd: string) => {
if (cwd === "/foo/baz") {
loadSync: (cwd: string, fileName: string) => {
if (cwd === "/foo/bar" && fileName === "/foo/baz") {
return {
tsConfigPath: "/foo/baz/tsconfig.json",
baseUrl: "./",
Expand Down

0 comments on commit 297ae78

Please sign in to comment.