grafana/k6

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

Open

#2,296 创建于 2021年12月14日

在 GitHub 查看
 (4 评论) (3 反应) (0 负责人)Go (30,564 star) (1,537 fork)batch import
enhancementfeaturehelp wantedjs-compat

描述

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

贡献者指南