-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added coffeescript loader for node Added coffeescript test for node Moved node tests into /test
- Loading branch information
1 parent
98c6579
commit 036bf6c
Showing
30 changed files
with
125 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var fs = require("fs"), | ||
path = require("path"); | ||
|
||
module.exports = function(blanket){ | ||
var coffeeScript = require("coffee-script"); | ||
var oldLoaderCS = require.extensions['.coffee']; | ||
|
||
require.extensions['.coffee'] = function(localModule, filename) { | ||
|
||
var pattern = blanket.options("filter"); | ||
filename = blanket.normalizeBackslashes(filename); | ||
if (blanket.matchPattern(filename,pattern)){ | ||
|
||
var content = fs.readFileSync(filename, 'utf8'); | ||
content = coffeeScript.compile(content); | ||
blanket.instrument({ | ||
inputFile: content, | ||
inputFileName: filename | ||
},function(instrumented){ | ||
var baseDirPath = blanket.normalizeBackslashes(path.dirname(filename))+'/.'; | ||
try{ | ||
instrumented = instrumented.replace(/require\s*\(\s*("|')\./g,'require($1'+baseDirPath); | ||
localModule._compile(instrumented, filename); | ||
} | ||
catch(err){ | ||
console.log("Error parsing instrumented code: "+err); | ||
} | ||
}); | ||
}else{ | ||
oldLoaderCS(localModule,filename); | ||
} | ||
}; | ||
}; |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module.exports = -> | ||
10 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
var blanket = require("../../src/index"); | ||
blanket.options("filter","src/sample"); | ||
|
||
require("./tests/coffee-script/test.coffee"); |
4 changes: 2 additions & 2 deletions
4
test-node/tests/blanket_core.js → test/test-node/tests/blanket_core.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sampleTest = require("../../fixture/src/sample.coffee") | ||
assert = require("assert") | ||
describe "require test", -> | ||
it "should return 10", -> | ||
assert.equal 10, sampleTest() |
Oops, something went wrong.