I want to include my linkchecker test into grunt. I can execute it just fine with powershell
& 'C:\Program Files (x86)\LinkChecker\linkchecker.exe' http://localhost:3000
This is my Gruntfile:
module.exports = function (grunt) {
//load plugins
[
'grunt-cafe-mocha',
'grunt-contrib-jshint',
'grunt-exec',
].forEach(
function(task){
grunt.loadNpmTasks(task);
}
);
//configure plugins
grunt.initConfig(
{
/* cafemocha: {
all: {
src: 'qa/tests-*.js',
options: {
ui: 'tdd',
}
}
},*/
jshint: {
app: [
'meadowlark.js',
'public/js/**/*.js',
'lib/**/*.js',
],
qa: [
'Gruntfile.js',
'public/qa/**/*.js',
'qa/**/*.js,'
]
},
exec: {
linkchecker: {
cmd: '\& \'C:\\Program Files (x86)\\LinkChecker\\linkchecker.exe\' http://localhost:3000'
}
},
}
);
//register tasks
grunt.registerTask(
'default',
[/*'cafemocha',*/ 'jshint', 'exec']
);
};
I'm getting a real headache integrating that call to linkchecker into grunt. I have tried several calls for line 39:
1.Escaping everything with full path:
cmd: '& \'C:\\Program Files (x86)\\LinkChecker\\linkchecker.exe\' http://localhost:3000'
Result:
"&" kann syntaktisch an dieser Stelle nicht verarbeitet werden. Exited with code: 1.
Translation: Can't handle the &
2.Escaping everything and the &
with full path:
cmd: '\& \'C:\\Program Files (x86)\\LinkChecker\\linkchecker.exe\' http://localhost:3000'
Result:
^ [W044] Bad or unnecessary escaping.
3.Setting up a local variable for the path to linkchecker.exe:
cmd: '$env:linkchecker http://localhost:3000'
Result:
Die Syntax f�r den Dateinamen, Verzeichnisnamen oder die Datentr�gerbezeichnung ist falsch. Exited with code: 1.
Translation: The local variable $env:linkchecker
didn't get resolved
4.Outsourcing the call to a script.
cmd: '.\\qa\\linkchecker.ps1'
Result: linkchecker.ps1 gets openend in a editor.
I have also tried grunt-shell. The problem seems to be that grunt has to pass on the & to the shell. It can't handle the &
, and escaping it with \&
doesn't help either.