k6
k6 copied to clipboard
moduletest: Enforce "use strict";
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.