You can always use fs.existsSync()
: http://nodejs.org/api/fs.html#fs_fs_exists_path_callback. Be sure to use the sync one, Grunt doesn't like async functions.
Also; make sure you return a boolean.
At the top of your Gruntfile.js
:
var fs = require('fs');
In your task settings;
copy: {
unit: {
expand: true,
cwd: 'src',
src: '**',
dest: 'specs/unit',
filter: function(filepath){
return !fs.existsSync(filepath);
}
}
},