From de0955b0e1079f8ae6d61a30b826e2bf7cecfd23 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Sat, 7 Nov 2015 16:47:33 +0500 Subject: [PATCH] add ava modules to test module paths Closes #144 --- lib/babel.js | 10 ++++++---- package.json | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/babel.js b/lib/babel.js index 84af5b977..bdff5e78d 100644 --- a/lib/babel.js +++ b/lib/babel.js @@ -2,9 +2,9 @@ var resolveFrom = require('resolve-from'); var createEspowerPlugin = require('babel-plugin-espower/create'); var requireFromString = require('require-from-string'); -var hasGenerators = parseInt(process.version.slice(1), 10) > 0; -var path = process.argv[2]; +var hasGenerators = parseInt(process.version.slice(1), 10) > 0; +var testPath = process.argv[2]; var babel; try { @@ -24,5 +24,7 @@ var options = { ] }; -var transpiled = babel.transformFileSync(path, options); -requireFromString(transpiled.code, path); +var transpiled = babel.transformFileSync(testPath, options); +requireFromString(transpiled.code, testPath, { + appendPaths: module.paths +}); diff --git a/package.json b/package.json index 896254785..5a0affc28 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "power-assert-formatter": "^1.3.0", "power-assert-renderers": "^0.1.0", "pretty-ms": "^2.0.0", - "require-from-string": "^1.0.0", + "require-from-string": "^1.1.0", "resolve-from": "^1.0.0", "serialize-error": "^1.0.0", "set-immediate-shim": "^1.0.1",