{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/jest/issues/7947","repository_url":"https://api.github.com/repos/facebook/jest","labels_url":"https://api.github.com/repos/facebook/jest/issues/7947/labels{/name}","comments_url":"https://api.github.com/repos/facebook/jest/issues/7947/comments","events_url":"https://api.github.com/repos/facebook/jest/issues/7947/events","html_url":"https://github.com/facebook/jest/pull/7947","id":413046330,"node_id":"MDExOlB1bGxSZXF1ZXN0MjU1MTIwNDcy","number":7947,"title":"Ignore rootDir to determine the cache key of transformed files in babel-jest","user":{"login":"rubennorte","id":117921,"node_id":"MDQ6VXNlcjExNzkyMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/117921?v=4","gravatar_id":"","url":"https://api.github.com/users/rubennorte","html_url":"https://github.com/rubennorte","followers_url":"https://api.github.com/users/rubennorte/followers","following_url":"https://api.github.com/users/rubennorte/following{/other_user}","gists_url":"https://api.github.com/users/rubennorte/gists{/gist_id}","starred_url":"https://api.github.com/users/rubennorte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubennorte/subscriptions","organizations_url":"https://api.github.com/users/rubennorte/orgs","repos_url":"https://api.github.com/users/rubennorte/repos","events_url":"https://api.github.com/users/rubennorte/events{/privacy}","received_events_url":"https://api.github.com/users/rubennorte/received_events","type":"User","site_admin":false},"labels":[{"id":847426897,"node_id":"MDU6TGFiZWw4NDc0MjY4OTc=","url":"https://api.github.com/repos/facebook/jest/labels/cla%20signed","name":"cla signed","color":"ededed","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2019-02-21T17:44:33Z","updated_at":"2019-02-22T15:55:52Z","closed_at":"2019-02-22T15:55:52Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/facebook/jest/pulls/7947","html_url":"https://github.com/facebook/jest/pull/7947","diff_url":"https://github.com/facebook/jest/pull/7947.diff","patch_url":"https://github.com/facebook/jest/pull/7947.patch"},"body":"## Summary\r\n\r\nRemoves the root directory from the determination of the cache key in `babel-jest`.\r\n\r\nThe cache directory used by Jest depends on the root directory so different projects store their artifacts in different caches. With that guarantee, we don't need to take the root directory into account to compute the cache key of the transformed files, so we can store them remotely and restore them in different hosts/locations.\r\n\r\n## Test plan\r\n\r\nAdded a test to verify this behaviour.\r\n\r\nIn terms of performance, we crawl the filesystem by default to find Babel configuration files and that's an order of magnitude higher than the additional processing we're doing with this change.\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/jest/issues/comments/466445804","html_url":"https://github.com/facebook/jest/pull/7947#issuecomment-466445804","issue_url":"https://api.github.com/repos/facebook/jest/issues/7947","id":466445804,"node_id":"MDEyOklzc3VlQ29tbWVudDQ2NjQ0NTgwNA==","user":{"login":"rubennorte","id":117921,"node_id":"MDQ6VXNlcjExNzkyMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/117921?v=4","gravatar_id":"","url":"https://api.github.com/users/rubennorte","html_url":"https://github.com/rubennorte","followers_url":"https://api.github.com/users/rubennorte/followers","following_url":"https://api.github.com/users/rubennorte/following{/other_user}","gists_url":"https://api.github.com/users/rubennorte/gists{/gist_id}","starred_url":"https://api.github.com/users/rubennorte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubennorte/subscriptions","organizations_url":"https://api.github.com/users/rubennorte/orgs","repos_url":"https://api.github.com/users/rubennorte/repos","events_url":"https://api.github.com/users/rubennorte/events{/privacy}","received_events_url":"https://api.github.com/users/rubennorte/received_events","type":"User","site_admin":false},"created_at":"2019-02-22T15:55:52Z","updated_at":"2019-02-22T15:55:52Z","author_association":"CONTRIBUTOR","body":"After some internal testing we've decided not to go forward with this approach. We've found that there are some cases where parent directories of the `rootDir` appear in the babel configuration, so any regexp based approach wouldn't work. We could explicitly check the paths we're aware of and use `path.relative` but there are some cases where this wouldn't work either (untyped plugin options, etc.).\r\n\r\nWe were using `babel-jest` so we had support for nested `.babelrc` files. We'll implement a custom transform and get rid of those, so we can:\r\n1. Have a centralized babel configuration that we can use to invalidate the cache when the transform changes.\r\n2. Avoid crawling the file system for each file being processed (even to get the cache key!)\r\n\r\nIf we wanted to fix this in `babel-jest` it'd require banning nested `.babelrc` files and forcing users to use overrides in a single babel configuration we could read once for all files being transformed, but I don't think that's the right thing to do for the general user.\r\n\r\nSorry guys I wasted your time with this one."}}
{"actor":{"display_login":"rubennorte"}}