Skip to content
Browse files

Replace Makefile with npm commands for more OS compatibility.

  • Loading branch information...
1 parent 7410604 commit af17e32a39f7e0f22a0a0e918c34c3bbb898eba4 Forbes Lindesay committed with
Showing with 18 additions and 28 deletions.
  1. +1 −0 .gitignore
  2. +0 −19 Makefile
  3. +6 −1 package.json
  4. +11 −8 test/lib/utils.js
View
1 .gitignore
@@ -1,3 +1,4 @@
.DS_Store
*.sw[pon]
node_modules
+npm-debug.log
View
19 Makefile
@@ -1,19 +0,0 @@
-test:
- @./node_modules/.bin/mocha --reporter list
-
-test-fetch:
- @./node_modules/.bin/mocha test/test.fetch.js --reporter list
-
-test-minify:
- @./node_modules/.bin/mocha test/test.minify.js --reporter list
-
-test-insert:
- @./node_modules/.bin/mocha test/test.insert.js --reporter list
-
-test-compile:
- @./node_modules/.bin/mocha test/test.compile.js --reporter list
-
-test-serve:
- @./node_modules/.bin/mocha test/test.serve.js --reporter list
-
-.PHONY: test
View
7 package.json
@@ -31,6 +31,11 @@
"zombie": "1.3.1"
},
"scripts": {
- "test": "make test"
+ "test": "mocha --reporter list",
+ "test-fetch": "mocha test/test.fetch.js --reporter list",
+ "test-minify": "mocha test/test.minify.js --reporter list",
+ "test-insert": "mocha test/test.insert.js --reporter list",
+ "test-compile": "mocha test/test.compile.js --reporter list",
+ "test-serve": "mocha test/test.serve.js --reporter list"
}
}
View
19 test/lib/utils.js
@@ -1,6 +1,7 @@
var fs = require('fs');
var should = require('should');
var utils = require('../../lib/utils');
+var q = require('q');
/**
* Function: expectFilesToMatch
@@ -14,15 +15,17 @@ var utils = require('../../lib/utils');
* otherwise
*/
exports.expectFilesToMatch = function(fileNameA, fileNameB) {
- var expected;
- return utils.readFile(fileNameA)
- .then(function(contents) {
- expected = contents;
- return utils.readFile(fileNameB);
- })
- .then(function(contents) {
+ var expected = utils.readFile(fileNameA);
+ var actual = utils.readFile(fileNameB);
+
+ return q.all([expected, actual])
+ .spread(function(expected, actual) {
+ // make line-endings consistent
+ actual = actual.replace('\r\n', '\n');
+ expected = expected.replace('\r\n', '\n');
+
try {
- contents.should.eql(expected);
+ actual.should.equal(expected);
} catch (error) {
// don't print out contents and expected because they are too large
throw new Error("Contents don't match expected.");

0 comments on commit af17e32

Please sign in to comment.
Something went wrong with that request. Please try again.