{"id":15409395,"url":"https://github.com/lahma/test262-harness-dotnet","last_synced_at":"2026-04-25T16:02:43.129Z","repository":{"id":39755675,"uuid":"427596049","full_name":"lahma/test262-harness-dotnet","owner":"lahma","description":"A .NET version of test262 ECMAScript test harness","archived":false,"fork":false,"pushed_at":"2026-04-20T17:23:01.000Z","size":252,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-20T19:28:51.818Z","etag":null,"topics":["ecmascript","javascript","test-automation","test-framework"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lahma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-11-13T07:17:17.000Z","updated_at":"2026-04-20T17:23:04.000Z","dependencies_parsed_at":"2026-02-19T23:01:19.196Z","dependency_job_id":null,"html_url":"https://github.com/lahma/test262-harness-dotnet","commit_stats":{"total_commits":88,"total_committers":2,"mean_commits":44.0,"dds":0.375,"last_synced_commit":"f5772b1340609f08ba6c87096ce04001f3f8cf12"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/lahma/test262-harness-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lahma%2Ftest262-harness-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lahma%2Ftest262-harness-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lahma%2Ftest262-harness-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lahma%2Ftest262-harness-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lahma","download_url":"https://codeload.github.com/lahma/test262-harness-dotnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lahma%2Ftest262-harness-dotnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32266039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T09:15:33.318Z","status":"ssl_error","status_checked_at":"2026-04-25T09:15:31.997Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ecmascript","javascript","test-automation","test-framework"],"created_at":"2024-10-01T16:39:34.975Z","updated_at":"2026-04-25T16:02:43.097Z","avatar_url":"https://github.com/lahma.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build](https://github.com/lahma/test262-harness-dotnet/actions/workflows/build.yml/badge.svg)](https://github.com/sebastienros/jint/actions/workflows/build.yml)\n[![NuGet](https://img.shields.io/nuget/v/Test262Harness.svg)](https://www.nuget.org/packages/Test262Harness)\n[![NuGet](https://img.shields.io/nuget/vpre/Test262Harness.svg)](https://www.nuget.org/packages/Test262Harness)\n[![MyGet](https://img.shields.io/myget/test262harness/vpre/Test262Harness.svg?label=MyGet)](https://www.myget.org/feed/test262harness/package/nuget/Test262Harness)\n\n# Test262-Harness-dotnet\n\nThis is a .NET test runner for Test262: [ECMAScript Test Suite](https://github.com/tc39/test262).\nIt includes parsing and downloading logic for the test suite in package Test262Harness and test suite\ngenerator functionality via CLI too, Test262Harness.Console\n\n## Usage\n\nFollowing projects are utilizing the test suite generation and show how to create NUnit based test suite\nthat is being generated by downloaded snapshot from test262 GitHub repository.\n\n* [Jint](https://github.com/sebastienros/jint/tree/main/Jint.Tests.Test262)\n  * Generates NUnit test suite to ensure compliance, suite can be run in parallel for faster feedback loop\n* [esprima-dotnet](https://github.com/sebastienros/esprima-dotnet/tree/main/test/Esprima.Tests.Test262)\n  * Generates NUnit test suite for parsing tests, also has [custom console logic](https://github.com/sebastienros/esprima-dotnet/blob/main/test/Esprima.Tests.Test262/Program.cs) to compare allow-list.txt for problematic files and progress getting the to parse properly \n* [acornima](https://github.com/adams85/acornima/tree/master/test/Acornima.Tests.Test262)\n  * Generates NUnit test suite for parsing tests\n\nFirst you need need to install the required package to your test project, it should look similar to this:\n\n````xml\n  \u003cItemGroup\u003e\n    \u003cPackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"17.9.0\" /\u003e\n    \u003cPackageReference Include=\"NUnit\" Version=\"4.0.1\" /\u003e\n    \u003cPackageReference Include=\"NUnit3TestAdapter\" Version=\"4.5.0\" /\u003e\n    \u003cPackageReference Include=\"Test262Harness\" Version=\"1.0.0\" /\u003e\n  \u003c/ItemGroup\u003e\n````\n\nNext you will need a configuration, similar to this (also check the configuration format section):\n\n__Test262Harness.settings.json example__\n```json5\n{\n  \"SuiteGitSha\": \"28b31c0bf1960878abb36ab8597a0cae224a684d\",\n  \"TargetPath\": \"./Generated\",\n  \"Namespace\": \"My.Tests.Test262\",\n  \"ExcludedFeatures\": [\n    \"Atomics\",\n    \"Temporal\"\n  ],\n  \"ExcludedFlags\": [\n    \"async\" \n  ],\n  \"ExcludedDirectories\": [\n    \"annexB\",\n    \"intl402\"\n  ],\n  \"ExcludedFiles\": [\n    \"language/expressions/object/dstr-async-gen-meth-*\",\n    \"language/expressions/assignment/fn-name-lhs-cover.js\"\n  ]\n}\n```\n\nYou need to create minimal test file stub to initialize your testing target, example from Jint project.\n\n```c#\nusing System;\nusing System.IO;\nusing Esprima;\nusing Jint.Native;\nusing Jint.Native.ArrayBuffer;\nusing Jint.Runtime;\nusing Jint.Runtime.Descriptors;\nusing Jint.Runtime.Interop;\nusing Test262Harness;\n\nnamespace Jint.Tests.Test262;\n\npublic static partial class State\n{\n    /// \u003csummary\u003e\n    /// Pre-compiled scripts for faster execution.\n    /// \u003c/summary\u003e\n    public static readonly Dictionary\u003cstring, Script\u003e Sources = new(StringComparer.OrdinalIgnoreCase);\n}\n\n/// \u003csummary\u003e\n/// Handles initializing testing state.\n/// \u003c/summary\u003e\npublic partial class TestHarness\n{\n    private static partial Task InitializeCustomState()\n    {\n        foreach (var file in State.HarnessFiles)\n        {\n            var source = file.Program;\n            State.Sources[Path.GetFileName(file.FileName)] = new JavaScriptParser(source, new ParserOptions(file.FileName)).ParseScript();\n        }\n\n        return Task.CompletedTask;\n    }\n}\n\npublic abstract partial class Test262Test\n{\n    private Engine BuildTestExecutor(Test262File file)\n    {\n        var engine = new Engine(cfg =\u003e\n        {\n            var relativePath = Path.GetDirectoryName(file.FileName);\n            cfg.EnableModules(new Test262ModuleLoader(State.Test262Stream.Options.FileSystem, relativePath));\n        });\n\n        if (file.Flags.Contains(\"raw\"))\n        {\n            // nothing should be loaded\n            return engine;\n        }\n\n        engine.Execute(State.Sources[\"assert.js\"]);\n        engine.Execute(State.Sources[\"sta.js\"]);\n\n        // initialize engine with Test262 expected host defined functions here\n        // https://github.com/tc39/test262/blob/main/INTERPRETING.md#host-defined-functions\n\n        engine.SetValue(\"print\", new ClrFunction(engine, \"print\", (_, args) =\u003e TypeConverter.ToString(args.At(0))));\n        // and more...\n\n        // the cinded files that that are expected\n        foreach (var include in file.Includes)\n        {\n            engine.Execute(State.Sources[include]);\n        }\n\n        return engine;\n    }\n\n    private static void ExecuteTest(Engine engine, Test262File file)\n    {\n        if (file.Type == ProgramType.Module)\n        {\n            engine.AddModule(file.FileName, builder =\u003e builder.AddSource(file.Program));\n            engine.ImportModule(file.FileName);\n        }\n        else\n        {\n            engine.Execute(new JavaScriptParser(file.Program, new ParserOptions(file.FileName)).ParseScript());\n        }\n    }\n\n    private partial bool ShouldThrow(Test262File testCase, bool strict)\n    {\n        return testCase.Negative;\n    }\n}\n```\n\n\nAnd also the CLI tool for generating the test suite, run this in you test project directory.\n\n`dotnet tool add Test262Harness.Console`\n\nWhen everything is installed, you should be able to run:\n\n```\ndotnet tool restore\ndotnet test262 generate\n```\n\n## Test262Harness.settings.json configuration file\n\nList of most important things you can tweak in configuration file:\n\n| Key                 | Default                  | Description                                                                                          |\n|:--------------------|:-------------------------|------------------------------------------------------------------------------------------------------|\n| SuiteGitSha         | none                     | The GitHub commit to use when downloading the test suite                                             |\n| SuiteDirectory      | none                     | Alternatively, you can point to local repository root                                                |\n| TargetPath          | none                     | Where to generate the file to                                                                        |\n| Namespace           | Test262Harness.TestSuite | Namespace for the generated source files                                                             |\n| ExcludedFeatures    | []                       | Any [feature](https://github.com/tc39/test262/blob/main/CONTRIBUTING.md#features) you want to ignore |\n| ExcludedFlags       | []                       | Any [flag](https://github.com/tc39/test262/blob/main/CONTRIBUTING.md#flags) you want to ignore       |\n| ExcludedDirectories | []                       | Any sub-directory you would like to ignore, for example annexB                                       |\n| ExcludedFiles       | []                       | List of specific files you would like to ignore                                                      | \n\nExclusion maps to setting `[Ignore]` attribute in test suite.\n\n\n## Branches and releases\n\n- The recommended branch is __main__, any PR should target this branch\n- The __main__ branch is automatically built and published on [MyGet](https://www.myget.org/feed/Packages/Test262Harness). Add this feed to your NuGet sources to use it: https://www.myget.org/F/test262harness/api/v3/index.json\n- The __main__ branch is occasionally published on [NuGet](https://www.nuget.org/packages/Test262Harness)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flahma%2Ftest262-harness-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flahma%2Ftest262-harness-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flahma%2Ftest262-harness-dotnet/lists"}