{"id":15107002,"url":"https://github.com/udibo/test_suite","last_synced_at":"2025-09-27T05:31:35.262Z","repository":{"id":42482236,"uuid":"286380546","full_name":"udibo/test_suite","owner":"udibo","description":"An extension of Deno's built-in test runner to add setup/teardown hooks and make it easier to organize tests in a format similar to Jasmine, Jest, and Mocha.","archived":true,"fork":false,"pushed_at":"2022-04-17T18:09:52.000Z","size":258,"stargazers_count":27,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-17T02:32:39.677Z","etag":null,"topics":["deno","describe","hooks","it","jasmine","jest","mocha","setup","teardown","test","test-runner","test-suite"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/udibo.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}},"created_at":"2020-08-10T05:03:24.000Z","updated_at":"2023-07-22T01:54:48.000Z","dependencies_parsed_at":"2022-09-03T08:23:39.446Z","dependency_job_id":null,"html_url":"https://github.com/udibo/test_suite","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udibo%2Ftest_suite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udibo%2Ftest_suite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udibo%2Ftest_suite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udibo%2Ftest_suite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/udibo","download_url":"https://codeload.github.com/udibo/test_suite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234286149,"owners_count":18808433,"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":["deno","describe","hooks","it","jasmine","jest","mocha","setup","teardown","test","test-runner","test-suite"],"created_at":"2024-09-25T21:03:49.434Z","updated_at":"2025-09-27T05:31:30.006Z","avatar_url":"https://github.com/udibo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Test Suite\n\n[![version](https://img.shields.io/badge/release-0.16.1-success)](https://deno.land/x/test_suite@0.16.1)\n[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/test_suite@0.16.1/mod.ts)\n[![CI](https://github.com/udibo/test_suite/workflows/CI/badge.svg)](https://github.com/udibo/test_suite/actions?query=workflow%3ACI)\n[![codecov](https://codecov.io/gh/udibo/test_suite/branch/main/graph/badge.svg?token=EFKGY72AAV)](https://codecov.io/gh/udibo/test_suite)\n[![license](https://img.shields.io/github/license/udibo/test_suite)](https://github.com/udibo/test_suite/blob/master/LICENSE)\n\nAn extension of Deno's built-in test runner to add setup/teardown hooks and make\nit easier to organize tests in a format similar to Jasmine, Jest, and Mocha.\n\nThis module is being archived. It has been added to Deno's standard library in\nthe testing directory. Use Deno's standard library instead.\n\n## Features\n\n- Ability to group tests together into test suites\n- Setup/teardown hooks for test suites (beforeAll, afterAll, beforeEach,\n  afterEach)\n- Tests within a test suite inherit configuration options\n- describe/it functions similar to Jasmine, Jest, and Mocha\n- shorthand for focusing and ignoring tests\n\n## Installation\n\nTo include this module in a Deno project, you can import directly from the TS\nfiles. This module is available in Deno's third part module registry but can\nalso be imported directly from GitHub using raw content URLs.\n\n```ts\n// Import from Deno's third party module registry\nimport { describe, it } from \"https://deno.land/x/test_suite@0.16.1/mod.ts\";\n// Import from GitHub\nimport {\n  describe,\n  it,\n} from \"https://raw.githubusercontent.com/udibo/test_suite/0.16.1/mod.ts\";\n```\n\n## Usage\n\nWhen you have a set of tests that are related, you can group them together by\ncreating a test suite. A test suite can contain other test suites and tests. All\ntests within a suite will inherit their options from the suite unless they\nspecifically set them.\n\nThe beforeAll and afterAll hook options can be used to do something before and\nafter all the tests in the suite run. If you would like to set values for all\ntests within the suite, you can create a context interface that defines all the\nvalues available to the tests that are defined in the beforeAll function using\nthe this argument. An example of this can be found in the section for\n[flat test grouping](#flat-test-grouping).\n\nThe beforeEach and afterEach hook options are similar to beforeAll and afterAll\nexcept they are called before and after each individual test.\n\nBelow are some examples of how to use `describe` and `it` in tests.\n\nSee\n[deno docs](https://doc.deno.land/https/deno.land/x/test_suite@0.16.1/mod.ts)\nfor more information.\n\n### Nested test grouping\n\nThe example below can be found [here](examples/user_nested_test.ts).\n\n```ts\nimport {\n  afterEach,\n  beforeEach,\n  describe,\n  it,\n} from \"https://deno.land/x/test_suite@0.16.1/mod.ts\";\nimport { assertEquals } from \"https://deno.land/std@0.135.0/testing/asserts.ts\";\nimport {\n  getUser,\n  resetUsers,\n  User,\n} from \"https://deno.land/x/test_suite@0.16.1/examples/user.ts\";\n\ndescribe(\"user describe\", () =\u003e {\n  let user: User;\n\n  beforeEach(() =\u003e {\n    user = new User(\"Kyle June\");\n  });\n\n  afterEach(() =\u003e {\n    resetUsers();\n  });\n\n  it(\"create\", () =\u003e {\n    const user = new User(\"John Doe\");\n    assertEquals(user.name, \"John Doe\");\n  });\n\n  describe(\"getUser\", () =\u003e {\n    it(\"user does not exist\", () =\u003e {\n      assertEquals(getUser(\"John Doe\"), undefined);\n    });\n\n    it(\"user exists\", () =\u003e {\n      assertEquals(getUser(\"Kyle June\"), user);\n    });\n  });\n\n  it(\"resetUsers\", () =\u003e {\n    assertEquals(getUser(\"Kyle June\"), user);\n    resetUsers();\n    assertEquals(getUser(\"Kyle June\"), undefined);\n  });\n});\n```\n\nIf you run the above tests using `deno test`, you will get the following output.\n\n```sh\n$ deno test\nrunning 1 test from file:///examples/user_nested_test.ts\ntest user describe ...\n  test create ... ok (4ms)\n  test getUser ...\n    test user does not exist ... ok (4ms)\n    test user exists ... ok (3ms)\n  ok (11ms)\n  test resetUsers ... ok (3ms)\nok (24ms)\n\ntest result: ok. 1 passed (5 steps); 0 failed; 0 ignored; 0 measured; 0 filtered out (43ms)\n```\n\n### Flat test grouping\n\nThe example below can be found [here](examples/user_flat_test.ts).\n\n```ts\nimport { describe, it } from \"https://deno.land/x/test_suite@0.16.1/mod.ts\";\nimport { assertEquals } from \"https://deno.land/std@0.135.0/testing/asserts.ts\";\nimport {\n  getUser,\n  resetUsers,\n  User,\n} from \"https://deno.land/x/test_suite@0.16.1/examples/user.ts\";\n\ninterface UserContext {\n  user: User;\n}\n\nconst userSuite = describe({\n  name: \"user\",\n  beforeEach(this: UserContext) {\n    this.user = new User(\"Kyle June\");\n  },\n  afterEach() {\n    resetUsers();\n  },\n});\n\nit(userSuite, \"create\", () =\u003e {\n  const user = new User(\"John Doe\");\n  assertEquals(user.name, \"John Doe\");\n});\n\nconst getUserSuite = describe({\n  name: \"getUser\",\n  suite: userSuite,\n});\n\nit(getUserSuite, \"user does not exist\", () =\u003e {\n  assertEquals(getUser(\"John Doe\"), undefined);\n});\n\nit(getUserSuite, \"user exists\", function (this: UserContext) {\n  assertEquals(getUser(\"Kyle June\"), this.user);\n});\n\nit(userSuite, \"resetUsers\", function (this: UserContext) {\n  assertEquals(getUser(\"Kyle June\"), this.user);\n  resetUsers();\n  assertEquals(getUser(\"Kyle June\"), undefined);\n});\n```\n\nIf you run the above tests using `deno test`, you will get the following output.\n\n```sh\n$ deno test\nrunning 1 test from file:///examples/user_flat_test.ts\ntest user ...\n  test create ... ok (3ms)\n  test getUser ...\n    test user does not exist ... ok (2ms)\n    test user exists ... ok (4ms)\n  ok (11ms)\n  test resetUsers ... ok (3ms)\nok (22ms)\n\ntest result: ok. 1 passed (5 steps); 0 failed; 0 ignored; 0 measured; 0 filtered out (44ms)\n```\n\n### Shorthand for focusing and ignoring tests\n\nTo avoid having to change your test function arguments to be able to focus or\nignore tests temporarily, a shorthand has been implemented. This makes it as\neasy as typing `.only` and `.ignore` to focus and ignore tests.\n\n- To focus a test case, replace `it` with `it.only`.\n- To ignore a test case, replace `it` with `it.ignore`.\n- To focus a test suite, replace `describe` with `describe.only`.\n- To ignore a test suite, replace `describe` with `describe.ignore`.\n\n### Migrating from earlier versions\n\nThe `TestSuite` class has been turned into an internal only class. To create a\ntest suite, use the `describe` function instead of creating a new instance of\n`TestSuite` directly.\n\nThe `test` function has been removed. Replace `test` calls with calls to `it`.\n\nThe `each` function that was previously available has been temporarily removed\nto allow me to switch over to the test step api quicker. I plan on implementing\nthis later. If you make use of the `each` function for generating test cases, do\nnot upgrade beyond version 0.9.5.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fudibo%2Ftest_suite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fudibo%2Ftest_suite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fudibo%2Ftest_suite/lists"}