{"_id":"@test-runner/core","_rev":"395102","name":"@test-runner/core","description":"Minimal, extensible, isomorphic test runner.","dist-tags":{"latest":"0.10.0"},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"time":{"modified":"2021-08-04T04:08:45.000Z","created":"2021-07-04T10:31:35.760Z","0.10.0":"2021-07-04T10:31:35.760Z"},"users":{},"author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/test-runner-js/core.git"},"versions":{"0.10.0":{"name":"@test-runner/core","author":{"name":"Lloyd Brookes","email":"75pound@gmail.com"},"version":"0.10.0","description":"Minimal, extensible, isomorphic test runner.","repository":{"type":"git","url":"git+https://github.com/test-runner-js/core.git"},"exports":{"import":"./index.mjs","require":"./dist/index.cjs"},"license":"MIT","keywords":["test","runner","minimal","simple","easy","tape","tap","ava","mocha"],"engines":{"node":">=14"},"scripts":{"test":"npm run dist && test-runner --view.hide-skips test/*.mjs","dist":"rollup -c","watch":"rollup -cw","docs":"jsdoc2md -c jsdoc.conf index.mjs > docs/API.md && jsdoc2md -c jsdoc.conf lib/view.mjs > docs/view.md"},"dependencies":{"@test-runner/tom":"^0.8.0","fsm-base":"^0.7.0"},"devDependencies":{"@rollup/plugin-node-resolve":"^13.0.0","isomorphic-assert":"^0.2.0","jsdoc-to-markdown":"^7.0.1","node-fetch":"^2.6.1","rollup":"^2.52.7","sleep-anywhere":"^1.1.3","test-runner":"^0.9.5"},"standard":{"ignore":["tmp","dist"]},"gitHead":"3821ee47a7667ba4e634d3bfd1522f319581cfad","bugs":{"url":"https://github.com/test-runner-js/core/issues"},"homepage":"https://github.com/test-runner-js/core#readme","_id":"@test-runner/core@0.10.0","_nodeVersion":"16.4.1","_npmVersion":"7.19.1","dist":{"shasum":"e6551e31872b7a9ba09dea8753deebc6fb4558e7","size":18855,"noattachment":false,"key":"/@test-runner/core/-/@test-runner/core-0.10.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@test-runner/core/download/@test-runner/core-0.10.0.tgz"},"_npmUser":{"name":"75lb","email":"75pound@gmail.com"},"directories":{},"maintainers":[{"name":"75lb","email":"75pound@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/core_0.10.0_1625394695631_0.27642142713682594"},"_hasShrinkwrap":false,"publish_time":1625394695760,"_cnpm_publish_time":1625394695760}},"readme":"[![view on npm](https://badgen.net/npm/v/@test-runner/core)](https://www.npmjs.org/package/@test-runner/core)\n[![npm module downloads](https://badgen.net/npm/dt/@test-runner/core)](https://www.npmjs.org/package/@test-runner/core)\n[![Gihub repo dependents](https://badgen.net/github/dependents-repo/test-runner-js/core)](https://github.com/test-runner-js/core/network/dependents?dependent_type=REPOSITORY)\n[![Gihub package dependents](https://badgen.net/github/dependents-pkg/test-runner-js/core)](https://github.com/test-runner-js/core/network/dependents?dependent_type=PACKAGE)\n[![Node.js CI](https://github.com/test-runner-js/core/actions/workflows/node.js.yml/badge.svg)](https://github.com/test-runner-js/core/actions/workflows/node.js.yml)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n# @test-runner/core\n\n***This documentation is a work in progress.***\n\nIsomophic test runner. Takes a test-object-model instance as input, streaming progress info to the attached view or listener. Used by test-runner and web-runner.\n\n## Synopsis\n\nThis trivial example creates a test object model containing one passing and one failing test. The model is passed to a `TestRunnerCore` instance, along with the default view, which then runs the tests printing the result to the console.\n\n```js\nimport TestRunnerCore from '@test-runner/core'\nimport Tom from '@test-runner/tom'\n\n/* Define a simple test model */\nconst tom = new Tom()\n\ntom.test('A successful test', function () {\n  return 'This passed'\n})\n\ntom.test('A failing test', function () {\n  throw new Error('This failed')\n})\n\n/* send test-runner output to the default view  */\nconst view = new DefaultView()\n\n/* run the tests defined in the test model */\nconst runner = new TestRunnerCore(tom, { view })\nrunner.start()\n```\n\nOutput.\n\n```\n$ nodem tmp/synopsis.mjs\n\nStart: 2 tests loaded\n\n ✓ tom A successful test [This passed]\n ⨯ tom A failing test\n\n   Error: This failed\n       at TestContext.<anonymous> (file:///Users/lloyd/Documents/test-runner-js/core/tmp/synopsis.mjs:13:9)\n       ...\n       at processTimers (internal/timers.js:475:7)\n\n\nCompleted in 11ms. Pass: 1, fail: 1, skip: 0.\n```\n\nInstead of passing a `view` instance to `TestRunnerCore`, this example shows how to observe `runner` events and print your own output.\n\n```js\nconst runner = new TestRunnerCore(tom)\n\nrunner.on('state', (state, prevState) => {\n  console.log(`Runner state change: ${prevState} -> ${state}`)\n})\nrunner.on('test-pass', test => {\n  console.log(`Test passed: ${test.name}`)\n})\nrunner.on('test-fail', test => {\n  console.log(`Test failed: ${test.name}`)\n})\nrunner.start().then(() => {\n  console.log(`Test run complete. State: ${runner.state}, passed: ${runner.stats.pass}, failed: ${runner.stats.fail}`)\n})\n```\n\nOutput.\n\n```\n$ node --experimental-modules synopsis.mjs\nRunner state change: pending -> in-progress\nTest passed: A successful test\nTest failed: A failing test\nRunner state change: in-progress -> fail\nTest run complete. State: fail, passed: 1, failed: 1\n```\n\n## See also\n\n* [API docs](https://github.com/test-runner-js/core/blob/master/docs/API.md)\n\n* * *\n\n&copy; 2016-21 Lloyd Brookes \\<75pound@gmail.com\\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).\n","_attachments":{},"homepage":"https://github.com/test-runner-js/core#readme","bugs":{"url":"https://github.com/test-runner-js/core/issues"},"license":"MIT"}