grafana/k6

a Roadmap to target higher ES standards? ES6+ ES7+ ES8+ or ES2020 ES2021+ ?

Open

#2,296 opened on Dec 14, 2021

View on GitHub
 (4 comments) (3 reactions) (0 assignees)Go (30,564 stars) (1,537 forks)batch import
enhancementfeaturehelp wantedjs-compat

Description

Feature Description

the main feature of k6 still says ES6, but ES6 has existed long time (since 2015), some features are not cool enough at the end of 2021, and we have been using many newer JS features for years, like this optional chaining operator (?.) with babel or natively since 2020;

wish can write tests in this way, checking the response header should have 'content-type' and should string includes 'application/json'

  check(res, {
    'header has content-type application/json': r => r.headers['content-type'] ?. includes('application/json')
  });

instead of writing it the old way:

  check(res, {
    'header has content-type application/json': r => r.headers['content-type'] && r.headers['content-type'].indexOf('application/json') > -1
  });

wonder what JS engine is builtin this k6 tool? can that bump version to target a higher version of JS standard?

many things like URL, URLSearchParams have been builtin Node.js for years;

and have to import it is not cool https://k6.io/docs/examples/urls-with-query-parameters/

Suggested Solution (optional)

many things like URL, URLSearchParams have been builtin Node.js for years;

and have to import it is not cool https://k6.io/docs/examples/urls-with-query-parameters/

Already existing or connected issues / PRs (optional)

No response

Link #2168 #824

Contributor guide