{"id":16535712,"url":"https://github.com/ninadingole/gotest-ls","last_synced_at":"2025-04-04T20:44:15.570Z","repository":{"id":59046198,"uuid":"532015320","full_name":"ninadingole/gotest-ls","owner":"ninadingole","description":"gotest-ls is a tool to list tests in a Go project. It provides list of all the Tests (Test*, Benchmark*, Example*, Fuzz*) in a Go project or a go file.","archived":false,"fork":false,"pushed_at":"2024-11-25T21:27:58.000Z","size":95,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-10T05:23:46.141Z","etag":null,"topics":["go","golang","gotools","tdd","testing","tools"],"latest_commit_sha":null,"homepage":"","language":"Go","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/ninadingole.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["ninadingole"]}},"created_at":"2022-09-02T17:14:28.000Z","updated_at":"2024-09-18T19:58:51.000Z","dependencies_parsed_at":"2024-06-20T04:17:07.300Z","dependency_job_id":"ff6492b7-25e7-4f09-a827-7273b2c1390b","html_url":"https://github.com/ninadingole/gotest-ls","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ninadingole%2Fgotest-ls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ninadingole%2Fgotest-ls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ninadingole%2Fgotest-ls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ninadingole%2Fgotest-ls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ninadingole","download_url":"https://codeload.github.com/ninadingole/gotest-ls/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249600,"owners_count":20908211,"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":["go","golang","gotools","tdd","testing","tools"],"created_at":"2024-10-11T18:28:38.882Z","updated_at":"2025-04-04T20:44:15.549Z","avatar_url":"https://github.com/ninadingole.png","language":"Go","funding_links":["https://github.com/sponsors/ninadingole"],"categories":[],"sub_categories":[],"readme":"\n## Go List Tests\n![master](https://github.com/ninadingole/gotest-ls/actions/workflows/base.yml/badge.svg?branch=main)\n[![Go Reference](https://pkg.go.dev/badge/github.com/ninadingole/gotest-ls.svg)](https://pkg.go.dev/github.com/ninadingole/gotest-ls)\n[![codecov](https://codecov.io/gh/ninadingole/gotest-ls/branch/main/graph/badge.svg?token=9ZYKWNF6JI)](https://codecov.io/gh/ninadingole/gotest-ls)\n\n`gotest-ls` is a tool to list tests in a Go project. It provides list of all the Tests\n(`Test*`, `Benchmark*`, `Example*`) in a Go project or a go file.\n\nThe tool provides output in JSON format. The output can be used to generate a report or for other tools for analysis.\n\n### Requirements\n- `Go 1.18` or above\n\n### Installation\n\n```bash\ngo install github.com/ninadingole/gotest-ls\n```\n\n### Usage\n\n```bash\ngotest-ls [flags] [directories]\n\ngotest-ls .\ngotest-ls -p ./cmd\ngotest-ls -p ./cmd ./pkg\ngotest-ls -f ./pkg/random_test.go\ngotest-ls -p -f ./pkg/random_test.go\n\n```\n\n### Flags\n\n```bash\n  -h, --help                help for gotest-ls\n  -f, --file    string      file to list tests from\n  -p, --pretty  bool        pretty print the json output\n```\n\n### Output\n\n```bash\n$\u003e gotest-ls -p .                        \n\n[\n\t{\n\t\t\"name\": \"BenchmarkSomething\",\n\t\t\"fileName\": \"benchmark_test.go\",\n\t\t\"relativePath\": \"tests/benchmark_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/tests/benchmark_test.go\",\n\t\t\"line\": 5,\n\t\t\"pos\": 44\n\t},\n\t{\n\t\t\"name\": \"Example_errorIfFileAndDirectoryBothAreProvided\",\n\t\t\"fileName\": \"main_test.go\",\n\t\t\"relativePath\": \"main_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/main_test.go\",\n\t\t\"line\": 36,\n\t\t\"pos\": 2006\n\t},\n\t{\n\t\t\"name\": \"Example_errorIfFileProvidedIsDirectory\",\n\t\t\"fileName\": \"main_test.go\",\n\t\t\"relativePath\": \"main_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/main_test.go\",\n\t\t\"line\": 48,\n\t\t\"pos\": 2335\n\t},\n\t{\n\t\t\"name\": \"Example_something\",\n\t\t\"fileName\": \"example_test.go\",\n\t\t\"relativePath\": \"tests/example_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/tests/example_test.go\",\n\t\t\"line\": 5,\n\t\t\"pos\": 40\n\t},\n\t{\n\t\t\"name\": \"Test/5_+_5_=_10\",\n\t\t\"fileName\": \"table_test.go\",\n\t\t\"relativePath\": \"tests/table_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/tests/table_test.go\",\n\t\t\"line\": 23,\n\t\t\"pos\": 265\n\t},\n\t{\n\t\t\"name\": \"Test/5_-_5_=_0\",\n\t\t\"fileName\": \"table_test.go\",\n\t\t\"relativePath\": \"tests/table_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/tests/table_test.go\",\n\t\t\"line\": 30,\n\t\t\"pos\": 355\n\t},\n\t{\n\t\t\"name\": \"Test/mixed_subtest_1\",\n\t\t\"fileName\": \"table_test.go\",\n\t\t\"relativePath\": \"tests/table_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/tests/table_test.go\",\n\t\t\"line\": 12,\n\t\t\"pos\": 111\n\t},\n\t{\n\t\t\"name\": \"Test/mixed_test_2\",\n\t\t\"fileName\": \"table_test.go\",\n\t\t\"relativePath\": \"tests/table_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/tests/table_test.go\",\n\t\t\"line\": 48,\n\t\t\"pos\": 635\n\t},\n\t{\n\t\t\"name\": \"TestListAllTestsForGivenFile\",\n\t\t\"fileName\": \"main_test.go\",\n\t\t\"relativePath\": \"main_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/main_test.go\",\n\t\t\"line\": 14,\n\t\t\"pos\": 127\n\t},\n\t{\n\t\t\"name\": \"TestSomething\",\n\t\t\"fileName\": \"sample_test.go\",\n\t\t\"relativePath\": \"tests/sample_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/tests/sample_test.go\",\n\t\t\"line\": 7,\n\t\t\"pos\": 49\n\t},\n\t{\n\t\t\"name\": \"Test_List/empty\",\n\t\t\"fileName\": \"list_test.go\",\n\t\t\"relativePath\": \"pkg/list_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/pkg/list_test.go\",\n\t\t\"line\": 25,\n\t\t\"pos\": 357\n\t},\n\t{\n\t\t\"name\": \"Test_List/fail_for_invalid_dir\",\n\t\t\"fileName\": \"list_test.go\",\n\t\t\"relativePath\": \"pkg/list_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/pkg/list_test.go\",\n\t\t\"line\": 58,\n\t\t\"pos\": 1192\n\t},\n\t{\n\t\t\"name\": \"Test_List/fail_to_parse_invalid_test_file\",\n\t\t\"fileName\": \"list_test.go\",\n\t\t\"relativePath\": \"pkg/list_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/pkg/list_test.go\",\n\t\t\"line\": 64,\n\t\t\"pos\": 1328\n\t},\n\t{\n\t\t\"name\": \"Test_List/parse_subtests_correctly\",\n\t\t\"fileName\": \"list_test.go\",\n\t\t\"relativePath\": \"pkg/list_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/pkg/list_test.go\",\n\t\t\"line\": 70,\n\t\t\"pos\": 1500\n\t},\n\t{\n\t\t\"name\": \"Test_List/single_dir\",\n\t\t\"fileName\": \"list_test.go\",\n\t\t\"relativePath\": \"pkg/list_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/pkg/list_test.go\",\n\t\t\"line\": 44,\n\t\t\"pos\": 819\n\t},\n\t{\n\t\t\"name\": \"Test_List/single_file\",\n\t\t\"fileName\": \"list_test.go\",\n\t\t\"relativePath\": \"pkg/list_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/pkg/list_test.go\",\n\t\t\"line\": 30,\n\t\t\"pos\": 437\n\t},\n\t{\n\t\t\"name\": \"Test_process/return_error_if_directory_does_not_exist\",\n\t\t\"fileName\": \"main_test.go\",\n\t\t\"relativePath\": \"main_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/main_test.go\",\n\t\t\"line\": 164,\n\t\t\"pos\": 5681\n\t},\n\t{\n\t\t\"name\": \"Test_process/return_error_if_there_is_no_test_in_the_directory\",\n\t\t\"fileName\": \"main_test.go\",\n\t\t\"relativePath\": \"main_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/main_test.go\",\n\t\t\"line\": 172,\n\t\t\"pos\": 5920\n\t},\n\t{\n\t\t\"name\": \"Test_process/should_also_return_subtests_and_table_tests\",\n\t\t\"fileName\": \"main_test.go\",\n\t\t\"relativePath\": \"main_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/main_test.go\",\n\t\t\"line\": 127,\n\t\t\"pos\": 4167\n\t},\n\t{\n\t\t\"name\": \"Test_process/should_return_error_if_file_and_directory_both_are_provided\",\n\t\t\"fileName\": \"main_test.go\",\n\t\t\"relativePath\": \"main_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/main_test.go\",\n\t\t\"line\": 74,\n\t\t\"pos\": 2872\n\t},\n\t{\n\t\t\"name\": \"Test_process/should_return_error_if_file_provided_is_directory\",\n\t\t\"fileName\": \"main_test.go\",\n\t\t\"relativePath\": \"main_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/main_test.go\",\n\t\t\"line\": 84,\n\t\t\"pos\": 3124\n\t},\n\t{\n\t\t\"name\": \"Test_process/should_return_the_test_details_in_a_file\",\n\t\t\"fileName\": \"main_test.go\",\n\t\t\"relativePath\": \"main_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/main_test.go\",\n\t\t\"line\": 93,\n\t\t\"pos\": 3317\n\t},\n\t{\n\t\t\"name\": \"Test_process/should_return_the_test_details_in_a_file_with_pretty_flag\",\n\t\t\"fileName\": \"main_test.go\",\n\t\t\"relativePath\": \"main_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/main_test.go\",\n\t\t\"line\": 106,\n\t\t\"pos\": 3722\n\t},\n\t{\n\t\t\"name\": \"Test_process/should_show_help_if_no_arguments_are_provided\",\n\t\t\"fileName\": \"main_test.go\",\n\t\t\"relativePath\": \"main_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/main_test.go\",\n\t\t\"line\": 139,\n\t\t\"pos\": 5054\n\t},\n\t{\n\t\t\"name\": \"Test_subTestPattern/subtest\",\n\t\t\"fileName\": \"subtest_test.go\",\n\t\t\"relativePath\": \"tests/subtest_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/tests/subtest_test.go\",\n\t\t\"line\": 10,\n\t\t\"pos\": 121\n\t},\n\t{\n\t\t\"name\": \"Test_subTestPattern/subtest_2\",\n\t\t\"fileName\": \"subtest_test.go\",\n\t\t\"relativePath\": \"tests/subtest_test.go\",\n\t\t\"absolutePath\": \"/www/gotest-ls/tests/subtest_test.go\",\n\t\t\"line\": 15,\n\t\t\"pos\": 193\n\t}\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fninadingole%2Fgotest-ls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fninadingole%2Fgotest-ls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fninadingole%2Fgotest-ls/lists"}