{"id":15529935,"url":"https://github.com/hazzard993/busted-tstl","last_synced_at":"2025-07-19T20:34:28.659Z","repository":{"id":45130979,"uuid":"172165929","full_name":"hazzard993/busted-tstl","owner":"hazzard993","description":"TypeScript declarations for Busted (lua)","archived":false,"fork":false,"pushed_at":"2022-01-06T12:52:14.000Z","size":23,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T04:52:48.947Z","etag":null,"topics":["definitions","lua","testing","typescript","typescript-to-lua"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hazzard993.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-23T03:19:43.000Z","updated_at":"2023-12-31T06:05:39.000Z","dependencies_parsed_at":"2022-09-26T21:40:43.895Z","dependency_job_id":null,"html_url":"https://github.com/hazzard993/busted-tstl","commit_stats":null,"previous_names":["hazzard993/busted-typescript-declarations"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazzard993%2Fbusted-tstl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazzard993%2Fbusted-tstl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazzard993%2Fbusted-tstl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazzard993%2Fbusted-tstl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hazzard993","download_url":"https://codeload.github.com/hazzard993/busted-tstl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345291,"owners_count":21088243,"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":["definitions","lua","testing","typescript","typescript-to-lua"],"created_at":"2024-10-02T11:20:31.964Z","updated_at":"2025-04-11T04:52:53.488Z","avatar_url":"https://github.com/hazzard993.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# TypeScript declarations for Busted\n\nThis repository contains TypeScript declarations for [Busted](https://olivinelabs.com/busted/). An Elegant Lua unit testing framework.\n\nYou can install these via npm.\n\n```\nyarn add -D busted-tstl\n# or\nnpm install -D busted-tstl\n```\n\nlink them up in your **tsconfig.json** file.\n\n\u003e It is recommended to use [lua-types](https://github.com/ark120202/lua-types) with these declarations as those will tell TypeScript about Lua's environment.\n\n```json\n{\n    \"compilerOptions\": {\n        \"lib\": [\"esnext\"],\n        \"types\": [\n            \"busted-tstl\",\n            \"lua-types/5.1\n        ]\n    }\n}\n```\n\nstart creating your busted tests within _.ts_ files (preferably with the suffix _\\_spec.ts_ within a folder named _spec_).\n\n```ts\ndescribe(\"mocks\", () =\u003e {\n    it(\"replaces a table with spies\", () =\u003e {\n        const t = {\n            thing: function (this: void, msg) { print(msg) }\n        };\n\n        const m = mock(t); // mocks the table with spies, so it will print\n\n        m.thing(\"Coffee\");\n        assert.spy(m.thing).was.called_with(\"Coffee\");\n    });\n\n    it(\"replaces a table with stubs\", () =\u003e {\n        const t = {\n            thing: function (this: void, msg) { print(msg) }\n        };\n\n        const m = mock(t, true); // mocks the table with stubs, so it will not print\n\n        m.thing(\"Coffee\");\n        assert.stub(m.thing).was.called_with(\"Coffee\");\n        mock.revert(m); // reverts all stubs/spies in m\n        m.thing(\"Tea\"); // DOES print 'Tea'\n    });\n});\n```\n\nThen transpile the file(s) with [TypeScriptToLua](https://github.com/TypeScriptToLua/TypeScriptToLua) and run busted!\n\n```sh\ntstl spec/test_spec.ts\ntstl -p tsconfig.json\nbusted      # Install with `luarocks install busted`\n```\n\nIt is recommended to use [lua-types](https://github.com/ark120202/lua-types) with these declarations as those will tell TypeScript about Lua's environment.\n\n## Assertion Statement Info\n\nAssertion statements can be built with underscores and/or dots.\n\n```ts\nassert.is.True(true);           // Equivalent\nassert.is_true(true);           // Equivalent\n\nassert.is.not.True(false);      // Equivalent\nassert.is_not_true(false);      // Equivalent\n```\n\nVerbs can be chained. However if there is a `not` or `no` within the chain, the assertion is expected to be fail. This cannot be reverted with another `not` or `no`.\n\n```ts\nassert.is.is.is.not.is.not.False(true);   // Assertion failed.\n                                          // This was expected because of `not`\n```\n\n## Async Tests\n\nTo use `async()` and `done()` make sure your test case is wrapped in a `pending(...)` call.\n\n```ts\nasync(); // error, trying to call nil value\ndone(); // error, trying to call nil value\n\npending(\"waiting for sleep to complete\", () =\u003e {\n  async();\n  sleep(5000);\n  done();\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhazzard993%2Fbusted-tstl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhazzard993%2Fbusted-tstl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhazzard993%2Fbusted-tstl/lists"}