{"id":51465046,"url":"https://github.com/mifkata/sailsman","last_synced_at":"2026-07-06T10:00:48.144Z","repository":{"id":35130919,"uuid":"210655748","full_name":"mifkata/sailsman","owner":"mifkata","description":"Test helpers for Sails JS","archived":false,"fork":false,"pushed_at":"2023-01-24T00:40:54.000Z","size":387,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-19T10:56:29.625Z","etag":null,"topics":["api","api-testing","mocha","sails","sailsjs","supertest","test","unit","unittest","unittesting"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/mifkata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-24T17:04:33.000Z","updated_at":"2023-03-17T02:56:03.000Z","dependencies_parsed_at":"2023-02-13T05:40:28.090Z","dependency_job_id":null,"html_url":"https://github.com/mifkata/sailsman","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mifkata/sailsman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mifkata%2Fsailsman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mifkata%2Fsailsman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mifkata%2Fsailsman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mifkata%2Fsailsman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mifkata","download_url":"https://codeload.github.com/mifkata/sailsman/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mifkata%2Fsailsman/sbom","scorecard":{"id":643999,"data":{"date":"2025-08-11","repo":{"name":"github.com/mifkata/sailsman","commit":"0bb99beb55f21d873efea68c281fea69c2e45f21"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/13 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"45 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-h452-7996-h45h","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-phwq-j96m-2c2q","Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-x55w-vjjp-222r","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-35q2-47q7-3pc3","Warn: Project is vulnerable to: GHSA-gpw9-fwm8-7rx7","Warn: Project is vulnerable to: GHSA-8v3j-jfg3-v3fv","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-qgmg-gppg-76g5","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T11:35:15.208Z","repository_id":35130919,"created_at":"2025-08-21T11:35:15.208Z","updated_at":"2025-08-21T11:35:15.208Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35185688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-06T02:00:07.184Z","response_time":106,"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":["api","api-testing","mocha","sails","sailsjs","supertest","test","unit","unittest","unittesting"],"created_at":"2026-07-06T10:00:47.222Z","updated_at":"2026-07-06T10:00:48.138Z","avatar_url":"https://github.com/mifkata.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sailsman\nTest helpers for [sails](https://github.com/balderdashy/sails) that aid in testing most commpon cases, when making API calls to `sails`.\n\nSailsman allows you to:\n  * Start, stop and restart sails\n  * Load fixtures\n  * Set the session values for the current user\n  * Make API calls to `sails` using [supertest](https://github.com/visionmedia/supertest)\n\nThe goal is, with minimal setup to be able to configure [mocha](https://github.com/mochajs/mocha  (or another test runner) to `lift` or `lower` Sails at any point in time, whilst giving you the same easy of access to global variables, as `sails` would.\n\n## Install\n\nLibrary usage, assumes that you to have [sails](https://github.com/balderdashy/sails), this package doesn't depend on it and thus doesn't install it, when you include `sailsman` in your package.\n\n```sh\nnpm install --save-dev sailsman\n```\n\nIn order for your `sails` instance to not collide with your `test` instance, make sure to configure the `sails` port for the `test` environment:\n\n```javascript\n// config/env/test.js\nmodule.exports = {\n  port: 31337\n}\n```\n\n## Usage\nThis example assumes that you're using something like mocha or another\ntest library. So the first thing that you want to do is to lift sails, so that\nyou can run tests against it.\n\n### Configuring your test environment\n\n```javascript\n// this script is written, assuming that it's located in\n// sails-root/test/setup.js\nconst { Sailsman } = require('sailsman');\n\n// sails options that you want to override\n// this is useful, when you want to disable a specific hook\n// in the test environment, in this example - we're disabling\n// the Next.js hook\nconst sailsOptions = {\n  hooks: {\n    next: false\n  }\n};\n\n// This to tell Sailsman where to find fixture files and the\n// temporary database using \"sails-disk\", read more about fixtures below\nconst fixturesConfig = {\n  path: path.resolve(__dirname, 'fixtures'),\n  dbPath: path.resolve(__dirname, '..', '.tmp', 'localDiskDb')\n};\n\n// create a globally available instance of Sailsman for your tests\nglobal.sailsman = new Sailsman(sailsOptions, fixturesConfig);\n\nbefore('Start Sailsman', () =\u003e sailsman.startSilent());\nafter('Stop Sailsman', () =\u003e sailsman.stop());\n```\n\n### Usage in a test script\nThis example makes a post to your locally defined endpoint, we assume it's\nbound to `POST /api/authenticate` and there's a user in the database with\nusername and password `test` and ID `1`. Also, we assume that when the user\nis authenticated, we set the session property of `userId` to equal `1`.\n\n```javascript\nconst assert = require('assert');\n\ndescribe('Endpoint test', () =\u003e {\n  it('should authenticate correctly', () =\u003e {\n    sailsman.agent                // instance of superagent bound to sails\n      .post('/api/authenticate')\n      .type('form')\n      .send({ username: 'test', password: 'test' })\n      .expect(200)\n      .then(async () =\u003e {\n        // returns the session object\n        // in a request/controller action this would equal req.session\n        const session = await sailsman.getSession();\n\n        // some session validation\n        assert(session.userId === 1);\n      })\n  });\n});\n```\n\n## Sailsman API\n\n* `global.sailsman = new Sailsman(sailsOptions, fixtureOptions)` - Creates new instance of Sailsman. For `sailsOptions` read the [Advanced Usage](https://sailsjs.com/documentation/reference/application/advanced-usage) documentation on sails under section `Properties (advanced)`. For `fixtureOptions` read below\n* `sailsman.start()` (async) - Starts/Lifts `sails`\n* `sailsman.startVerbose()` (async) - Same as `sailsman.start()`, but also displays the Sails lift output. |\n* `sailsman.stop()` (async) - Stops/Lowers `sails`\n* `sailsman.restart()` (async) - Restarts `sails`. This is useful when you want to test different behaviour, based on different environment variable settings.\n* `sailsman.getSession()` (async) - Returns an instance of the `sails` session for the test agent. This is the same as `req.session` inside a controller action or a policy/middleware\n* `sailsman.setSession(newValue)` (async) - This replaces the current session object's value for the test agent. Example usage `sailsman.setSession({ id: 'test', email: 'test@test.com' })`.\n* `sailsman.agent` - Returns an instance of `supertest` that is bound to the `express` instance, that `sails` run. From there you can run `sails.agent.get()`, `sails.agent.post()`, etc. Refer to the [Supertest Documentation](https://github.com/visionmedia/supertest#example) for more information.\n* `sailsman.sails` - Returns the `sails` instance, created with `new require('sails').Sails()`\n* `sailsman.app` - The app created by running `sailsman.sails.lift()`\n\n## Working with fixtures\nThere's not much magic around implementing fixtures with `Sailsman`. Simply said, these will populate your test database much more easily, than having to do them manually in a different way. \n\nUsage is easy - create a directory (`tests/fixtures` for example) and put a single `JSON` file for each `model` that you want to populate with data during tests.\n\nSo, for example, if you have a model called `User` and you want to poulate it, create `test/fixtures/User.json` with something like this:\n\n```json\n[\n  {\n    \"id\": 1,\n    \"username\": \"test\",\n    \"password\": \"pass\",\n    \"email\": \"test@test.com\"\n  },\n  {\n    \"username\": \"test2\",\n    \"password\": \"pass2\",\n    \"email\": \"test2@test.com\"\n  }\n]\n```\n\nNaturally, if your database is configured to generate the primary key atuomatically, you don't need to enter `id` values, this is only useful, when you want to bind a specific object, to specific `id`, so you can later on look it up in your tests, if you need to.\n\n## License\n[MIT](./LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmifkata%2Fsailsman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmifkata%2Fsailsman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmifkata%2Fsailsman/lists"}