{"id":22505259,"url":"https://github.com/azer/highkick","last_synced_at":"2025-10-04T22:23:36.081Z","repository":{"id":57150198,"uuid":"2478725","full_name":"azer/highkick","owner":"azer","description":"HighKick is a small testing framework that I like.","archived":false,"fork":false,"pushed_at":"2013-03-04T21:57:27.000Z","size":177,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-19T13:49:46.052Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/azer.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":"2011-09-28T23:29:15.000Z","updated_at":"2023-08-23T01:34:39.000Z","dependencies_parsed_at":"2022-09-03T17:51:49.543Z","dependency_job_id":null,"html_url":"https://github.com/azer/highkick","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/azer/highkick","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fhighkick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fhighkick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fhighkick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fhighkick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azer","download_url":"https://codeload.github.com/azer/highkick/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fhighkick/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268537891,"owners_count":24266285,"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","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-12-07T00:16:44.221Z","updated_at":"2025-10-04T22:23:35.992Z","avatar_url":"https://github.com/azer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"HighKick is a small testing framework that I like.\n\n```bash\n$ npm install highkick\n```\n\n![](http://farm6.staticflickr.com/5302/5625088762_355af8f69a.jpg)\n\n# Overview\n\nIt enables [ChaiJS'](http://chaijs.com/) `assert` and `expect` modules by default.\n\nBDD: \n```js\ndescribe('Array', function(){\n  describe('#indexOf()', function(){\n    it('should return -1 when the value is not present', function(){\n      assert.equal(-1, [1,2,3].indexOf(5));\n      expect([1,2,3].indexOf(0).to.be(5));\n    })\n  })\n})\n```\n\nCommonJS:\n```javascript\n\nexports.init = function init(options, callback){\n    startWebServer(callback);\n}\n\nexports.testFoo = function testFoo(callback){\n    get('http://localhost/api/foo', function(error, response){\n        if(error){\n            callback(error);\n            return;\n        }\n        \n        assert.equal(response.foo, 'foo')\n        \n        callback();\n    });\n}\n\nexports.end = function end(callback){\n    stopWebServer(callback);\n}\n\n```\n\n# First Steps\n\nHighKick takes a module and executes the functions that have a name starting with \"test\". A simple test module would look like this;\n\n```javascript\n\nvar assert = require('assert');\n\nexports.testFoo = function(callback){\n    try {\n        assert.something();\n        callback();\n    } catch (error) {\n        callback(error);\n    }\n}\n\nexports.testBar = function(callback){\n    setTimeout(callback, 100);\n}\n\n```\n\nBelow command will run the all tests defined in tests.js;\n\n```bash\n$ highkick tests.js\n```\n\nTo specify the tests that needs to run;\n\n```bash\n$ kick=foo highkick tests.js\n```\n\nse comma for separating multiple test names, and '*' for running all tests.\n\n## Before\n\nAn init function is called before the execution of the tests in a module for once. Init functions take an `options` object from HighKick and are able to\nproduce the first parameters of test functions as shown in the example below;\n\nCommonJS: \n```javascript\nexports.before = function before(options, callback){\n    callback( undefined, +(new Date), Math.PI );\n}\n\nexports.testFoo = function(timestamp, pi, callback){\n    ...\n}\n```\n\n## beforeEach\n\nUse `beforeEach` to define a function to be called before each test.\n\n```javascript\n\nfunction beforeEach(callback){\n    callback( undefined, +(new Date));\n}\n\nexports.testFoo = function(now, callback){\n    ...\n}\n\n```\n\nSimilar to the `init` functions, what a `beforeEach` function produces is passed to test functions. The key difference is, `beforeEach` functions take parameters from `init` functions, too.\n\n```javascript\nexports.init = function(options, callback){\n    callback(undefined, 'hello');\n}\n\nexports.beforeEach = function(hello, callback){\n    callback(undefined, 'world';\n}\n\nexports.testFoo = function(hello, world, callback){\n    ...\n}\n```\n\n## afterEach\n\nAn `afterEach` function is called after each test, regardless of results.\n\n```javascript\nexports.beforeEach = function(callback){\n    callback(undefined, new ChildProcess);\n}\n\nexports.testFoo = function(process, callback){\n    ...\n}\n\nexports.afterEach = function(process, callback){\n    process.terminate();\n    callback();\n}\n```\n\n## after\n\nUnlikely to `afterEach`, an `end` function is called after all tests are done.\n\n```javascript\nexports.after = function(callback){\n    callback(undefined, new ChildProcess);\n}\n\nexports.testFoo = function(process, callback){\n    ...\n}\n\nexports.end = function(process, callback){\n    process.terminate();\n    callback();\n}\n```\n\n## Nested Tests\n\nHighKick provides a very minimalistic concept of nested tests;\n\n```javascript\nexports.testFoobar = highkick('./foobar');\n```\n\nYou can use comma for separating multiple test names and pass '*' for enabling output for child tests.\n\nIn the case a custom callback is needed for getting a summary of testsuite:\n\n```\nhighkick('./tests', function(error, result){\n    if(error){\n        logging.error('Ran %d tests, %d failed', result.len, result.fail);\n        logging.error(error);\n    }\n\n    logging.info('Ran %d tests successfully, without any error.', result.len);\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Fhighkick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazer%2Fhighkick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Fhighkick/lists"}