diff --git a/package-lock.json b/package-lock.json index a5f13111..0b8f1302 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9760,6 +9760,12 @@ "ansi-regex": "^2.0.0" } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true + }, "strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", @@ -10446,6 +10452,31 @@ } } }, + "tsconfig-paths": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.1.0.tgz", + "integrity": "sha512-AHx4Euop/dXFC+Vx589alFba8QItjF+8hf8LtmuiCwHyI4rHXQtOOENaM8kvYf5fR0dRChy3wzWIZ9WbB7FWow==", + "dev": true, + "requires": { + "json5": "^2.2.1", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "json5": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", + "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "dev": true + }, + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + } + } + }, "tslib": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", diff --git a/package.json b/package.json index 2e2d05f3..868380aa 100644 --- a/package.json +++ b/package.json @@ -119,6 +119,7 @@ "tmp": "^0.1.0", "ts-loader": "^7.0.5", "ts-node": "^8.10.2", + "tsconfig-paths": "^4.1.0", "typed-error": "^3.2.1", "typescript": "^4.2.4", "webpack": "^4.44.1", diff --git a/test/.mocharc.js b/test/.mocharc.js index bb81f4a4..6f796a44 100644 --- a/test/.mocharc.js +++ b/test/.mocharc.js @@ -5,6 +5,7 @@ module.exports = { require: [ // Files to execute before running suites 'ts-node/register/transpile-only', + 'tsconfig-paths/register', 'test/config/fixtures.ts', ], spec: ['test/**/*.spec.ts'], diff --git a/test/01-constants.spec.ts b/test/01-constants.spec.ts index 2f81d78d..46516215 100644 --- a/test/01-constants.spec.ts +++ b/test/01-constants.spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import constants = require('../src/lib/constants'); +import * as constants from '~/src-lib/constants'; describe('constants', function () { it('has the correct configJsonPathOnHost', () => diff --git a/tsconfig.json b/tsconfig.json index 1ec3cc9e..e84eb281 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "baseUrl": "./", "target": "ES2019", "module": "commonjs", "strict": true, @@ -11,7 +12,13 @@ "skipLibCheck": true, "lib": ["es2019"], "resolveJsonModule": true, - "allowJs": true + "allowJs": true, + "paths": { + "~/src/*": ["src/*"], + "~/lib/*": ["src/lib/*"], + "~/test-lib/*": ["test/lib/*"], + "~/test-data/*": ["test/data/*"] + } }, "include": ["src/**/*", "test/**/*", "typings/**/*.d.ts"] }