-
-
Notifications
You must be signed in to change notification settings - Fork 8
Add running result cache #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I realized that we were actually not running some module tests correctly because the imported modules were not transformed. We may be able to merge this PR to facilitate adding a CI for Babel 8. |
| const cacheKey = sha1(JSON.stringify({ attrs, file })); | ||
|
|
||
| try { | ||
| contents = transpile(contents, { features: attrs.features, isModule, isStrict: false }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isStrict: false Is this a bug?
| function buildCacheHash(test) { | ||
| let { phase = "", type = "" } = test.attrs.negative || {}; | ||
| if ((phase === "early" || phase === "parse") && type === "SyntaxError") { | ||
| return sha1(test.contents); | ||
| } | ||
| const sources = dependencies | ||
| .getDependencies(test.file) | ||
| .sort() | ||
| .map(function (file) { | ||
| if (file === path.basename(test.file)) { | ||
| return; | ||
| } | ||
| return dependencies.rawSource.get(path.basename(file)); | ||
| }) | ||
| .filter(Boolean); | ||
|
|
||
| sources.push(test.contents); | ||
|
|
||
| return sha1(sources.join("\n")); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it uses the same method as eshost to get dependencies, which is safe enough to merge. :)
Compilation results are not cached, which ensures that Babel changes are reflected in a timely manner.
There is a simple list to skip caching for tests that use other files.