{"id":20082041,"url":"https://github.com/exercism/typescript-test-runner","last_synced_at":"2025-05-06T00:31:31.577Z","repository":{"id":39863248,"uuid":"204976670","full_name":"exercism/typescript-test-runner","owner":"exercism","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-19T03:07:20.000Z","size":2565,"stargazers_count":1,"open_issues_count":0,"forks_count":4,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-29T06:26:58.188Z","etag":null,"topics":["community-contributions-paused","exercism-test-runner","exercism-tooling","maintained-autonomous"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/exercism.png","metadata":{"funding":{"github":["exercism"],"custom":["https://exercism.org/donate"]},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-08-28T16:31:47.000Z","updated_at":"2024-11-19T03:07:23.000Z","dependencies_parsed_at":"2024-05-02T13:38:24.455Z","dependency_job_id":"f99daf11-39d1-4aee-90c7-5ab0ca0d263b","html_url":"https://github.com/exercism/typescript-test-runner","commit_stats":{"total_commits":63,"total_committers":8,"mean_commits":7.875,"dds":0.5873015873015873,"last_synced_commit":"e3bff9ae214155a73fdd02b67935936a7768f65c"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exercism%2Ftypescript-test-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exercism%2Ftypescript-test-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exercism%2Ftypescript-test-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exercism%2Ftypescript-test-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exercism","download_url":"https://codeload.github.com/exercism/typescript-test-runner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252215246,"owners_count":21712934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["community-contributions-paused","exercism-test-runner","exercism-tooling","maintained-autonomous"],"created_at":"2024-11-13T15:41:29.771Z","updated_at":"2025-05-06T00:31:30.941Z","avatar_url":"https://github.com/exercism.png","language":"Shell","funding_links":["https://github.com/sponsors/exercism","https://exercism.org/donate"],"categories":[],"sub_categories":[],"readme":"# Exercism TypeScript Test Runner\n\n[![typescript-test-runner / deploy](https://github.com/exercism/typescript-test-runner/actions/workflows/deploy.yml/badge.svg)](https://github.com/exercism/typescript-test-runner/actions/workflows/deploy.yml) [![typescript-test-runner / main](https://github.com/exercism/typescript-test-runner/actions/workflows/ci.js.yml/badge.svg)](https://github.com/exercism/typescript-test-runner/actions/workflows/ci.js.yml)\n\nThe Docker image for automatically run tests on TypeScript solutions submitted to [exercism][web-exercism].\n\n\u003e At this moment, the input path _must_ be relative to the `package.json` of this respository.\n\u003e `jest` doesn't like running outside of its tree. This might change in the future.\n\n## Installation\n\nClone this repository and then run:\n\n```bash\ncorepack enable yarn\ncorepack yarn install\n```\n\nYou'll need at least Node LTS for this to work.\n\n```\ncorepack yarn build\n```\n\n## Usage\n\nIf you're developing this, you can run this via `yarn` or the provided shell script.\n\n- `.sh` enabled systems (UNIX, WSL): `corepack yarn execute:dev`\n- `.bat` fallback (cmd.exe, Git Bash for Windows): _unsupported_\n\nYou'll want these `:dev` variants because it will _build_ the required code (it will transpile from TypeScript to JavaScript, which is necessary to run this in Node environments, unlike Deno environments).\nWhen on Windows, if you're using Git Bash for Windows or a similar terminal, the `.sh` files will work, but will open a new window (which closes after execution).\nThe `.bat` scripts will work in the same terminal.\nIn this case it might be much easier to run `bin/run.sh` directly, so a new shell won't open.\n\nYou can also manually build using `corepack yarn` or `corepack yarn build`, and then run the script directly: `./bin/run.sh arg1 arg2 arg3`.\n\n## Running the Solution's Tests\n\nTo run a solution's tests, do the following:\n\n1. Open terminal in project's root\n2. Run `./bin/run.sh \u003cexercise-slug\u003e \u003cpath-to-solution-folder\u003e [\u003cpath-to-output-folder\u003e]`\n\nFor example:\n\n```shell\n$ ./bin/run.sh two-fer ./test/fixtures/two-fer/pass\n\nPASS  test/fixtures/two-fer/pass/two-fer.spec.js\nTest Suites: 1 passed, 1 total\nTests:       3 passed, 3 total\nSnapshots:   0 total\nTime:        2.817s\nFind the output at:\ntest/fixtures/two-fer/pass/results.json\n```\n\n## Running the Tests of a Remote Solution\n\nInstead of passing in an `\u003cexercises-slug\u003e` and `\u003cpath-to-solution-folder\u003e`, you can also directly pass in an `https://exercism.io` url, as long as you have the `exercism` CLI installed.\n\nYou can pass the following type of URLs:\n\n- Published solutions: `/tracks/typescript/exercises/\u003cslug\u003e/\u003cid\u003e`\n- Mentor solutions: `/mentor/solutions/\u003cid\u003e`\n- Your solutions: `/my/solutions/\u003cid\u003e`\n- Private solutions: `/solutions/\u003cid\u003e`\n\nFor example:\n\n```\n$ ./bin/run.sh https://exercism.io/my/solutions/c3b826d95cb54441a8f354d7663e9e16\nExercism remote UUID: c3b826d95cb54441a8f354d7663e9e16\n\nDownloaded to\nC:\\Users\\Derk-Jan\\Exercism\\typescript\\clock\nPASS  tmp/clock/c3b826d95cb54441a8f354d7663e9e16/clock/clock.spec.js\nTest Suites: 1 passed, 1 total\nTests:       52 passed, 52 total\nSnapshots:   0 total\nTime:        2.987s\nFind the output at:\n./tmp/clock/c3b826d95cb54441a8f354d7663e9e16/clock/results.json\n```\n\nAs you can see, it will be copied to a local directory.\nIt's up to you to clean-up this directory.\n\n## Running the Solution's Tests in Docker container\n\n_This script is provided for testing purposes_\n\nTo run a solution's test in the Docker container, do the following:\n\n1. Open terminal in project's root\n2. Run `./run-in-docker.sh \u003cexercise-slug\u003e \u003crelative-path-to-solution-folder\u003e`\n\n## Maintaining\n\nThe `package.json` needs to be in-sync with the [`typescript` exercise `package.json`][git-typescript].\n\nEnsure SDKs are installed if using vscode to interopt with Yarn PnP:\n\n```shell\ncorepack yarn dlx @yarnpkg/sdks vscode\n\n➤ YN0000: ┌ Generating SDKs inside .yarn/sdks\n➤ YN0000: │ ✓ Eslint\n➤ YN0000: │ ✓ Prettier\n➤ YN0000: │ ✓ Typescript\n➤ YN0000: │ • 5 SDKs were skipped based on your root dependencies\n➤ YN0000: └ Completed\n➤ YN0000: ┌ Generating settings\n➤ YN0000: │ ✓ Vscode (new ✨)\n➤ YN0000: └ Completed\n```\n\n### Testing\n\nRunning the tests of the test-runner itself can be achieved by using the `test` script from `package.json`.\nThe tests delegate to the _build output_, which is why `corepack yarn test` first calls `corepack yarn build` before running `corepack yarn test:bare`.\n\nYou can run individual test sets:\n\n```shell\n$ corepack yarn node test/skip.test.mjs\n\nskipping via test.skip \u003e passing solution\nassert pass\n```\n\nOr turn on output by setting `SILENT=0`. On Windows (requires Git Bash or similar) that would become:\n\n```shell\n$ corepack yarn dlx cross-env SILENT=0 corepack yarn node test/skip.test.mjs\n\n➤ YN0000: · Yarn 4.3.1\n➤ YN0000: ┌ Resolution step\n➤ YN0085: │ + cross-env@npm:7.0.3, cross-spawn@npm:7.0.3, isexe@npm:2.0.0, path-key@npm:3.1.1, shebang-command@npm:2.0.0, shebang-regex@npm:3.0.0, which@npm:2.0.2\n➤ YN0000: └ Completed\n➤ YN0000: ┌ Fetch step\n➤ YN0000: └ Completed\n➤ YN0000: ┌ Link step\n➤ YN0000: └ Completed\n➤ YN0000: · Done in 0s 232ms\n\nskipping via test.skip \u003e passing solution\n\n╔═════════════════════════════════════════════════════════════╗\n  🔧 Process input arguments for run\n╚═════════════════════════════════════════════════════════════╝\n\n✔️  Using reporter : C:/Users/Derk-Jan/Documents/GitHub/exercism/typescript-test-runner/dist/reporter.js\n✔️  Using test-root: C:/Users/Derk-Jan/Documents/GitHub/exercism/typescript-test-runner/test/fixtures/pythagorean-triplet/chroth7/\n✔️  Using base-root: C:/Users/Derk-Jan/Documents/GitHub/exercism/typescript-test-runner\n✔️  Using setup-env: C:/Users/Derk-Jan/Documents/GitHub/exercism/typescript-test-runner/dist/jest/setup.js\n\n╔═════════════════════════════════════════════════════════════╗\n  🔧 Preparing run\n╚═════════════════════════════════════════════════════════════╝\n\nInput does not match output directory.\n👁️  C:/Users/Derk-Jan/AppData/Local/Temp/foo-xbaeYM/\n✔️  Copying C:/Users/Derk-Jan/Documents/GitHub/exercism/typescript-test-runner/test/fixtures/pythagorean-triplet/chroth7/ to output.\n\nIf the solution contains babel.config.js, package.json,\nor tsconfig.json at the root, these configuration files will\nbe used during the test-runner process which we do not want.\nThe test-runner will therefore temporarily rename these files.\n\n✔️  renaming babel.config.js in output so it can be replaced.\n✔️  renaming package.json in output so it can be replaced.\n✔️  renaming tsconfig.json in output so it can be replaced.\n\nThe output directory is likely not placed inside the test\nrunner root. This means the CLI tools need configuration\nfiles as given and understood by the test-runner for running\nthe tests. Will now turn the output directory into a\nstandalone package.\n\n✔️  .yarn cache from root to output\n✔️  .yarnrc.yml from root to output\n✔️  .yarn.lock from root to output\n✔️  .pnp.cjs from root to output\n✔️  .pnp.loader.mjs from root to output\n✔️  babel.config.js from root to output\n✔️  package.json from root to output\n✔️  tsconfig.json from root to output\n\nThe results of this run will be written to 'results.json'.\n👁️  C:/Users/Derk-Jan/AppData/Local/Temp/foo-xbaeYM/results.json\n\n╔═════════════════════════════════════════════════════════════╗\n  🔧 Preparing test suite file(s)\n╚═════════════════════════════════════════════════════════════╝\n\nThere is a configuration file in the expected .meta location\nwhich will now be used to determine which test files to prep.\n👁️  C:/Users/Derk-Jan/Documents/GitHub/exercism/typescript-test-runner/test/fixtures/pythagorean-triplet/chroth7/.meta/config.json\n{\n  \"blurb\": \"There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product a * b * c.\",\n  \"authors\": [\"mdowds\"],\n  \"contributors\": [\"masters3d\", \"mdmower\", \"SleeplessByte\"],\n  \"files\": {\n    \"solution\": [\"pythagorean-triplet.ts\"],\n    \"test\": [\"pythagorean-triplet.test.ts\"],\n    \"example\": [\".meta/proof.ci.ts\"]\n  },\n  \"source\": \"Problem 9 at Project Euler\",\n  \"source_url\": \"http://projecteuler.net/problem=9\"\n}\n\nEnabling tests in C:/Users/Derk-Jan/AppData/Local/Temp/foo-xbaeYM/pythagorean-triplet.test.ts\n\n╔═════════════════════════════════════════════════════════════╗\n  🔧 Preparing test project\n╚═════════════════════════════════════════════════════════════╝\n\n✔️  enabling corepack\n✔️  yarn version now: 4.3.1\n\n✔️  standalone package found installing packages from cache\n\ntotal 3779\ndrwxr-xr-x 1 197612 197612      0 Jul 31 23:03 .\ndrwxr-xr-x 1 197612 197612      0 Jul 31 23:03 ..\ndrwxr-xr-x 1 197612 197612      0 Jul 31 23:03 .docs\n-rw-r--r-- 1 197612 197612    132 Jul 31 23:03 .eslintignore\n-rw-r--r-- 1 197612 197612    518 Jul 31 23:03 .eslintrc\ndrwxr-xr-x 1 197612 197612      0 Jul 31 23:03 .meta\n-rwxr-xr-x 1 197612 197612 884757 Jul 31 23:03 .pnp.cjs\n-rw-r--r-- 1 197612 197612  73628 Jul 31 23:03 .pnp.loader.mjs\ndrwxr-xr-x 1 197612 197612      0 Jul 31 23:03 .yarn\n-rw-r--r-- 1 197612 197612    235 Jul 31 23:03 .yarnrc.yml\n-rw-r--r-- 1 197612 197612    257 Jul 31 23:03 babel.config.js\n-rw-r--r-- 1 197612 197612    374 Jul 31 23:03 babel.config.js.💥.bak\n-rw-r--r-- 1 197612 197612   2332 Jul 31 23:03 expected_results.json\n-rw-r--r-- 1 197612 197612    407 Jul 31 23:03 jest.config.js\n-rw-r--r-- 1 197612 197612   2182 Jul 31 23:03 package.json\n-rw-r--r-- 1 197612 197612    992 Jul 31 23:03 package.json.💥.bak\n-rw-r--r-- 1 197612 197612   1902 Jul 31 23:03 pythagorean-triplet.test.ts\n-rw-r--r-- 1 197612 197612   1461 Jul 31 23:03 pythagorean-triplet.ts\n-rw-r--r-- 1 197612 197612   2332 Jul 31 23:03 results.json\n-rw-r--r-- 1 197612 197612   1262 Jul 31 23:03 tsconfig.json\n-rw-r--r-- 1 197612 197612    487 Jul 31 23:03 tsconfig.json.💥.bak\n-rw-r--r-- 1 197612 197612 249470 Jul 31 23:03 yarn.lock\n\n➤ YN0000: · Yarn 4.3.1\n➤ YN0000: ┌ Project validation\n➤ YN0090: │ Offline work is enabled; Yarn won't fetch packages from the remote registry if it can avoid it\n➤ YN0000: └ Completed\n➤ YN0000: ┌ Resolution step\n➤ YN0000: └ Completed in 0s 502ms\n➤ YN0000: ┌ Post-resolution validation\n➤ YN0060: │ eslint is listed by your project with version 9.8.0 (pc52f3), which doesn't satisfy what @exercism/eslint-config-tooling and other dependencies request (but they have non-overlapping ranges!).\n➤ YN0002: │ @exercism/typescript-test-runner@workspace:. doesn't provide @babel/core (p9b671), requested by babel-jest.\n➤ YN0086: │ Some peer dependencies are incorrectly met by your project; run yarn explain peer-requirements \u003chash\u003e for details, where \u003chash\u003e is the six-letter p-prefixed code.\n➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.\n➤ YN0000: └ Completed\n➤ YN0000: ┌ Fetch step\n➤ YN0000: └ Completed\n➤ YN0000: ┌ Link step\n➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental\n➤ YN0008: │ core-js@npm:3.37.1 must be rebuilt because its dependency tree changed\n➤ YN0000: └ Completed in 0s 239ms\n➤ YN0000: · Done with warnings in 0s 952ms\n\n╔═════════════════════════════════════════════════════════════╗\n  ➤  Step 1/3: Build (tests: does it compile?)\n╚═════════════════════════════════════════════════════════════╝\n\n✔️  found a tsconfig.json (as expected)\n👁️  C:/Users/Derk-Jan/AppData/Local/Temp/foo-xbaeYM/tsconfig.json\n{\n  \"extends\": \"@tsconfig/node20/tsconfig.json\",\n  \"compilerOptions\": {\n    // Allows you to use the newest syntax, and have access to console.log\n    // https://www.typescriptlang.org/tsconfig#lib\n    \"lib\": [\"ES2020\", \"dom\"],\n    // Make sure typescript is configured to output ESM\n    // https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-make-my-typescript-project-output-esm\n    \"module\": \"Node16\",\n    // Since this project is using babel, TypeScript may target something very\n    // high, and babel will make sure it runs on your local Node version.\n    // https://babeljs.io/docs/en/\n    \"target\": \"ES2020\", // ESLint doesn't support this yet: \"es2022\",\n\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true,\n    \"forceConsistentCasingInFileNames\": true,\n\n    // Because jest-resolve isn't like node resolve, the absolute path must be .ts\n    \"allowImportingTsExtensions\": true,\n    \"noEmit\": true,\n\n    // Because we'll be using babel: ensure that Babel can safely transpile\n    // files in the TypeScript project.\n    //\n    // https://babeljs.io/docs/en/babel-plugin-transform-typescript/#caveats\n    \"isolatedModules\": true\n  },\n  \"exclude\": [\".meta/*\", \"__typetests__/*\", \"*.test.ts\", \"*.tst.ts\"]\n}\n\n⚙️  corepack yarn run tsc\n\n\n✅ tsc compilation success\n\n╔═════════════════════════════════════════════════════════════╗\n  ➤  Step 2/3: Type tests (tests: are the types as expected?)\n╚═════════════════════════════════════════════════════════════╝\n\n✅ no type tests (*.tst.ts) discovered.\n\n╔═════════════════════════════════════════════════════════════╗\n  ➤  Step 3/3: Execution (tests: does the solution work?)\n╚═════════════════════════════════════════════════════════════╝\n\n✔️  jest tests (*.test.ts) discovered.\nC:\\Users\\Derk-Jan\\AppData\\Local\\Temp\\foo-xbaeYM\\pythagorean-triplet.test.ts\n\n⚙️  corepack yarn jest \u003c...\u003e\n\n✅ all tests (*.test.ts) passed.\n\nIf the solution previously contained configuration files,\nthey were disabled and now need to be restored.\n\n✔️  restoring babel.config.js in output\n✔️  restoring package.json in output\n✔️  restoring tsconfig.json in output\n\n---------------------------------------------------------------\nThe results of this run have been written to 'results.json'.\n👁️  C:/Users/Derk-Jan/AppData/Local/Temp/foo-xbaeYM/results.json\n\nassert pass\n```\n\n[web-exercism]: https://exercism.io\n[git-automated-tests]: https://github.com/exercism/automated-tests\n[git-typescript]: https://github.com/exercism/typescript\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexercism%2Ftypescript-test-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexercism%2Ftypescript-test-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexercism%2Ftypescript-test-runner/lists"}