From 46e33ed234e4c2c7e3e22bcf8916b8357f0d76ba 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 | 9 ++++++--- package.json | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/babel.js b/lib/babel.js index 84af5b977e..74d4fd3c06 100644 --- a/lib/babel.js +++ b/lib/babel.js @@ -2,9 +2,10 @@ var resolveFrom = require('resolve-from'); var createEspowerPlugin = require('babel-plugin-espower/create'); var requireFromString = require('require-from-string'); +var path = require('path'); var hasGenerators = parseInt(process.version.slice(1), 10) > 0; -var path = process.argv[2]; +var testPath = process.argv[2]; var babel; try { @@ -24,5 +25,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 8962547856..5a0affc288 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",