From d79c67bfda8c37c6dc564490384f50f0e34365c3 Mon Sep 17 00:00:00 2001 From: ed-thuando Date: Sat, 11 Apr 2026 17:48:20 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20resolve=20#463=20=E2=80=94=20Tests=20fai?= =?UTF-8?q?l=20without=20any=20message=20if=20there=20are=20type=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #463 Signed-off-by: ed-thuando <231172918+ed-thuando@users.noreply.github.com> --- utils/testUtils.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/utils/testUtils.js b/utils/testUtils.js index dc4a016b..ab9f56d9 100644 --- a/utils/testUtils.js +++ b/utils/testUtils.js @@ -47,3 +47,17 @@ function getFileContent(filePath) { return fs.readFileSync(filePath).toString(); } exports.getFileContent = getFileContent; + +function runTest(transformName, { jscodeshift = require('jscodeshift'), ...options } = {}) { + const dirName = path.dirname(require.resolve('jscodeshift')); + let module; + try { + module = require(path.join(dirName, '..', transformName)); + } catch (e) { + console.log('Error importing module', e); + } + const j = jscodeshift; + return (input, { dry, bench } = {}) => + j(input, { dry, ...options, jscodeshift: j, babel: true, ...module }, { bench }); +} +exports.runTest = runTest;