{"id":13647461,"url":"https://github.com/rtfeldman/node-test-runner","last_synced_at":"2025-04-13T20:19:16.165Z","repository":{"id":33384832,"uuid":"37029814","full_name":"rtfeldman/node-test-runner","owner":"rtfeldman","description":"Runs elm-test suites from Node.js. Get it with npm install -g elm-test","archived":false,"fork":false,"pushed_at":"2025-02-15T23:41:41.000Z","size":8527,"stargazers_count":137,"open_issues_count":34,"forks_count":78,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-10T12:00:40.832Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rtfeldman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2015-06-07T19:48:23.000Z","updated_at":"2025-03-26T10:49:33.000Z","dependencies_parsed_at":"2023-01-15T00:41:23.065Z","dependency_job_id":"f61f5d2e-0809-40d1-9b2c-0a4b097eca9f","html_url":"https://github.com/rtfeldman/node-test-runner","commit_stats":{"total_commits":1072,"total_committers":64,"mean_commits":16.75,"dds":"0.42630597014925375","last_synced_commit":"3c18757ad8c4cd7a6b33459588fba14aa41b6b1d"},"previous_names":["rtfeldman/node-elm-test"],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfeldman%2Fnode-test-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfeldman%2Fnode-test-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfeldman%2Fnode-test-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfeldman%2Fnode-test-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtfeldman","download_url":"https://codeload.github.com/rtfeldman/node-test-runner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248775309,"owners_count":21159589,"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":[],"created_at":"2024-08-02T01:03:34.667Z","updated_at":"2025-04-13T20:19:16.132Z","avatar_url":"https://github.com/rtfeldman.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# node-test-runner [![Version](https://img.shields.io/npm/v/elm-test.svg)](https://www.npmjs.com/package/elm-test)\n\nRuns [elm-explorations/test] suites in Node.js.\n\nWhen people say “elm-test” they usually refer to either:\n\n- This CLI tool for running tests.\n- [elm-explorations/test] – an Elm package for defining tests that this CLI tool can run.\n\n[elm-explorations/test]: https://package.elm-lang.org/packages/elm-explorations/test/latest\n\n## Versions\n\nNot all versions of [elm-explorations/test] and this CLI tool work together!\n\n| elm-explorations/test | elm-test CLI         |\n| --------------------- | -------------------- |\n| \u003e= 2.0.0              | \u003e= 0.19.1-revision10 |\n| \u003c= 1.2.2              | \u003c= 0.19.1-revision9  |\n\n\u003e **Unfortunate behavior of 0.19.1-revision9 and older**\n\u003e\n\u003e - `elm-test init` always installs the latest [elm-explorations/test]. This means that if you run `elm-test init` on version 0.19.1-revision9 or older, you will get elm-explorations/test 2.0.0 or later, which don’t work 100 % together (see the next point).\n\u003e - elm-test 0.19.1-revision9 or older do _not_ validate that [elm-explorations/test] in your elm.json has a compatible version. If you upgrade to elm-explorations/test 2.0.0 or later but forget to upgrade the elm-test CLI, most things will still work, but test distribution diagrams (new in elm-explorations/test 2.0.0) won’t show up. So if you use `Test.fuzzWith` and wonder why distribution diagrams never show up – check your elm-test CLI version!\n\u003e - There exists an elm-test CLI version called just \"0.19.1\". It should have been called \"0.19.1-revision1\", but unfortunately isn’t. Don’t make the mistake thinking it’s the latest version! You always want \"0.19.1-revisionX\".\n\n## Installation\n\n```\nnpm install --save-dev elm-test\n```\n\n## Quick start\n\nInstall [elm-explorations/test] and create `tests/Example.elm`:\n\n    npx elm-test init\n\nRun tests in the `tests/` folder:\n\n    npx elm-test\n\nRun tests in one particular file:\n\n    npx elm-test tests/Example.elm\n\nRun tests in files matching a [glob](https://github.com/isaacs/node-glob#glob-primer):\n\n    npx elm-test \"src/**/*Tests.elm\"\n\n\u003e Note: The double quotes are important! Without quotes, your shell might expand the globs for you. With quotes, elm-test expands the globs. This way the watcher can pick up new tests matching the globs, and it will work cross-platform.\n\nRun in watch mode:\n\n    npx elm-test --watch\n\n## Where to put tests\n\n### Locating files containing tests\n\nThere are 3 places you could put your tests:\n\n1.  In the `tests/` folder.\n\n    This is the default and requires no extra setup.\n\n2.  In any source directory (`\"source-directories\"` in `elm.json` for applications, `src/` for packages) as separate files.\n\n    A convention is to put test files next to the file it tests with a `Tests` suffix. For example, you could have `src/LoginForm.elm` and `src/LoginFormTests.elm`.\n\n    This requires telling elm-test which folders/files to run. Examples:\n\n        npx elm-test \"src/**/*Tests.elm\"\n        npx elm-test test/frontend/elm\n\n    You might also need to configure your editor to understand that the `\"test-dependencies\"` in your `elm.json` are available in these files.\n\n3.  In already existing source files.\n\n    This allows testing internal functions without exposing them. (Be aware that testing implementation details can sometimes be counter-productive.)\n\n    This requires moving everything in `\"test-dependencies\"` in your `elm.json` into regular `\"dependencies\"`, so your project still compiles. This also helps your editor. Note that this approach isn’t suitable for packages, since you don’t want your package to unnecessarily depend on [elm-explorations/test].\n\nYou can mix all three variants if you want:\n\n    npx elm-test tests \"src/**/*Tests.elm\" app\n\n\u003e In this example, `\"src\"` and `\"app\"` need to be in `\"source-directories\"` in `elm.json`.\n\n### Locating tests within files\n\nFor elm-test to find tests in your files you need to:\n\n1. Create top-level values of the type [Test](https://package.elm-lang.org/packages/elm-explorations/test/latest/Test#Test). You can name the values anything – the only thing that matters is that their type is `Test`.\n2. Expose them.\n\nExample:\n\n```elm\nmodule LoginForm exposing (alreadyLoggedInTests, tests)\n\nimport Test exposing (Test)\n\n\ntests : Test\ntests =\n    -- ...\n\n\nalreadyLoggedInTests : Test\nalreadyLoggedInTests =\n    -- ...\n```\n\nSome prefer to expose a single `Test` value and group everything using [describe](https://package.elm-lang.org/packages/elm-explorations/test/latest/Test#describe). Some prefer to expose several `Test` values.\n\n**Also check out the [elm-explorations/test quick-start](https://github.com/elm-explorations/test#quick-start) guide!**\n\n## Command Line Arguments\n\nThese are the most common commands and flags. Run `elm-test --help` for an exhaustive list.\n\n**Note:** Throughout this section, the `npx` prefix is omitted for brevity.\n\n### install\n\nLike `elm install`, except elm-test will install to `\"test-dependencies\"` in your `elm.json` instead of to `\"dependencies\"`.\n\n    elm-test install elm/regex\n\n### init\n\nRuns `elm-test install elm-explorations/test` and then creates a `tests/Example.elm` example test to get you started.\n\n`elm-test init` requires an `elm.json` file up the directory tree, so you will need to run `elm init` first if you don’t already have one.\n\nAfter initializing elm-test in your project, try out the example by running `elm-test` with no arguments.\n\n    elm init\n    elm-test init\n    elm-test\n\n### --watch\n\nStart the runner in watch mode. Your tests will automatically rerun whenever your project changes.\n\n    elm-test --watch\n\n### --seed\n\nRun with a specific fuzzer seed, rather than a randomly generated seed. This allows reproducing a failing fuzz-test. The command needed to reproduce (including the `--seed` flag) is printed after each test run. Copy, paste and run it!\n\n    elm-test --seed 336948560956134\n\n### --fuzz\n\nDefine how many times each fuzz-test should run. Defaults to `100`.\n\n    elm-test --fuzz 500\n\n### --report\n\nSpecify which format to use for reporting test results. Valid options are:\n\n- `console` (default): pretty, human readable formatted output.\n- `json`: newline-delimited json with an object for each event.\n- `junit`: junit-compatible xml.\n\n```\nelm-test --report json\n```\n\n### --no-color\n\nDisable colored console output.\n\nColors are also disabled when you pipe the output of `elm-test` to another program. You can use `--color` to force the colors back.\n\nAlternatively, you can set the environment variable `FORCE_COLOR` to `0` to disable colors, or to any other value to force them.\n\nSee [chalk.supportsColor](https://github.com/chalk/chalk#chalksupportscolor) for more information.\n\n### --compiler\n\nIf `elm` is _not_ in your `$PATH` when elm-test runs, or the Elm executable is called something other than `elm`, you can use this flag to point to your installation.\n\n    elm-test --compiler /path/to/elm\n\nTo run a tool installed locally using `npm` you can use `npx`:\n\n    npx elm-test\n\n`npx` adds the local `node_modules/.bin/` folder to `$PATH` when it executes the command passed to it. This means that if you have installed `elm` locally, `elm-test` will automatically find that local installation.\n\nAs mentioned in [Installation](#installation) we recommend installing elm-test locally in every project. This ensures all contributors and CI use the same version, to avoid nasty “works on my computer” issues.\n\n## Travis CI\n\nIf you want to run your tests on Travis CI, [here's a good starter `.travis.yml`](https://docs.travis-ci.com/user/languages/elm/):\n\n```yml\nlanguage: elm\nelm:\n  - 0.19.1\n```\n\nHere is an example [`travis.yml`](https://github.com/rtfeldman/elm-css/blob/master/.travis.yml) configuration file for running tests in CI.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtfeldman%2Fnode-test-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtfeldman%2Fnode-test-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtfeldman%2Fnode-test-runner/lists"}