From 570e1848af09a9b7238b5a1f7c5c1b5655b7680c Mon Sep 17 00:00:00 2001 From: hveldstra Date: Mon, 16 Dec 2024 13:00:07 +0000 Subject: [PATCH] feat: handle TypeScript in BOM --- packages/artillery/lib/artillery-global.js | 4 ---- .../artillery/lib/platform/aws-ecs/legacy/bom.js | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/artillery/lib/artillery-global.js b/packages/artillery/lib/artillery-global.js index 78f3373ab3..945789ec68 100644 --- a/packages/artillery/lib/artillery-global.js +++ b/packages/artillery/lib/artillery-global.js @@ -17,10 +17,6 @@ async function createGlobalObject(opts) { global.artillery._workerThreadSend = global.artillery._workerThreadSend || null; - // TODO: Refactor these special fields away - global.artillery.__util = global.artillery.__util || {}; - global.artillery.__util.parseScript = parseScript; - global.artillery.__util.readScript = readScript; global.artillery.__createReporter = require('./console-reporter'); global.artillery._exitCode = 0; diff --git a/packages/artillery/lib/platform/aws-ecs/legacy/bom.js b/packages/artillery/lib/platform/aws-ecs/legacy/bom.js index c6e3928b88..e24c41781d 100644 --- a/packages/artillery/lib/platform/aws-ecs/legacy/bom.js +++ b/packages/artillery/lib/platform/aws-ecs/legacy/bom.js @@ -15,6 +15,9 @@ const BUILTIN_ENGINES = require('./plugins').getOfficialEngines(); const Table = require('cli-table3'); const { resolveConfigTemplates } = require('../../../../util'); + +const prepareTestExecutionPlan = require('../../../../lib/util/prepare-test-execution-plan'); + // NOTE: Code below presumes that all paths are absolute //Tests in Fargate run on ubuntu, which uses posix paths @@ -28,8 +31,15 @@ function createBOM(absoluteScriptPath, extraFiles, opts, callback) { A.waterfall( [ A.constant(absoluteScriptPath), - global.artillery.__util.readScript, - global.artillery.__util.parseScript, + async function (scriptPath) { + const scriptData = await prepareTestExecutionPlan( + [scriptPath], + opts.flags, + [] + ); + scriptData.config.processor = scriptPath; + return scriptData; + }, (scriptData, next) => { return next(null, { opts: {