Skip to content

Instanbul does not collect coverage from files with import.meta

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Seems one of our recent Vite integration merge requests broke instanbul, a tool that we use to collect coverage because we added import.meta calls:

https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/entrypoints/main.js or https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/entrypoints/main_ee.js

Here is the failed job log https://gitlab.com/gitlab-org/gitlab/-/jobs/5596785620#L4544

which has the following error:

Failed to collect coverage from /builds/gitlab-org/gitlab/app/assets/javascripts/entrypoints/main.js
ERROR: Cannot assign to read only property 'message' of object 'SyntaxError: import.meta may appear only with 'sourceType: "module"' (63:26)
Consider renaming the file to '.mjs', or setting sourceType:module or sourceType:unambiguous in your Babel config for this file.'
STACK: TypeError: Cannot assign to read only property 'message' of object 'SyntaxError: import.meta may appear only with 'sourceType: "module"' (63:26)
Consider renaming the file to '.mjs', or setting sourceType:module or sourceType:unambiguous in your Babel config for this file.'
Edited by 🤖 GitLab Bot 🤖