Support running test262 using Jint.Repl#2326
Merged
Merged
Conversation
lahma
requested changes
Mar 15, 2026
lahma
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the PR, nice addition. Comment about unnecessary public type.
Collaborator
|
@ivankra can you please rebase this againt main and consider just sharing via csproj linking. Let me know when you feel PR is good to go from your part. |
So that it can be used to run test262 test suite via an external tester like eshost + test262-harness. Extracted out Test262Object.cs from Jint.Tests.Test262/Test262Test.cs and moved it together with Test262AgentManager.cs to Jint/ so that they could be used in both Jint.Repl and Jint.Tests.Test262. Both classes are internal and rely on some engine internals as well. Made visible to Jint.Repl via Jint/AssemblyInfoExtras.cs, similarly to how it was already done for Jint.Tests.Test262.
Needed for running test262 via an external tester to properly support
negative test cases - they prescribe checking exception type.
Testing:
$ echo x | ./Jint.Repl
Uncaught exception: ReferenceError: x is not defined
at stdin:1:1
$ echo 'function Test262Error(){}; throw new Test262Error();' | ./dist/Jint.Repl
Uncaught exception: Test262Error
at stdin:1:29
Needed for running test262's module tests via an external tester.
Automatically set it if file has .mjs extension (d8/node convention).
Testing:
$ echo 'import { f } from "./b.js"; console.log(f("hel", "lo"));' >a.js
$ echo 'export const f = (a, b) => a + b;' >b.js
$ ./Jint.Repl -m a.js
hello
$ ./Jint.Repl a.js
Uncaught exception: SyntaxError: Cannot use import statement outside a module (a.js:1:1)
Contributor
Author
|
Sorry for late reply, I rebased now. I think it's in a good state now. I fixed a couple things since the original PR:
I explored linking via csproj and leaving the Test262* files in Jint.Tests.Test262, but they reference some engine internals, so looks like I need to add that internal visibility bit for Jint.Repl anyway: |
This was referenced Mar 23, 2026
This was referenced Jun 8, 2026
This was referenced Jun 29, 2026
This was referenced Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add $262 object, --module flag and printing of exception type to Jint.Repl so that it can be used to run test262 test suite via an external tester like eshost + test262-harness.