artillery icon indicating copy to clipboard operation
artillery copied to clipboard

【bug】 $(npm bin)/artillery dino failed

Open magentaqin opened this issue 2 years ago • 7 comments

Version info:

 2.0.0-14

Running this command:

$(npm bin)/artillery dino failed

I expected to see this happen:

Screen Shot 2022-04-19 at 5 01 49 PM

Instead, this happened:

Screen Shot 2022-04-19 at 4 59 15 PM

explanation: lib/console-reporter.js accidentally has optional chaining operator, which can not be understood by node.

Files being used:

<relevant yaml/js/csv go here>

magentaqin avatar Apr 19 '22 09:04 magentaqin

hi @magentaqin 👋

Artillery depends on Node.js v14 or higher. I'm guessing you're running an older version of Node which does not support optional chaining.

https://github.com/artilleryio/artillery/blob/master/package.json#L7

hassy avatar Apr 19 '22 13:04 hassy

Thanks. After I upgrade my node version, it works!

magentaqin avatar Apr 20 '22 03:04 magentaqin

@hassy probably introducing a build system would allow for compiling to an older target so for example, the optional chaining would be transformed to use if statements and this sort of stuff and then It would support much older Node.js versions cause currently the workflow isn't the best for distributing, the problem is that the code you write is exactly the same code that gets shipped to users which can be better by introducing Babel:

  1. It would compile for older targets.
  2. It would compile to smaller bundles.

YassinEldeeb avatar Apr 20 '22 17:04 YassinEldeeb

Supporting older Node.js versions isn't really something we want to do. We try to match current LTS or latest AWS Lambda runtime version, whichever is newer.

A smaller release bundle could be interesting if it significantly reduces package size or CLI start time for example.

hassy avatar Apr 21 '22 09:04 hassy

Supporting older Node.js versions isn't really something we want to do

Yes you're completely right, we're now in Node.js 18! People using super older versions should have a problem.

A smaller release bundle could be interesting if it significantly reduces package size or CLI start time for example.

I think it can significantly reduce package size but not the CLI start time, cause It just transforms variable names to be shorter, removes unnecessary spaces, line breaks, comments, ..etc. basically cleans up everything that won't affect node's runtime.

YassinEldeeb avatar Apr 21 '22 14:04 YassinEldeeb

Runtime compatible code is unavoidable which could pump up the size. A waring "Please upgrade to higher node version" instead of an error would be more friendly to users. I will pull a request to optimize it.

magentaqin avatar Apr 22 '22 02:04 magentaqin

@magentaqin I agree 💯

YassinEldeeb avatar Apr 22 '22 02:04 YassinEldeeb