Skip to content

Commit

Permalink
fix Error [ERR_UNSUPPORTED_ESM_URL_SCHEME] when using a artillery r…
Browse files Browse the repository at this point in the history
…unner file with a .mjs extension
  • Loading branch information
thrandale committed Apr 22, 2024
1 parent 242a796 commit 0a71914
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const isIdlePhase = require('./is-idle-phase');
const createReader = require('./readers');
const engineUtil = require('@artilleryio/int-commons').engine_util;
const wl = require('./weighted-pick');
const { pathToFileURL } = require('url');

const Engines = {
http: require('./engine_http'),
Expand Down Expand Up @@ -86,7 +87,8 @@ async function loadProcessor(script, options) {
);

if (processorPath.endsWith('.mjs')) {
const exports = await import(processorPath);
const fileUrl = pathToFileURL(processorPath);
const exports = await import(fileUrl.href);
script.config.processor = Object.assign(
{},
script.config.processor,
Expand Down

0 comments on commit 0a71914

Please sign in to comment.