{"id":22261414,"url":"https://github.com/mhio/node-mhio-test","last_synced_at":"2026-05-15T18:33:29.603Z","repository":{"id":47967008,"uuid":"79969036","full_name":"mhio/node-mhio-test","owner":"mhio","description":":white_check_mark: Node Test Helpers","archived":false,"fork":false,"pushed_at":"2022-02-11T00:47:28.000Z","size":221,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T11:56:28.518Z","etag":null,"topics":["deployable","helpers","nodejs","npm-module","testing"],"latest_commit_sha":null,"homepage":"","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/mhio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-25T00:34:47.000Z","updated_at":"2019-11-13T23:44:24.000Z","dependencies_parsed_at":"2022-08-12T15:30:48.901Z","dependency_job_id":null,"html_url":"https://github.com/mhio/node-mhio-test","commit_stats":null,"previous_names":["deployable/node-deployable-test"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/mhio/node-mhio-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhio%2Fnode-mhio-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhio%2Fnode-mhio-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhio%2Fnode-mhio-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhio%2Fnode-mhio-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhio","download_url":"https://codeload.github.com/mhio/node-mhio-test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhio%2Fnode-mhio-test/sbom","scorecard":{"id":334944,"data":{"date":"2025-08-11","repo":{"name":"github.com/mhio/node-mhio-test","commit":"33573a69b53541822ff24222ed91227c25b86ce6"},"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":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":"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":"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":"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":"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":"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:0","Info: FSF or OSI recognized license: MIT License: LICENSE: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":"24 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","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-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-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","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-18T04:29:57.517Z","repository_id":47967008,"created_at":"2025-08-18T04:29:57.517Z","updated_at":"2025-08-18T04:29:57.517Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33074846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["deployable","helpers","nodejs","npm-module","testing"],"created_at":"2024-12-03T09:12:42.863Z","updated_at":"2026-05-15T18:33:29.583Z","avatar_url":"https://github.com/mhio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Node Test Helpers](https://github.com/mhio/node-mhio-test)\n\n## @mhio/test\n\nCollection of Node.js Test Helpers.\n\n`TestEnv` sets up up a read/write environment that can be easily accessed,\npopulated and then cleaned up after a test run.\n\n\n## Install\n\n```bash\n    npm install @mhio/test --save-dev\n    yarn add @mhio/test --dev\n```\n\n\n## Usage\n\nTestEnv expects `test` to contain you test files by default. Fixtures are expected to be in `test/fixture`. Output goes into `test/output`.\n\nThese paths can be overridden when you setup your `TestEnv`.\n\nSee [examples](examples/README.md) for more\n\n```javascript\nlet test_env, out\n\nbefore('Copy `files` from fixtures', function(){\n  // Create a test environment from a file in your `test/` directory.\n  test_env = TestEnv.setupTestDir(__dirname)\n\n  // Create an output area called `newdir` in `test/output/newdir`.\n  out = test_env.output('newdir')\n\n  // Copy `test/fixture/files` to `test/output/subdir`\n  return out.copyFrom('files', 'subdir')\n})\n\nafter('Cleanup', function(){\n  return out.clean()\n})\n\nit('should now have fixtures in the output directory', function(){\n  let dir = out.path('subdir')\n  expect( dir ).to.be.a.directory().with.contents(['firstfile'])\n})\n\nit('should write a file to output', function(){\n  let file = out.path('subdir', 'testfile')\n  return fs.writeFileAsync(file, 'data\\n').then( ()=\u003e {\n    expect( path.join(__dirname,'output','newdir','subdir','testfile') ).to.be.a.file()\n  })\n})\n```\n\nSetting `DEBUG_CLEAN=true` in your environment prevents cleanup so\nyou can inspect files after the tests have run.\n\n```shell\nDEBUG_CLEAN=true mocha -b\n```\n\n## API\n\n### TestEnv Path\n\n- [path()](#path-test_dir-)\n- [copy()](#copy-test_dir-)\n\n#### Output\n\n- [clean()](#copyto-test_dir-)\n- [copyTo()](#copyto-test_dir-s)\n\n#### Fixture\n\n- [copyFrom()](#copyfrom-test_dir-)\n\n\n### TestEnv\n\n- [TestEnv.setup()](#testenvsetup-test_dir-)\n- [TestEnv.setupTestDir()](#testenvsetuptestdir-test_dir-)\n- [TestEnv.join()](#testenvsetuptestdir-test_dir-)\n- [TestEnv.resolve()](#testenvsetuptestdir-test_dir-)\n- [basePath()](#basepathargs)\n- [fixturePath()](#fixturepathargs)\n- [outputPath()](#outputpathargs)\n- [tmpOutputPath()](#tmpoutputpathsuffix-extras)\n- [randomHex()](#randomhexn)\n- [cleanAsync()](#cleanasyncdir)\n- [cleanAllOutputAsync()](#cleanalloutputasync)\n- [cleanOutputAsync()](#cleanoutputasyncsubdir)\n- [cleanAllOutputTmpAsync()](#cleanalloutputtmpasync)\n- [cleanOutputTmpAsync()](#cleanoutputtmpasyncsuffix)\n- [mkdirOutputAsync()](#mkdiroutputasyncargs)\n- [mkdirOutputTmpAsync()](#mkdiroutputtmpasyncsuffix)\n- [removeTmpPrefixFromPath()](#removetmpprefixfrompathtmppath)\n- [copyAsync()](#copyasyncsrc-dest-options)\n- [copyFixtureToTmpOutputAsync()](#copyfixturetotmpoutputasyncfixture_suffix)\n- [copyFixtureToOutputAsync()](#copyfixturetooutputasyncfixture_suffix-output_suffix)\n\n\n### TestEnvPath\n\n----\n##### `.path( ...dirs )`\n\nCreate a path from the base path of this Path instance\n\n\n----\n##### `copy( source, destination )`\n\nPromise to copy a file from a source to destination\n\n\n----\n### TestEnvPathOutput\n\n##### `copyTo( source, destination )`\n\nPromise to copy data to this Output or path from a Fixture or path\n\nSource and destination can be:\n\n - `undefined`/`null` - Parents fixture path.\n - `String`           - Parents fixture path + str\n - `Array`            - Parents fixture path join with Array\n - `TestEnvPath`      - TEP's base bath\n\n----\n##### `clean()`\n\nPromise to clean up file system contents of this Path instance\n\n\n----\n### TestEnvPathFixture\n\n##### `copyFrom( source, destination )`\n\nPromise to copy data from this Fixture or path to an Output or path\n\nSource and destination can be:\n\n - `undefined`/`null` - Parents fixture path.\n - `String`           - Parents fixture path + str\n - `Array`            - Parents fixture path join with Array\n - `TestEnvPath`      - TEP's base bath\n\n\n----\n### TestEnv\n\n#### `TestEnv.setup( app_path )`\n\nRequires the path to your app directory that contains `test`.\nThe `fixture` and `output` directories will be in `test`.\nSee `TestEnv.setupTestDir( __dirname )` for quicker setup from\nyour inside your tests.\n\nOptions\n\n - `base_path`\u003cbr\u003e\n    The project/apps base path.\n    Take a guess if the user doesn't provide one.\n    The guess removes the `node_modules/@mhio/test/lib` dirs.\n\n - `test_dir`\u003cbr\u003e\n    This directory will be appended to `base_path` that contains your tests.\n    Defaults to: `test`\n\n - `fixture_dir`\u003cbr\u003e\n    This directory will be appended to `test_dir` and contains your fixtures.\n    Defaults to: `fixture`\n\n - `output_dir`\u003cbr\u003e\n    This directory will be appended to `test_dir` for test output.\n    Defaults to: `output`\n\n-  `tmp_output_dir_prefix`\n    The prefix used for a temp dirs in output. Defaults to `tmp-`\n\n----\n#### `TestEnv.setupTestDir( test_dir )`\n\nSame as above but accepts the test directory instead of the app path.\nAllows `TestEnv.setupTestDir( __dirname )` from test files.\n\n----\n#### `basePath(...args)`\n\nReturn a directory path from TestEnv `base_path`.\nJoins all arguments with `path.join`\n\n----\n#### `fixturePath(...args)`\n\nReturn a directory path from the `fixture/` path\nJoins all arguments with `path.join`\n\n```javascript\nTestEnv.fixturePath('a', 'b')\n// = '/project/test/fixture/a/b'\n```\n\n----\n#### `outputPath(...args)`\n\nReturn a directory from the `output/` path\nJoins all arguments with `path.join`\n\n```javascript\nTestEnv.outputPath('one', 'two')\n// = '/project/test/output/one/two'\n```\n\n----\n#### `tmpOutputPath(suffix, ...extras)`\n\nReturn a random tmp dir path in the output path\n\n```javascript\nTestEnv.tmpOutputPath('blah', 'one', 'two')\n// = '/project/test/output/tmp-blah/one/two'\n```\n\n----\n#### `randomHex(n)`\n\nCreate a random hex string n chars long\n\n```javascript\nTestEnv.randomHex(5)\n// = 'c8fd2'\n```\n\n----\n#### `cleanAsync(dir)`\n\nPromise to clean a directory that must be inside the base path.\n\n`DEBUG_CLEAN` makes this skip the removals\n\n\n----\n#### `cleanAllOutputAsync()`\n\nPromise to clean everything in the `output/` dir\n\n`DEBUG_CLEAN` makes this skip the removals\n\n\n----\n#### `cleanOutputAsync(subdir)`\n\nPromise to clean a named `output/subdir`\n\n`DEBUG_CLEAN` makes this skip the removals\n\n\n----\n#### `cleanAllOutputTmpAsync()`\n\nPromise to clean any `tmp-*` dirs created (Named with `tmp_output_dir_prefix`)\n\n`DEBUG_CLEAN` makes this skip the removals\n\n\n----\n#### `cleanOutputTmpAsync(suffix)`\n\nPromise to clean a named `output/tmp-suffix` dir\n\n`DEBUG_CLEAN` makes this skip the removals\n\n\n----\n#### `mkdirOutputAsync(...args)`\n\nPromise to make the named directorys in `output/`.\n\n\n----\n#### `mkdirOutputTmpAsync(suffix)`\n\nPromise to make a temp directory `output/tmp-${suffix}`.\n\n\n----\n#### `removeTmpPrefixFromPath(tmppath)`\n\nRemove the current temp directory from a path\n\n```javascript\nTestEnv.removeTmpPrefixFromPath('/project/test/output/tmp-output/whatever')\n// = 'output/whatever'\n```\n\n----\n#### `copyAsync(src, dest, options)`\n\nPromise to copt a directory to a destination\n\n\n----\n#### `copyFixtureToTmpOutputAsync(fixture_suffix)`\n\nPromise to copy a `fixture/` path to `output/tmp-{random}`\n\n\n----\n#### `copyFixtureToOutputAsync(fixture_suffix, output_suffix)`\n\nPromise to copy a `fixture/` path to `output/`\n\n```javascript\nTestEnv.copyFixtureToOutputAsync('config', 'somedir')\n// = cp -r /project/test/fixture/config /project/test/output/somedir\n```\n\n\n## About\n\n@mhio/test is released under the MIT license.\n\nCopyright 2019 mhio\n\nhttps://github.com/mhio/node-mhio-test\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhio%2Fnode-mhio-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhio%2Fnode-mhio-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhio%2Fnode-mhio-test/lists"}