From fdbda9e3d6564ec908733c7019305f6a3c363a9f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 7 Sep 2017 15:27:35 +0200 Subject: Add tests for npm run scripts --- server/helpers/core-utils.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'server/helpers/core-utils.ts') diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.ts index f8dd45533..2ec7e6515 100644 --- a/server/helpers/core-utils.ts +++ b/server/helpers/core-utils.ts @@ -25,8 +25,15 @@ function isTestInstance () { } function root () { - // We are in /dist/helpers/utils.js - return join(__dirname, '..', '..', '..') + // We are in /helpers/utils.js + const paths = [ __dirname, '..', '..' ] + + // We are under /dist directory + if (process.mainModule.filename.endsWith('.ts') === false) { + paths.push('..') + } + + return join.apply(null, paths) } function promisify0 (func: (cb: (err: any, result: A) => void) => void): () => Promise { -- cgit v1.2.3