/
params.json
6 lines (6 loc) · 3.41 KB
/
params.json
1
2
3
4
5
6
{
"name": "Atom Mocha Test Runner",
"tagline": "Run your Atom package tests using Mocha",
"body": "# Atom Mocha Test Runner\r\n\r\n🚧 Work in Progress 🚧\r\n\r\nBy default, Atom runs your tests with Jasmine. Atom allows you to specify a custom test runner using the `atomTestRunner` field in your `package.json`, but implementing a custom test runner is not straightforward. This module allows you to run your specs using Mocha with minimal fuss.\r\n\r\n## Installation\r\n\r\n```\r\n$ apm install [--save-dev] atom-mocha-test-runner\r\n```\r\n\r\n## Usage\r\n\r\n### Default Test Runner\r\n\r\nIf you want to use all the default options, simply pass the module name as the `atomTestRunner` value in your `package.json`:\r\n\r\n```javascript\r\n{\r\n \"name\": \"my-package\",\r\n // ...\r\n \"atomTestRunner\": \"atom-mocha-test-runner\"\r\n}\r\n```\r\n\r\nNote that your `package.json` may be cached by Atom's compile cache when running tests with Atom's GUI test runner, so if adding or changing that field doesn't seem to work, try quitting and restarting Atom.\r\n\r\n### Programmatic Usage\r\n\r\nIf you'd like to perform more customization of your testing environment, you can create a custom runner while still utilizing atom-mocha-test-runner for most of the heavy lifting. First, set `atomTestRunner` to a *relative* path to a file:\r\n\r\n```javascript\r\n{\r\n \"name\": \"my-package\",\r\n // ...\r\n \"atomTestRunner\": \"./test/custom-runner\"\r\n}\r\n```\r\n\r\nThen export a test runner created via the atom-mocha-test-runner from `test/custom-runner.js`:\r\n\r\n```javascript\r\nvar createRunner = require('atom-mocha-test-runner').createRunner\r\n\r\n// optional options to customize the runner\r\nvar extraOptions = {\r\n testSuffixes: ['-spec.js', '-spec.coffee']\r\n}\r\n\r\nvar optionalConfigurationFunction = function (mocha) {\r\n // If provided, atom-mocha-test-runner will pass the mocha instance\r\n // to this function, so you can do whatever you'd like to it.\r\n}\r\n\r\nmodule.exports = createRunner(extraOptions, optionalConfigurationFunction)\r\n```\r\n\r\n#### API\r\n\r\n**`createRunner([options,] [callback])`**\r\n\r\nReturns a test runner created with the given `options` and `callback`. Both parameters are optional. The returned value can be exported from your `atomTestRunner` script for Atom to consume.\r\n\r\n* `options` - An object specifying customized options:\r\n\r\n * `options.reporter [default: 'dot']` - Which reporter to use on the terminal\r\n * `globalAtom [default: true]` - Whether or not to assign the created Atom environment to `global.atom`\r\n * `testSuffixes [default: ['test.js', 'test.coffee']]` - File extensions that indicate that the file contains tests\r\n * `colors [default: true (false on Windows)]` - Whether or not to colorize output on the terminal\r\n * `htmlTitle [default: '']` - The string to use for the window title in the HTML reporter\r\n\r\n### Making Assertions\r\n\r\natom-mocha-test-runner does not include any assertion libraries; it only includes the Mocha test runner. You can pull in any assertion library you want, but [Chai](http://chaijs.com/) is a great choice.\r\n\r\n```javascript\r\nconst assert = require('chai').assert\r\n\r\ndescribe('Testing', function () {\r\n it('works', function () {\r\n assert.equal(answerToLifeUniverseAndEverything, 42)\r\n })\r\n})\r\n````\r\n",
"note": "Don't delete this file! It's used internally to help with page regeneration."
}