Skip to content

Commit

Permalink
add grunt-mocha-phantomjs
Browse files Browse the repository at this point in the history
  • Loading branch information
Layzie committed Feb 9, 2014
1 parent 4fd4dc7 commit bf3de62
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
17 changes: 17 additions & 0 deletions Gruntfile.js
Expand Up @@ -52,6 +52,19 @@
'mochai.min.js': ['mochai.js']
}
}
},
mocha_phantomjs: {
no_output: {
options: {
'reporter': 'dot'
},
files: {
src: [
'spec/global.html',
'spec/requirejs.html'
]
}
}
}
});

Expand All @@ -70,6 +83,10 @@
'jsdoc'
]);

// task: test
grunt.registerTask('test', [
'mocha_phantomjs'
]);
// task: defulat
grunt.registerTask('default', [
'clean',
Expand Down
32 changes: 32 additions & 0 deletions README.md
Expand Up @@ -220,6 +220,38 @@ mochaiは[phantomjs](http://phantomjs.org/)を利用してCUIでもテストを

- `./node_modules/mocha-phantomjs/bin/mocha-phantomjs TESTDIRECTORY/test.html`のように指定してテストを実行してください。詳しくは[mocha-phantomjsのfork版](https://github.com/Layzie/mocha-phantomjs)[README.md](https://github.com/Layzie/mocha-phantomjs/blob/multiple-task/README.md)を参照ください。

### grunt-mochai-phantomjs

元々あった [jdcataldo/grunt-mocha-phantomjs](https://github.com/jdcataldo/grunt-mocha-phantomjs)をforkして
[Layzie/grunt-mocha-phantomjs](https://github.com/Layzie/grunt-mocha-phantomjs)というmochai向けのGruntタスクを作っています。

`package.json`に以下の記述を入れます。

```json
"devDependencies": {
"grunt-mocha-phantomjs": "git://github.com/Layzie/grunt-mocha-phantomjs#apply_mochai",
}
```

その後、`Gruntfile.js`に以下のようにタスクを登録して使用できます。

```javascript
grunt.initConfig({
mocha_phantomjs: {
all: ['test/**/*.html']
}
});

grunt.loadNpmTasks('grunt-mocha-phantomjs');

// task: test
grunt.registerTask('test', [
'mocha_phantomjs'
]);
```

使い方はfork元と同じ使用方法です。 [README.md](https://github.com/Layzie/grunt-mocha-phantomjs/blob/apply_mochai/README.md)を参照ください。

# Build

```
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -10,9 +10,8 @@
"grunt-mkdir": "~0.1.1",
"grunt-jsdoc": "~0.4.1",
"grunt-contrib-uglify": "~0.2.0",
"grunt-mocha-phantomjs": "git://github.com/Layzie/grunt-mocha-phantomjs#apply_mochai",
"matchdep": "~0.1.1",
"mocha-phantomjs": "git://github.com/Layzie/mocha-phantomjs#multiple-task",
"phantomjs": "*",
"mocha": "*",
"chai": "*",
"jshint": "*",
Expand Down

0 comments on commit bf3de62

Please sign in to comment.