Fix for livereload missing files. Closes GH-191. Closes GH-192.
This commit is contained in:
parent
07c1f794b1
commit
ec207fe84d
@ -1,4 +1,4 @@
|
||||
# grunt-contrib-watch [![Build Status](https://travis-ci.org/gruntjs/grunt-contrib-watch.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-watch)
|
||||
# grunt-contrib-watch v0.5.2 [![Build Status](https://travis-ci.org/gruntjs/grunt-contrib-watch.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-watch)
|
||||
|
||||
> Run predefined tasks whenever watched file patterns are added, changed or deleted.
|
||||
|
||||
@ -425,4 +425,4 @@ Spawning does cause a performance hit (usually 500ms for most environments). It
|
||||
|
||||
Task submitted by [Kyle Robinson Young](http://dontkry.com)
|
||||
|
||||
*This file was generated on Fri Aug 16 2013 08:58:16.*
|
||||
*This file was generated on Fri Aug 23 2013 14:07:18.*
|
||||
|
@ -146,7 +146,9 @@ module.exports = function(grunt) {
|
||||
|
||||
// Add changed files to the target
|
||||
if (taskrun.targets[target.name]) {
|
||||
taskrun.targets[target.name].changedFiles = Object.create(null);
|
||||
if (!taskrun.targets[target.name].changedFiles) {
|
||||
taskrun.targets[target.name].changedFiles = Object.create(null);
|
||||
}
|
||||
taskrun.targets[target.name].changedFiles[filepath] = status;
|
||||
}
|
||||
|
||||
|
9
test/fixtures/livereload/Gruntfile.js
vendored
9
test/fixtures/livereload/Gruntfile.js
vendored
@ -21,6 +21,15 @@ module.exports = function(grunt) {
|
||||
},
|
||||
},
|
||||
},
|
||||
multiplefiles: {
|
||||
files: ['lib/*.js'],
|
||||
tasks: ['before'],
|
||||
options: {
|
||||
livereload: {
|
||||
port: 9876,
|
||||
},
|
||||
},
|
||||
},
|
||||
nospawn: {
|
||||
files: ['lib/*.js'],
|
||||
tasks: ['before'],
|
||||
|
1
test/fixtures/livereload/lib/two.js
vendored
Normal file
1
test/fixtures/livereload/lib/two.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var two = true;
|
@ -84,6 +84,28 @@ exports.livereload = {
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
multiplefiles: function(test) {
|
||||
test.expect(4);
|
||||
var resultData = '';
|
||||
var cwd = path.resolve(fixtures, 'livereload');
|
||||
var assertWatch = helper.assertTask(['watch:multiplefiles', '-v'], {cwd: cwd});
|
||||
assertWatch([function() {
|
||||
request(9876, function(data) {
|
||||
resultData += data;
|
||||
grunt.file.write(path.join(cwd, 'lib', 'one.js'), 'var one = true;');
|
||||
grunt.file.write(path.join(cwd, 'lib', 'two.js'), 'var two = 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: 9876') !== -1, 'live reload server should have been started on port 35729.');
|
||||
test.ok(/Live reloading (lib\/one\.js, lib\/two.js|lib\/two.js, lib\/one.js)\.\.\./.test(result), 'live reload should have triggered on lib/one.js and lib/two.js');
|
||||
resultData = JSON.parse(resultData);
|
||||
test.equal(resultData.tinylr, 'Welcome', 'tinylr server should have welcomed you.');
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
nospawn: function(test) {
|
||||
test.expect(4);
|
||||
var resultData = '';
|
||||
|
Loading…
Reference in New Issue
Block a user