Unixify paths to fix tests on Windows.

This commit is contained in:
Kyle Robinson Young 2013-05-01 20:25:09 -07:00
parent 3889f6b100
commit d06a7f3f5a
3 changed files with 14 additions and 0 deletions

View File

@ -42,6 +42,7 @@ exports.events = {
assertWatch([function() {
writeAll(cwd);
}], function(result) {
result = helper.unixify(result);
helper.verboseLog(result);
test.ok(result.indexOf('lib/added.js was indeed added') !== -1, 'event not emitted when file added');
test.ok(result.indexOf('lib/one.js was indeed changed') !== -1, 'event not emitted when file changed');
@ -56,6 +57,7 @@ exports.events = {
assertWatch([function() {
writeAll(cwd);
}], function(result) {
result = helper.unixify(result);
helper.verboseLog(result);
test.ok(result.indexOf('lib/added.js was indeed added') !== -1, 'event not emitted when file added');
test.ok(result.indexOf('lib/one.js was indeed changed') === -1, 'event should NOT have emitted when file changed');
@ -70,6 +72,7 @@ exports.events = {
assertWatch([function() {
writeAll(cwd);
}], function(result) {
result = helper.unixify(result);
helper.verboseLog(result);
test.ok(result.indexOf('lib/added.js was indeed added') === -1, 'event should NOT have emitted when file added');
test.ok(result.indexOf('lib/one.js was indeed changed') !== -1, 'event should have emitted when file changed');
@ -84,6 +87,7 @@ exports.events = {
assertWatch([function() {
writeAll(cwd);
}], function(result) {
result = helper.unixify(result);
helper.verboseLog(result);
test.ok(result.indexOf('lib/added.js was indeed added') === -1, 'event should NOT have emitted when file added');
test.ok(result.indexOf('lib/one.js was indeed changed') === -1, 'event should NOT have emitted when file changed');
@ -98,6 +102,7 @@ exports.events = {
assertWatch([function() {
writeAll(cwd);
}], function(result) {
result = helper.unixify(result);
helper.verboseLog(result);
test.ok(result.indexOf('lib/added.js was indeed added') !== -1, 'event should have emitted when file added');
test.ok(result.indexOf('lib/one.js was indeed changed') === -1, 'event should NOT have emitted when file changed');

View File

@ -97,3 +97,9 @@ helper.cleanUp = function cleanUp(files) {
}
});
};
// Helper for testing cross platform
helper.unixify = function(str) {
str = grunt.util.normalizelf(str);
return str.replace(/\\/g, '/');
};

View File

@ -53,6 +53,7 @@ exports.livereload = {
grunt.file.write(path.join(cwd, 'lib', 'one.js'), 'var one = true;');
});
}], function(result) {
result = helper.unixify(result);
helper.verboseLog(result);
test.ok(result.indexOf('I ran before livereload.') !== -1, 'task should have ran before live reload.');
test.ok(result.indexOf('Live reload server started on port: 35729') !== -1, 'live reload server should have been started on port 35729.');
@ -73,6 +74,7 @@ exports.livereload = {
grunt.file.write(path.join(cwd, 'lib', 'one.js'), 'var one = true;');
});
}], function(result) {
result = helper.unixify(result);
helper.verboseLog(result);
test.ok(result.indexOf('I ran before livereload.') !== -1, 'task should have ran before live reload.');
test.ok(result.indexOf('Live reload server started on port: 8675') !== -1, 'live reload server should have been started on port 35729.');
@ -93,6 +95,7 @@ exports.livereload = {
grunt.file.write(path.join(cwd, 'lib', 'one.js'), 'var one = true;');
});
}], function(result) {
result = helper.unixify(result);
helper.verboseLog(result);
test.ok(result.indexOf('I ran before livereload.') !== -1, 'task should have ran before live reload.');
test.ok(result.indexOf('Live reload server started on port: 1337') !== -1, 'live reload server should have been started on port 35729.');