Sfoglia il codice sorgente

Used fs.existsSync that doesn't exists in nodejs 0.6 that is used by travis for testing.

tags/0.7.3
Daniel Fagerstrom 13 anni fa
parent
commit
3ee2574e21
1 ha cambiato i file con 10 aggiunte e 1 eliminazioni
  1. +10
    -1
      test/mustache-spec-test.js

+ 10
- 1
test/mustache-spec-test.js Vedi File

@@ -41,10 +41,19 @@ var noSkip = process.env.NOSKIP;
// variable (e.g. TEST=interpolation mocha test/mustache-spec-test.js) // variable (e.g. TEST=interpolation mocha test/mustache-spec-test.js)
var fileToRun = process.env.TEST; 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; var specFiles;
if (fileToRun) { if (fileToRun) {
specFiles = [fileToRun]; specFiles = [fileToRun];
} else if (fs.existsSync(specsDir)) {
} else if (existsDir(specsDir)) {
specFiles = fs.readdirSync(specsDir).filter(function (file) { specFiles = fs.readdirSync(specsDir).filter(function (file) {
return (/\.json$/).test(file); return (/\.json$/).test(file);
}).map(function (file) { }).map(function (file) {


Loading…
Annulla
Salva