Skip to content

Commit

Permalink
Add filter for source is es5
Browse files Browse the repository at this point in the history
  • Loading branch information
Yosuke Furukawa committed Dec 15, 2014
1 parent 6c26f94 commit ef7bc7a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
20 changes: 20 additions & 0 deletions demo/person.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* no transpile, this is */
(function(global){
"use strict";
var Person = function(name, age){
this.name = name;
this.age = age;
};
Person.prototype.getAge = function() {
return this.age;
};
Person.prototype.greet = function() {
return "Hello! I am " + this.name + ". My age is " + this.age;
}
if (module && module.exports) {
module.exports = Person;
} else {
global.Person = Person;
}
}(typeof global !== 'undefined' ? global : this));

5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ function espowerTraceur (options) {
};
traceur.require.makeDefault(function (filename) {
// Don't compile our dependencies.
return filename.indexOf('node_modules') === -1;
if (filename.indexOf('node_modules') !== -1) return false;
// Don't compile files not included our test dirs.
if (!minimatch(filename, pattern)) return false;
return true;
});
}

Expand Down
15 changes: 15 additions & 0 deletions test/person_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
let assert = require("power-assert")
let Person = require("../demo/person")

describe("Person", ()=>{
let name = "Alice"
let age = 4
let alice = new Person(name, age)
it("alice get age", ()=>{
assert.equal(alice.getAge(), age)
})
it("alice greet", ()=>{
assert.equal(alice.greet(), `Hello! I am ${name}. My age is ${age}`)
})
})

0 comments on commit ef7bc7a

Please sign in to comment.