Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Used fs.existsSync that doesn't exists in nodejs 0.6 that is used by …
…travis for testing.
  • Loading branch information
danielfagerstrom committed Mar 17, 2013
commit 3ee2574e219fc615e3aaca5b2f4204cfb2577a88
11 changes: 10 additions & 1 deletion test/mustache-spec-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,19 @@ var noSkip = process.env.NOSKIP;
// variable (e.g. TEST=interpolation mocha test/mustache-spec-test.js)
var fileToRun = process.env.TEST;

// Mustache should work on node 0.6 that doesn't have fs.exisisSync
function existsDir(path) {
try {
return fs.statSync(path).isDirectory();
} catch (x) {
return false;
}
}

var specFiles;
if (fileToRun) {
specFiles = [fileToRun];
} else if (fs.existsSync(specsDir)) {
} else if (existsDir(specsDir)) {
specFiles = fs.readdirSync(specsDir).filter(function (file) {
return (/\.json$/).test(file);
}).map(function (file) {
Expand Down