tsconfig-paths
Advanced tools
Comparing version 3.1.3 to 3.2.0
@@ -9,2 +9,6 @@ # Change Log | ||
## [3.2.0] - 2018-03-31 | ||
### Added | ||
- Added support for passing a filename as cwd, see issue [#31](https://github.com/dividab/tsconfig-paths/issues/31) and PR [#32](https://github.com/dividab/tsconfig-paths/pull/32). Thanks to [@amodm](https://github.com/amodm) for this adding this! | ||
## [3.1.3] - 2018-03-14 | ||
@@ -149,3 +153,4 @@ ### Fixed | ||
[Unreleased]: https://github.com/dividab/tsconfig-paths/compare/3.1.3...master | ||
[Unreleased]: https://github.com/dividab/tsconfig-paths/compare/3.2.0...master | ||
[3.2.0]: https://github.com/dividab/tsconfig-paths/compare/3.1.3...3.2.0 | ||
[3.1.3]: https://github.com/dividab/tsconfig-paths/compare/3.1.2...3.1.3 | ||
@@ -152,0 +157,0 @@ [3.1.2]: https://github.com/dividab/tsconfig-paths/compare/3.1.1...3.1.2 |
@@ -41,2 +41,5 @@ "use strict"; | ||
} | ||
if (fs.statSync(cwd).isFile()) { | ||
return path.resolve(cwd); | ||
} | ||
var configAbsolutePath = walkForTsConfig(cwd); | ||
@@ -43,0 +46,0 @@ return configAbsolutePath ? path.resolve(configAbsolutePath) : undefined; |
{ | ||
"name": "tsconfig-paths", | ||
"version": "3.1.3", | ||
"version": "3.2.0", | ||
"description": "Load node modules according to tsconfig paths, in run-time or via API.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
import { assert } from "chai"; | ||
import { | ||
configLoader, | ||
loadConfig, | ||
ConfigLoaderFailResult, | ||
@@ -76,2 +77,15 @@ ConfigLoaderSuccessResult | ||
}); | ||
it("should presume cwd to be a tsconfig file when loadConfig is called with absolute path to tsconfig.json", () => { | ||
// using tsconfig-named.json to ensure that future changes to fix | ||
// https://github.com/dividab/tsconfig-paths/issues/31 | ||
// do not pass this test case just because of a directory walk looking | ||
// for tsconfig.json | ||
const configFile = join(__dirname, "tsconfig-named.json"); | ||
const result = loadConfig(configFile); | ||
const successResult = result as ConfigLoaderSuccessResult; | ||
assert.equal(successResult.resultType, "success"); | ||
assert.equal(successResult.configFileAbsolutePath, configFile); | ||
}); | ||
}); |
147425
36
1528