k6 icon indicating copy to clipboard operation
k6 copied to clipboard

moduletest: Enforce "use strict";

Open codebien opened this issue 3 years ago • 0 comments

The moduletest runtime should set "use strict"; so to have the same behaviour as for the real runtime, otherwise in some cases some bugs could be introduced like in this test https://github.com/grafana/k6/blob/b89a3aaa6bff07907140e6b31880971aeef3570b/js/modules/k6/execution/execution_test.go#L160-L165 where the Runtime doesn't throw an exception in the case DynamicObject.Set returns false.

The suggestion is to wrap the goja.RunString prefixing all the scripts with "use strict";. This has a big dependency on the ESM project, so let's wait for it before.

codebien avatar Aug 18 '22 14:08 codebien