{"id":19560698,"url":"https://github.com/zoubin/task-tape","last_synced_at":"2025-02-26T08:42:00.498Z","repository":{"id":65514725,"uuid":"43683370","full_name":"zoubin/task-tape","owner":"zoubin","description":"Tape with gulpish task support","archived":false,"fork":false,"pushed_at":"2015-11-24T03:22:56.000Z","size":34,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-08T22:43:43.383Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zoubin.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","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":"2015-10-05T12:38:58.000Z","updated_at":"2016-07-18T14:55:40.000Z","dependencies_parsed_at":"2023-01-26T21:05:11.347Z","dependency_job_id":null,"html_url":"https://github.com/zoubin/task-tape","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Ftask-tape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Ftask-tape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Ftask-tape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Ftask-tape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoubin","download_url":"https://codeload.github.com/zoubin/task-tape/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240822615,"owners_count":19863302,"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":[],"created_at":"2024-11-11T05:08:30.328Z","updated_at":"2025-02-26T08:42:00.452Z","avatar_url":"https://github.com/zoubin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# task-tape\n[Tape](https://github.com/substack/tape) with [gulpish task support](https://github.com/gulpjs/gulp/blob/master/docs/API.md#async-task-support).\n\n[![version](https://img.shields.io/npm/v/task-tape.svg)](https://www.npmjs.org/package/task-tape)\n[![status](https://travis-ci.org/zoubin/task-tape.svg?branch=master)](https://travis-ci.org/zoubin/task-tape)\n[![dependencies](https://david-dm.org/zoubin/task-tape.svg)](https://david-dm.org/zoubin/task-tape)\n[![devDependencies](https://david-dm.org/zoubin/task-tape/dev-status.svg)](https://david-dm.org/zoubin/task-tape#info=devDependencies)\n\n## Usage\n\n### Global installation\n```bash\nnpm install -g task-tape\n\n```\n\nGo to your project directory, which has tape installed already:\n\n```bash\ntask-tape test/*.js\n\n```\n\nOr with babel (please install babel first):\n\n```bash\ntask-tape --babel test/*.js\n\n```\n\n\n### Local installation\n\n```bash\nnpm install --save-dev task-tape tape\n\n```\n\n### Require directly\n\n```javascript\nvar test = require('task-tape')\n\n```\n\n### Hook require\n\n```javascript\nrequire('task-tape')\nvar test = require('tape')\n\n```\n\n### With [gulp-tape](https://www.npmjs.com/package/gulp-tape)\n\n```javascript\ngulp.task('test', function test() {\n  require('task-tape')\n  var tape = require('gulp-tape')\n  var reporter = require('tap-spec')\n  return gulp.src('test/*.js')\n    .pipe(tape({\n      reporter: reporter(),\n    }))\n})\n\n```\n\n### npm test\n\nIn `package.json`:\n\n```json\n{\n  \"scripts\": {\n    \"test\": \"task-tape test/*.js\"\n  }\n}\n\n```\n\nTo support babel:\n\n```json\n{\n  \"scripts\": {\n    \"test\": \"task-tape --babel test/*.js\"\n  }\n}\n\n```\n\n\n## Example\n\n### End the test\n\n#### `t.end`\n\n```javascript\nimport test from 'tape'\n\ntest('sync', (t) =\u003e {\n  t.ok(true)\n  t.ok(true)\n  t.end()\n})\n\ntest('async', (t) =\u003e {\n  process.nextTick(() =\u003e {\n    t.ok(true)\n    t.end()\n  })\n  t.ok(true)\n})\n\n```\n\n#### `t.plan`\n\n```javascript\nimport test from 'tape'\n\ntest('async', (t) =\u003e {\n  t.plan(2)\n  process.nextTick(() =\u003e {\n    t.ok(true)\n  })\n  t.ok(true)\n})\n\n```\n\n### Gulpish callback\n\n```javascript\nimport test from 'tape'\nimport concat from 'concat-stream'\n\n// accept a callback\ntest('callback', (t, cb) =\u003e {\n  process.nextTick(() =\u003e {\n    t.ok(true)\n    cb()\n  })\n})\n\n// return a promise\ntest('promise', (t) =\u003e {\n  return new Promise((rs) =\u003e {\n    process.nextTick(() =\u003e {\n      t.ok(true)\n      rs()\n    })\n  })\n})\n\n// return a stream\ntest('stream', (t) =\u003e {\n  let s = concat({ encoding: 'object' }, (rows) =\u003e {\n    t.same(rows, [ { x: 1 }, { y: 2 }, { z: 3 } ])\n  })\n  s.write({ x: 1 })\n  s.write({ y: 2 })\n  process.nextTick(() =\u003e {\n    s.end({ z: 3 })\n  })\n  return s\n})\n\n```\n\n### Gulpish callbacks in sequence\n\n```javascript\nimport test from 'tape'\nimport concat from 'concat-stream'\nimport gulp from 'gulp'\nimport fs from 'fs'\nimport del from 'del'\n\n// Run tasks in sequence.\ntest('tasks in sequence', function(t) {\n  // t.plan(7)\n\n  let rows = []\n\n  // clean\n  t.task(() =\u003e {\n    t.ok(true)\n    return del('build')\n  })\n\n  // delay\n  t.task((cb) =\u003e {\n    t.ok(true)\n    setTimeout(() =\u003e {\n      cb()\n    }, 100)\n  })\n\n  // collect rows\n  t.task(() =\u003e {\n    t.ok(true)\n    let stream = thr.obj()\n\n    stream.write({ index: 0 })\n\n    process.nextTick(() =\u003e {\n      stream.end({ index: 1 })\n    })\n\n    return stream.pipe(concat({ encoding: 'object' }, function (rs) {\n      rows = rs.sort((a, b) =\u003e {\n        return a.index \u003c b.index ? 1 : -1\n      })\n    }))\n  })\n\n  // stringify rows\n  t.task(() =\u003e {\n    t.same(rows, [ { index: 1 }, { index: 0 } ])\n    let ws = fs.createWriteStream('rows.json')\n\n    process.nextTick(() =\u003e {\n      ws.end(JSON.stringify(rows, null, 2))\n    })\n\n    return ws\n  })\n\n  // build\n  t.task(() =\u003e {\n    t.ok(true)\n    return gulp.src('rows.json')\n      .pipe(gulp.dest('build'))\n  })\n\n  // check\n  t.task(() =\u003e {\n    t.equal(\n      fs.readFileSync('rows.json', 'utf8'),\n      fs.readFileSync('build/rows.json', 'utf8')\n    )\n  })\n\n  // clean\n  t.task(() =\u003e {\n    t.ok(true)\n    return del('rows.json')\n  })\n})\n\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoubin%2Ftask-tape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoubin%2Ftask-tape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoubin%2Ftask-tape/lists"}