Skip to content

Instantly share code, notes, and snippets.

@twada

twada/gulpfile.js

Last active Jan 31, 2016
Embed
What would you like to do?
espower-coffee を使ってコード生成を経ずに (gulp-espower を使わずに) CoffeeScript + power-assert を使うデモ (npm test でも gulp test でも動きます)
var gulp = require('gulp');
var mocha = require('gulp-mocha');
gulp.task('test', function () {
require('espower-coffee/guess');
return gulp
.src('test/**/*.coffee')
.pipe(mocha());
});
{
"name": "espower-coffee-demo",
"private": true,
"version": "1.0.0",
"description": "espower-coffee Demo",
"scripts": {
"test": "mocha --require espower-coffee/guess test/**/*.coffee"
},
"author": "Takuto Wada <takuto.wada@gmail.com>",
"license": "MIT",
"devDependencies": {
"coffee-script": "^1.8.0",
"espower-coffee": "^0.10.0",
"gulp": "^3.8.10",
"gulp-mocha": "^2.0.0",
"mocha": "^2.0.1",
"power-assert": "^0.10.0"
}
}
# このファイルは test ディレクトリに置いてください
assert = require 'power-assert'
class Person
constructor: (name, age) ->
@name = name
@age = age
describe "Coffee various types", ->
beforeEach ->
@types = [
"string"
98.6
true
false
null
`undefined`
[
"nested"
"array"
]
{
object: true
}
NaN
Infinity
/^not/
new Person("alice", 3)
]
it "demo", ->
index = @types.length - 1
bob = new Person("bob", 5)
assert @types[index].name is bob.name
@twada

This comment has been minimized.

Copy link
Owner Author

@twada twada commented Dec 8, 2014

various_types_test.coffee は test ディレクトリを作成してそこに入れてください。そうすればあとは npm install するだけで無設定で変換できます。 test ディレクトリ以外に置く場合には明示的に設定を書く必要があります。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment