{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/jest/issues/4842","repository_url":"https://api.github.com/repos/facebook/jest","labels_url":"https://api.github.com/repos/facebook/jest/issues/4842/labels{/name}","comments_url":"https://api.github.com/repos/facebook/jest/issues/4842/comments","events_url":"https://api.github.com/repos/facebook/jest/issues/4842/events","html_url":"https://github.com/facebook/jest/issues/4842","id":271299618,"number":4842,"title":"Please consider adding native support for ES modules","user":{"login":"kirlat","id":18631055,"avatar_url":"https://avatars1.githubusercontent.com/u/18631055?v=4","gravatar_id":"","url":"https://api.github.com/users/kirlat","html_url":"https://github.com/kirlat","followers_url":"https://api.github.com/users/kirlat/followers","following_url":"https://api.github.com/users/kirlat/following{/other_user}","gists_url":"https://api.github.com/users/kirlat/gists{/gist_id}","starred_url":"https://api.github.com/users/kirlat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirlat/subscriptions","organizations_url":"https://api.github.com/users/kirlat/orgs","repos_url":"https://api.github.com/users/kirlat/repos","events_url":"https://api.github.com/users/kirlat/events{/privacy}","received_events_url":"https://api.github.com/users/kirlat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2017-11-05T17:52:04Z","updated_at":"2018-02-08T03:17:24Z","closed_at":null,"author_association":"NONE","body":"**Do you want to request a *feature* or report a *bug*?**\r\nI want to request a feature.\r\n**What is the current behavior?**\r\nRight now Jest does not support test suites with `import` statement. They result in the following error:\r\n```\r\nSyntaxError: Unexpected token import\r\n      \r\n      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:305:17)\r\n          at Generator.next (<anonymous>)\r\n          at new Promise (<anonymous>)\r\n```\r\n**What is the expected behavior?**\r\nWould be great if Jest supported ES modules natively.\r\n\r\n**Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.**\r\nJest: `21.2.1`\r\nnode: `8.9.0`\r\nnpm: `5.5.1`\r\n\r\nBefore, native support of ES modules was not possible since node.js did not support them. Starting from a few versions ago, node.js added support of ES modules with a flag (https://nodejs.org/api/esm.html). It would be absolutely great if Jest would match this with adding support of ES modules too, probably with a flag or even without it.\r\n\r\nNode.js requires ES modules to have an `.mjs` extension. In order to support ES modules Jest needs to add a recognition of those extensions. Jest will also need to pass an `--experimental-modules` flag to node.js until node will implement support of modules without a flag. I'm not sure if any other required changes would be needed within Jest in order to support this. I can only hope it will not be terribly hard.\r\n\r\nIdeally, it would be cool if Jest would recognize modules even in files without `.mjs` extensions since code that targets browsers do not use them, but I don't know if it is ever possible. Node.js provides loader hooks for that (https://nodejs.org/api/esm.html) but this still doesn't solve the issue with a reliable determination of what type of module the file is.\r\n\r\nI believe ES modules are a great feature vastly superior to all existing JS module solutions. Having it implemented in node.js opens a door for Jest to have it too. This would allow developers stick to using the first truly standardized JS module format not only throughout development, but trough testing as well."},"comment":{"url":"https://api.github.com/repos/facebook/jest/issues/comments/363989843","html_url":"https://github.com/facebook/jest/issues/4842#issuecomment-363989843","issue_url":"https://api.github.com/repos/facebook/jest/issues/4842","id":363989843,"user":{"login":"jdalton","id":4303,"avatar_url":"https://avatars2.githubusercontent.com/u/4303?v=4","gravatar_id":"","url":"https://api.github.com/users/jdalton","html_url":"https://github.com/jdalton","followers_url":"https://api.github.com/users/jdalton/followers","following_url":"https://api.github.com/users/jdalton/following{/other_user}","gists_url":"https://api.github.com/users/jdalton/gists{/gist_id}","starred_url":"https://api.github.com/users/jdalton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdalton/subscriptions","organizations_url":"https://api.github.com/users/jdalton/orgs","repos_url":"https://api.github.com/users/jdalton/repos","events_url":"https://api.github.com/users/jdalton/events{/privacy}","received_events_url":"https://api.github.com/users/jdalton/received_events","type":"User","site_admin":false},"created_at":"2018-02-08T03:17:24Z","updated_at":"2018-02-08T03:17:24Z","author_association":"CONTRIBUTOR","body":"@SimenB Can you chat sometime on hangouts? "}}
{"actor":{"display_login":"jdalton"}}