{"id":"sinlerdev/cresctest","name":"cresctest","scope":"sinlerdev","platform":"roblox","description":"A powerful and runtime-agnostic unit testing framework for Luau.","version":"0.1.0","latest":"0.1.0","versions":["0.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{},"integrity":"03fe3810ecb041bfd56c6c704ed63c777149af63df18fa87a3903d60ed067176","likes":0,"downloads":0,"install":"forest install sinlerdev/cresctest","url":"https://forest.dev/p/roblox/sinlerdev/cresctest","files":"https://api.forest.dev/ai/package/roblox/sinlerdev/cresctest/files","readme":"<h1 align=\"center\">\r\n\tCrescTest\r\n</h1>\r\n<h3 align=\"center\">\r\n\tUnit Testing in Luau SuperCharged\r\n</h3>\r\n\r\n____\r\n\r\nCrescTest is a runtime-agnostic Luau unit testing framework, with a focus on simplicity, and cross-runtime testing. \r\n\r\n### Origin\r\nCrescTest isn't the first unit testing framework I wrote. In fact, its a successor to the Unit testing framework that libraries like Vinum and BridgeNet2 use.\r\n\r\nCrescTest has been made to improve what the Orginial framework didn't do well,  and to provide what it lacked.\r\nFor example:\r\n1. Improved error reporting\r\n2. Cross-runtime testing\r\n3. Extremely lightweight.\r\n4. Ability to skip test cases.\r\n5. lifecycle functions.\r\n\r\n### API\r\n\r\n```lua\r\nexport type skip = () -> ()\r\nexport type lifecycleFunctions = \"afterAll\" | \"afterEach\" | \"beforeAll\" | \"beforeEach\"\r\n\r\nexport type TestCaseResult = { ok: boolean, err: string? }\r\nexport type TestSuiteResult = { [string]: TestCaseResult }\r\nexport type TestSuite = {\r\n\t[string]: (skip: skip, ...any) -> (),\r\n}\r\n```\r\nAll custom types used within CrescTest.\r\n\r\n```lua\r\nfunction CrescTest.runLune(dir: string, context: any)\r\n```\r\n\r\nA bootstrapper intended for usage within lune.\r\n\r\n* dir: A path to the folder you want to run all .spec files that are present\r\n* context: any value that you would want all tests to access it\r\n\r\n```lua\r\nfunction CrescTest.runRoblox(dirInstance: Folder, context: any)\r\n```\r\nA bootstrapper intended for usage within Roblox.\r\n* dirInstace: A folder that contains all the .spec files you need to test.\r\n* context: any value that you would want all tests to access it\r\n\r\n```lua\r\nfunction CrescTest.runSuite(TestSuite: TestSuite, context: any): TestSuiteResult\r\n```\r\n\r\nA runtime-agnostic method for running test suites.\r\n\r\n* TestSuite: a table of test cases.\r\n* context: any value that you would want all tests to access it.\r\n\r\n```lua\r\nfunction CrescTest.expect(input: any)\r\n```\r\nTakes in an input, that then gets used in assertions\r\n\r\n* `.never` - Reverses the result of the assertion.\r\n* `.ok()` - Asserts that value is non-nil\r\n* `.equal/equals(expectedValue)`-  - Asserts that value is equal to expectedValue.\r\n* `.near(value)` - Asserts that the rounded version of input equals the rounded version of value\r\n* `.a(expectedType)` - Asserts that the `typeof(input)` equals to expectedType.\r\n* `.any.thing.that.is.not.part.of.the.api` - Does nothing, so you are able to write scentences.\r\n\r\n```\r\nx.spec.luau\r\n```\r\n\r\nA file that has a bunch of TestCases. \r\n```lua\r\nreturn {\r\n    should_add_well = function()\r\n        CrescTest.expect(1 + 1).to.equal(2)\r\n    end,\r\n    should_subtract_well = function()\r\n        CrescTest.expect(1 - 1).to.equal(0)\r\n    end,\r\n    should_do_something_complex = function(skip)\r\n        --skip()\r\n        task.wait(2)\r\n        CrescTest.expect(1 - 1).to.equal(1)\r\n    end\r\n}\r\n```","readmeTruncated":false}