-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
60 lines (60 loc) · 5.98 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
"name": "grunt-mocha",
"description": "Grunt task for running client-side Mocha specs in PhantomJS",
"version": "0.3.1",
"homepage": "https://github.com/kmiyashiro/grunt-mocha",
"author": {
"name": "Kelly Miyashiro",
"email": "miyashiro.kelly@gmail.com",
"url": "http://non-diligent.com"
},
"repository": {
"type": "git",
"url": "git://github.com/kmiyashiro/grunt-mocha.git"
},
"bugs": {
"url": "https://github.com/kmiyashiro/grunt-mocha/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/kmiyashiro/grunt-mocha/blob/master/LICENSE-MIT"
}
],
"main": "Gruntfile.js",
"engines": {
"node": "*"
},
"scripts": {
"test": "./node_modules/.bin/grunt test"
},
"dependencies": {
"grunt-lib-phantomjs": "~0.3",
"mocha": "~1.8"
},
"peerDependencies": {
"grunt": "~0.4"
},
"devDependencies": {
"grunt": "~0.4",
"grunt-contrib-connect": "~0.2",
"grunt-contrib-jshint": "~0.3"
},
"keywords": [
"gruntplugin mocha test phantomjs"
],
"contributors": [
{
"name": "Kelly Miyashiro",
"email": "miyashiro.kelly@gmail.com"
},
{
"name": "Tony Narlock",
"email": "tony@git-pull.com"
}
],
"readme": "Automatically run *client-side* mocha specs via grunt/mocha/PhantomJS\n\nFor a grunt task for server-side mocha tests, see https://github.com/yaymukund/grunt-simple-mocha\n\n# Grunt Compatibility\n\n* Grunt 0.4: grunt-mocha 0.2+\n* Grunt 0.3: grunt-mocha 0.1\n\n**Grunt 0.4.0 migration details in [HISTORY.md](HISTORY.md#020)**\n\n# grunt-mocha\n\n(package/README format heavily borrowed from [grunt-jasmine-task](https://github.com/creynders/grunt-jasmine-task) and builtin QUnit task)\n\n[Grunt](https://github.com/cowboy/grunt) plugin for running Mocha browser specs in a headless browser (PhantomJS)\n\n## Getting Started\n\n### Task config\n\n```js\nmocha: {\n // runs all html files (except test2.html) in the test dir\n // In this example, there's only one, but you can add as many as\n // you want. You can split them up into different groups here\n // ex: admin: [ 'test/admin.html' ]\n all: [ 'test/**/!(test2).html' ],\n \n // Runs 'test/test2.html' with specified mocha options.\n // This variant auto-includes 'bridge.js' so you do not have\n // to include it in your HTML spec file. Instead, you must add an\n // environment check before you run `mocha.run` in your HTML.\n test2: {\n // Test files\n src: [ 'example/test/test2.html' ],\n options: {\n // mocha options\n mocha: {\n ignoreLeaks: false,\n grep: 'food'\n },\n\n // Select a Mocha reporter - http://visionmedia.github.com/mocha/#reporters\n reporter: 'Nyan',\n\n // Indicates whether 'mocha.run()' should be executed in \n // 'bridge.js'. If you include `mocha.run()` in your html spec, you\n // must wrap it in a conditional check to not run if it is opened\n // in PhantomJS, see example/test/test2.html\n run: true\n }\n },\n\n // Runs the same as test2 but with URL's\n test3: {\n // Test files\n options: {\n // mocha options\n mocha: {\n ignoreLeaks: false,\n grep: 'food'\n },\n\n // URLs passed through as options\n urls: [ 'http://localhost:' + port + '/example/test/test2.html' ],\n\n // Indicates whether 'mocha.run()' should be executed in \n // 'bridge.js'\n run: true\n }\n }\n}\n```\n\n### Vanilla JS\n\n#### Option 1 (recommended)\n\n- Write mocha task description in grunt config using and specify `run: true` option (see `example/grunt.js` for details);\n- Check for PhantomJS `userAgent` in a test html file and run tests only in a real browser (see `example/test/test2.html` for details).\n\nIn this case you shouldn't include `bridge.js` (it will be included automatically) and tests will be run from `bridge.js`.\n\n#### Option 2\n\nAlternatively, include `bridge.js` from `tasks/phantomjs` after you include `mocha.js` and run `mocha.setup` in your HTML file. The helper will override `mocha.setup` if it detects PhantomJS. See `example/test/test.html`.\n\n### AMD\n\nMocha **must** be included via script tag in the header. There is no need to load Mocha via AMD. You may load other testing libs via AMD if that gives you a fuzzy feeling.\n\nExample setup with AMD (advanced): https://gist.github.com/2655876\n\n### Grunt and this plugin\n\nFirst, make sure you have grunt installed globally, `npm install grunt -g`\n\nInstall this grunt plugin next to your project's [grunt.js gruntfile](https://github.com/cowboy/grunt/blob/master/docs/getting_started.md) with: `npm install grunt-mocha`\n\nThen add this line to your project's `grunt.js` gruntfile at the bottom:\n\n```javascript\ngrunt.loadNpmTasks('grunt-mocha');\n```\n\nAlso add this to the `grunt.initConfig` object in the same file:\n\n```javascript\nmocha: {\n index: ['specs/index.html']\n},\n```\n\nReplace `specs/index.html` with the location of your mocha spec running html file.\n\nNow you can run the mocha task with `grunt mocha`, but it won't work. That's because you need...\n\n### PhantomJS\n\nThis task is for running Mocha tests in a headless browser, PhantomJS. [See the FAQ on how to install PhantomJS](https://github.com/gruntjs/grunt/blob/master/docs/faq.md#why-does-grunt-complain-that-phantomjs-isnt-installed).\n\n### Mocha\n\nUse [Mocha](http://visionmedia.github.com/mocha/)\n\n### Hacks\n\nThe PhantomJS -> Grunt superdimensional conduit uses `alert`. If you have disabled or aliased alert in your app, this won't work. I have conveniently set a global `PHANTOMJS` on `window` so you can conditionally override alert in your app.\n\n## License\nCopyright (c) 2012 Kelly Miyashiro\nLicensed under the MIT license.\n",
"readmeFilename": "README.md",
"_id": "grunt-mocha@0.3.1",
"_from": "grunt-mocha@~0.3.0"
}