{"id":29130283,"url":"https://github.com/Olivine-Labs/busted","last_synced_at":"2025-06-30T04:03:41.860Z","repository":{"id":4215081,"uuid":"5336227","full_name":"lunarmodules/busted","owner":"lunarmodules","description":"Elegant Lua unit testing.","archived":false,"fork":false,"pushed_at":"2024-11-29T21:32:31.000Z","size":1888,"stargazers_count":1507,"open_issues_count":55,"forks_count":193,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-06-16T21:04:13.996Z","etag":null,"topics":["lua","testing"],"latest_commit_sha":null,"homepage":"https://lunarmodules.github.io/busted/","language":"Lua","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/lunarmodules.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2012-08-08T02:28:22.000Z","updated_at":"2025-06-09T09:52:29.000Z","dependencies_parsed_at":"2023-07-05T19:03:11.501Z","dependency_job_id":"54336bb8-9d5b-435e-b34c-540152d089e0","html_url":"https://github.com/lunarmodules/busted","commit_stats":{"total_commits":781,"total_committers":77,"mean_commits":"10.142857142857142","dds":0.709346991037132,"last_synced_commit":"a144124839f027a2d0a95791936c478d047126fc"},"previous_names":["olivine-labs/busted"],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/lunarmodules/busted","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lunarmodules%2Fbusted","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lunarmodules%2Fbusted/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lunarmodules%2Fbusted/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lunarmodules%2Fbusted/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lunarmodules","download_url":"https://codeload.github.com/lunarmodules/busted/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lunarmodules%2Fbusted/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262707976,"owners_count":23351529,"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":["lua","testing"],"created_at":"2025-06-30T04:03:35.552Z","updated_at":"2025-06-30T04:03:41.849Z","avatar_url":"https://github.com/lunarmodules.png","language":"Lua","funding_links":[],"categories":["Lua","Testing"],"sub_categories":[],"readme":"busted\n======\n\n[![Join the chat at https://gitter.im/lunarmodules/busted](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/lunarmodules/busted?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n[![Busted](https://img.shields.io/github/actions/workflow/status/lunarmodules/busted/busted.yml?label=Busted\u0026logo=Lua)](https://github.com/lunarmodules/busted/actions?workflow=Busted)\n[![Luacheck](https://img.shields.io/github/actions/workflow/status/lunarmodules/busted/luacheck.yml?label=Luacheck\u0026logo=Lua)](https://github.com/lunarmodules/busted/actions?workflow=Luacheck)\n[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/lunarmodules/busted?label=Tag\u0026logo=GitHub)](https://github.com/lunarmodules/busted/releases)\n[![Luarocks](https://img.shields.io/luarocks/v/lunarmodules/busted?label=Luarocks\u0026logo=Lua)](https://luarocks.org/modules/lunarmodules/busted)\n\n\nbusted is a unit testing framework with a focus on being **easy to\nuse**. Supports Lua \u003e= 5.1, luajit \u003e= 2.0.0, and moonscript.\n\nCheck out the [official docs](https://lunarmodules.github.io/busted/) for\nextended info.\n\nbusted test specs read naturally without being too verbose. You can even\nchain asserts and negations, such as `assert.is_not.equal`. Nest blocks of\ntests with contextual descriptions using `describe`, and add tags to\nblocks so you can run arbitrary groups of tests.\n\nAn extensible assert library allows you to extend and craft your own\nassert functions specific to your case with method chaining. A modular\noutput library lets you add on your own output format, along with the\ndefault pretty and plain terminal output, JSON with and without\nstreaming, and TAP-compatible output that allows you to run busted specs\nwithin most CI servers.\n\n```lua\ndescribe('Busted unit testing framework', function()\n  describe('should be awesome', function()\n    it('should be easy to use', function()\n      assert.truthy('Yup.')\n    end)\n\n    it('should have lots of features', function()\n      -- deep check comparisons!\n      assert.same({ table = 'great'}, { table = 'great' })\n\n      -- or check by reference!\n      assert.is_not.equals({ table = 'great'}, { table = 'great'})\n\n      assert.falsy(nil)\n      assert.error(function() error('Wat') end)\n    end)\n\n    it('should provide some shortcuts to common functions', function()\n      assert.unique({{ thing = 1 }, { thing = 2 }, { thing = 3 }})\n    end)\n\n    it('should have mocks and spies for functional tests', function()\n      local thing = require('thing_module')\n      spy.on(thing, 'greet')\n      thing.greet('Hi!')\n\n      assert.spy(thing.greet).was.called()\n      assert.spy(thing.greet).was.called_with('Hi!')\n    end)\n  end)\nend)\n```\n\nContributing\n------------\n\nSee [CONTRIBUTING.md](https://github.com/lunarmodules/busted/blob/master/CONTRIBUTING.md).\nAll issues, suggestions, and most importantly pull requests are welcome.\n\nTesting\n-------\n\nAssuming you have luarocks installed:\n\nInstall these dependencies for core testing:\n\n```\nluarocks install moonscript\n```\n\nThen to reinstall and run tests:\n\n```\nluarocks remove busted --force\nluarocks make\nbusted spec\n```\n\nDocker\n------\n\nAlternatively Busted can be run as a standalone docker container.\nThis approach is somewhat limited because many projects will require extra dependencies which will need to be installed inside the Docker container.\nLuarocks is provided in the container so many dependencies can be added.\nThe images are based on Alpine Linux so you can also use `apk add` to install system dependencies if needed.\nThe Docker use case is probably most advantageous for pure-Lua projects with no dependencies: i.g. small libraries not large apps.\n\nThe usage of docker is fairly simple.\nYou can either build your own or download a prebuilt version.\nTo build your own, execute the following command from the source directory of this project:\n\n```console\n$ docker build -t ghcr.io/lunarmodules/busted:HEAD .\n```\n\nTo use a prebuilt one, download it from the GitHub Container Registry.\nHere we use the one tagged *latest*, but you can substitute *latest* for any tagged release.\n\n```console\n$ docker pull ghcr.io/lunarmodules/busted:latest\n```\n\nOnce you have a container you can run it on one file or a source tree (substitute *latest* with *HEAD* if you built your own or with the tagged version you want if applicable):\n\n```console\n# Run on an entire project\n$ docker run -v \"$(pwd):/data\" ghcr.io/lunarmodules/busted:latest\n\n# Run on one directory:\n$ docker run -v \"$(pwd):/data\" ghcr.io/lunarmodules/busted:latest specs\n```\n\nA less verbose way to run it in most shells is with at alias:\n\n```console\n# In a shell or in your shell's RC file:\n$ alias busted='docker run -v \"$(pwd):/data\" ghcr.io/lunarmodules/busted:latest'\n\n# Thereafter just run:\n$ busted\n```\n### Use as a CI job\n\nThere are actually many ways to run Busted remotely as part of a CI work flow.\nBecause packages are available for many platforms, one way would be to just use your platforms native package installation system to pull them into whatever CI runner environment you already use.\nAnother way is to pull in the prebuilt Docker container and run that.\n\nAs a case study, here is how a workflow could be setup in GitHub Actions:\n\n```yaml\nname: Busted\non: [push, pull_request]\njobs:\n  sile:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v3\n      - name: Run Busted\n        uses: lunarmodules/busted@v0\n```\n\nBy default the GH Action is configured to run `busted --verbose`, but you can also pass it your own `args` to replace the default input of `.`.\n\n```yaml\n      - name: Run Busted\n        uses: lunarmodules/busted@v0\n        with:\n            args: --tags=MYTAGS\n```\n\nLicense\n-------\n\nCopyright 2012-2020 Olivine Labs, LLC.\nMIT licensed. See [LICENSE for details](https://github.com/lunarmodules/busted/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOlivine-Labs%2Fbusted","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOlivine-Labs%2Fbusted","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOlivine-Labs%2Fbusted/lists"}