{"id":16987889,"url":"https://github.com/timfjord/anytest","last_synced_at":"2025-04-12T03:41:34.822Z","repository":{"id":39971277,"uuid":"399114187","full_name":"timfjord/AnyTest","owner":"timfjord","description":"Run any test from Sublime Text","archived":false,"fork":false,"pushed_at":"2024-03-04T13:19:35.000Z","size":237,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T23:14:59.469Z","etag":null,"topics":["cucumber","elixir","exunit","go","java","javascript","jest","minitest","pytest","python","pyunit","rspec","ruby","rust","sublime-text","swift","test-runner","testing","testing-tools","zig"],"latest_commit_sha":null,"homepage":"","language":"Python","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/timfjord.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}},"created_at":"2021-08-23T13:28:24.000Z","updated_at":"2024-12-26T02:00:02.000Z","dependencies_parsed_at":"2024-03-04T12:50:52.348Z","dependency_job_id":"ea241b85-73af-463b-a7bb-e3b25b41f750","html_url":"https://github.com/timfjord/AnyTest","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timfjord%2FAnyTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timfjord%2FAnyTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timfjord%2FAnyTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timfjord%2FAnyTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timfjord","download_url":"https://codeload.github.com/timfjord/AnyTest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514221,"owners_count":21116899,"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":["cucumber","elixir","exunit","go","java","javascript","jest","minitest","pytest","python","pyunit","rspec","ruby","rust","sublime-text","swift","test-runner","testing","testing-tools","zig"],"created_at":"2024-10-14T02:51:00.570Z","updated_at":"2025-04-12T03:41:34.795Z","avatar_url":"https://github.com/timfjord.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable --\u003e\n[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://stand-with-ukraine.pp.ua)\n\n# AnyTest [![Lint](https://github.com/timfjord/AnyTest/actions/workflows/lint.yml/badge.svg)](https://github.com/timfjord/AnyTest/actions/workflows/lint.yml) [![Test](https://github.com/timfjord/AnyTest/actions/workflows/test.yml/badge.svg)](https://github.com/timfjord/AnyTest/actions/workflows/test.yml)\n\u003c!-- markdownlint-enable --\u003e\nRun any test from Sublime Text\n\nA Sublime Text 3/4 package whose main idea is to automatically detect a test framework for the given file and run it. It is a Sublime Text interpretation of the awesome [vim-test](https://github.com/vim-test/vim-test) plugin.\n\nCurrently, the following test frameworks are supported (more test frameworks are coming soon):\n\n|       Language | Test framework                                                     | Identifiers                                                      |\n|---------------:|:-------------------------------------------------------------------|:-----------------------------------------------------------------|\n|     **Elixir** | ESpec, ExUnit                                                      | `espec`, `exunit`                                                |\n|         **Go** | Delve, Ginkgo, Gotest                                              | `delve`, `ginkgo`, `gotest`                                      |\n|       **Java** | JUnit (with Maven or Gradle)                                       | `junit`                                                          |\n| **JavaScript** | Jest, Mocha, Vitest                                                | `jest`, `mocha`, `vitest`                                        |\n|     **Python** | Behave, Django(including Nose), Mamba, Nose, Nose2, PyTest, PyUnit | `behave`, `django`, `mamba`, `nose`, `nose2`, `pytest`, `pyunit` |\n|       **Ruby** | Cucumber, M, Minitest, Rails, RSpec, Test Bench                    | `cucumber`, `m` ,`minitest`, `rails`, `rspec`, `test_bench`      |\n|       **Rust** | Cargo                                                              | `cargotest`                                                      |\n|     **Switft** | XCTest                                                             | `xctest`                                                         |\n|     **Zig**    | Zigtest                                                            | `zigtest`                                                        |\n\nFeel free to [open an issue](https://github.com/timfjord/AnyTest/issues/new) with a test framework request as those test frameworks will be added first.\n\n## Installation\n\n1. Install the [Sublime Text Package Control](https://packagecontrol.io/) package if you don't have it already.\n2. Open the command palette and start typing `Package Control: Install Package`.\n3. Enter `AnyTest`.\n\n## Usage\n\nThe main command that the package exposes is `any_test_run`. It supports 4 scopes:\n\n### • suite scope\n\n```json\n{ \"command\": \"any_test_run\", \"args\": { \"scope\": \"suite\" } }\n```\n\nor `AnyTest: Test suite` in the command palette.\n\nRuns the whole test suite (based on the current file)\n\n### • file scope\n\n```json\n{ \"command\": \"any_test_run\", \"args\": { \"scope\": \"file\" } }\n```\n\nor `AnyTest: Test file` in the command palette.\n\nRuns all tests in the current file\n\n### • line scope\n\n```json\n{ \"command\": \"any_test_run\", \"args\": { \"scope\": \"line\" } }\n```\n\nor `AnyTest: Test line` in the command palette.\n\nRuns the test nearest to the current line(cursor)\n\n### • last scope\n\n```json\n{ \"command\": \"any_test_run\", \"args\": { \"scope\": \"last\" } }\n```\n\nor `AnyTest: Test last` in the command palette.\n\nRuns the last test\n\nThe package tries to detect a test framework based on the current file.\nWhen the framework is detected the package generates a command and runs it using the selected runner.  \nWhen the `edit` flag is passed to `true` then the command can be edited before running.  \nAnd finally, if the `select` flag is passed to `true` then the auto-detection feature is bypassed\nand the quick panel with all available test frameworks is shown allowing to select a test framework manually.\n\nThe package keeps the 10 last test commands in history that can be accessed with the `AnyTest: Show history` command.  \nThe history can be cleared with the `AnyTest: Clear history` command.\n\nThe package comes with polyfills for test frameworks that don't have built-in support for running tests for the current line.  \nAll the polyfills have been borrowed from the `vim-test` plugin and adapted for Sublime Text.\n\nAll the package commands can be found in [Default.sublime-commands](https://github.com/timfjord/AnyTest/blob/main/Default.sublime-commands)\n\nBy default the package doesn't define any key bindings, run `Preferences: AnyTest Key Bindings` to define your own bindings.\n\n## Configuration\n\nThe package can be configured either globally or at the project level.\nSettings defined at the project level override settings defined globally.\n\nTo configure the package at the project level all settings must be added under the `AnyTest` namespace:\n\n```json\n{\n  \"folders\": [\n    {\n      \"path\": \".\",\n    }\n  ],\n  \"settings\": {\n    \"AnyTest\": {\n      \"test_frameworks\": {\n        \"python\": \"pyunit\"\n      },\n      \"python.pyunit.runner\": \"unittesting\"\n    }\n  }\n}\n```\n\nThe package provides schemas for its settings so it is recommended to install [LSP-json](https://github.com/sublimelsp/LSP-json) to have settings autocomplete.\n\nTo see all available settings please check [AnyTest.sublime-settings](https://github.com/timfjord/AnyTest/blob/main/AnyTest.sublime-settings)\n\nBy default, the package iterates through all available test frameworks to detect the one to use.\nThis can be changed with the `test_frameworks` setting:\n\n```json\n\"test_frameworks\": {\n  \"python\": \"pyunit\"\n}\n```\n\nor\n\n```json\n\"test_frameworks\": {\n  \"python\": [\"pyunit\", \"pytest\"]\n}\n```\n\nthis way all other test frameworks will be ignored.\n\nAlso, some languages support specifying test frameworks, for example\n\n```json\n\"python.test_framework\": \"pytest\"\n```\n\nThis won't change the detection process, but if there are multiple candidates the specified one will be used.\n\n### Project folders and subprojects\n\nThe package supports multiple project folders. It can be very useful when there is a nested folder\nthat contains a separate project. The package can detect this situation and calculate the root path correctly.\n\nAnother way to handle nested projects is to use the `subprojects` settings (usually in the project config)\n\n```json\n{\n  \"folders\": [\n    {\n      \"path\": \".\",\n    }\n  ],\n  \"settings\": {\n    \"AnyTest\": {\n      \"subprojects\": [\n        \"subfolder1/subfolder1_1\",\n        [\"subfolder2\", \"subfolder2_1\"]\n      ]\n    }\n  }\n}\n```\n\nA subproject can be either a string or an array of strings(the path separator will be added automatically).\n\n## Runners\n\nThe package comes with 3 runners:\n\n- `command`\n- `terminus`\n- `console`\n\nThe default runner is the `command`. It uses the built-in Sublime `exec` command(the command can be configured) to run the test command.  \nThe `command` runner is a bit limited so it is recommended to install [Terminus](https://github.com/randy3k/Terminus) package and use the `terminus` runner instead.\n\nThe `console` runner is mostly used for testing/debugging as its main purpose is to output the test command and metadata to the console.\n\nRunners can be activated globally, per language or framework:\n\n```json\n\"runner\": \"terminus\",\n\"python.runner\": \"command\",\n\"python.pyunit.runner\": \"unittesting\"\n```\n\nPlease consult with [AnyTest.sublime-settings](https://github.com/timfjord/AnyTest/blob/main/AnyTest.sublime-settings) to check all available settings.\n\nThere is also the `unittesting` runner and it should be used to test sublime packages with [UnitTesting](https://github.com/SublimeText/UnitTesting).  \nUnfortunately, due to `UnitTesting` limitations, there is no way to run tests for the current line.  \nUsing `unittesting` only makes sense with PyUnit test framework, so it is usually activated as:\n\n```json\n\"python.pyunit.runner\": \"unittesting\"\n```\n\n## Roadmap\n\n- Add more test frameworks (the end goal is to at least support all the test frameworks that `vim-test` supports)\n- Run tests from the Side Bar (including testing folders)\n- Potentially integrate the package with [Sublime Debugger](https://github.com/daveleroy/sublime_debugger)\n\n## Contribution\n\nThe easiest way to add a new test framework is to find it in [the `vim-test` repository](https://github.com/vim-test/vim-test/tree/master/autoload/test) and try to adapt it.  \nIt is also required to cover the test frameworks with tests. Tests and fixtures can be also found in [the `vim-test` repository](https://github.com/vim-test/vim-test/tree/master/spec)\n\nThe package uses `black`, `flake8` and `isort` for linting.\n\n## Credits\n\n`AnyTest` is heavily inspired by the [vim-test](https://github.com/vim-test/vim-test) plugin so all credits go to the authors and maintainers of this awesome Vim plugin.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimfjord%2Fanytest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimfjord%2Fanytest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimfjord%2Fanytest/lists"}