Conversation
This comment has been minimized.
This comment has been minimized.
|
If you apply this patch, it should work: diff --git a/lib/run-tests/babel-agent.js b/lib/run-tests/babel-agent.js
index 7a95cb0..b7304f3 100644
--- a/lib/run-tests/babel-agent.js
+++ b/lib/run-tests/babel-agent.js
@@ -8,11 +8,11 @@ const transpile = require("./transpile");
const CORE_JS = require.resolve("core-js-bundle");
const REGENERATOR = require.resolve("regenerator-runtime/runtime");
-const INTL = require.resolve('./intl-polyfill');
+const INTL = require.resolve("intl/dist/Intl");
const POLYFILLS = `[
fs.readFileSync(${JSON.stringify(CORE_JS)}, "utf8"),
fs.readFileSync(${JSON.stringify(REGENERATOR)}, "utf8"),
- fs.readFileSync(${JSON.stringify(INTL)}, "utf8")
+ "self = window = this;" + fs.readFileSync(${JSON.stringify(INTL)}, "utf8") + "; delete self; delete window;"
]`;The problem is that Note that the intl polyfill is far from being spec compliant: I would prefer to simply skip those tests. Also, as I explained on Slack, |
|
while I have a PR open, I wanted to ask some help from @rwaldron regarding failures like: in https://app.circleci.com/jobs/github/babel/babel/11859/tests Here's how Test262Stream is currently initialized: https://github.com/babel/babel-test262-runner/blob/master/lib/run-tests/index.js#L23 cc. @leobalter, @jugglinmike or someone who might know. |
|
When I use a custom const agent = new BabelAgent({ hostPath });To: const agent = new BabelAgent({ hostPath, shortName: '$262' });... That will eliminate the error you reported above. In the meantime, I'm going to work on making that the default identifier used in all built-in runtimes. I've noticed that this approach will transpile the harness code as well, which is probably not a problem in practice, but I wouldn't consider the results of this runner to be valid Test262 conformance tests, because that's a violation of the versioned host requirements defined in INTERPRETING.md. |
Isn't that expected? "Evaluate this code using Babel" means "Transpile this code using Babel, and then evaluate it using the underlying engine". I don't see why the harness code should be evaluated differently. |
4c2e00d to
7d85817
Compare
| module.exports = function shouldIgnore(test) { | ||
| if (test.file.startsWith("test/intl402")) return true; | ||
| if (test.attrs.features && test.attrs.features.includes("Proxy")) return true; | ||
| if (!test.file.startsWith("test/language")) return true; |
There was a problem hiding this comment.
Hopefully this will make the test suite a lot faster.
There was a problem hiding this comment.
I know right! I was thinking the same thing!
I wouldn't expect that at all. I would expect Babel to transpile only the test source itself. Other host runtimes don't modify the harness code, so why should Babel? |
|
They handle harness code exactly like they handle tests code: they execute it. |
|
The interpreting guidelines allow only very specific modifications to any code (harness code or test code). Babel's transformations aren't endorsed. I'm guessing that modifying the guidelines to allow Babel's usage would be kind of tricky. Given that Babel ultimately relies on a traditional runtime to actually evaluate code, it might not be possible to really call Babel "conforming" in the strict official TC39 sense. That distinction isn't necessary for Babel and its users to benefit from Test262, so it might be best to let it go until there's some dispute about correctness. |
Summary of changes
chalkas a dependency.