Skip to content

Commit 0043efd

Browse files
committed
fix: Check if commands include at least one of "url", "file" or "wait" parameters
Fail, if the command object is empty.
1 parent c127424 commit 0043efd

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Gruntfile.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,31 @@ module.exports = function (grunt) {
130130
file: 'dynamic-third.html'
131131
}
132132
]
133+
},
134+
'no-input': {
135+
options: {
136+
force: true
137+
},
138+
pages: [
139+
{}
140+
]
141+
},
142+
'invalid-file': {
143+
options: {
144+
force: true
145+
},
146+
'//': {
147+
url: 'http://localhost:8881'
148+
}
149+
},
150+
'invalid-dest': {
151+
options: {
152+
dest: '//',
153+
force: true
154+
},
155+
dummy: {
156+
url: 'http://localhost:8881'
157+
}
133158
}
134159
},
135160

tasks/html-dom-snapshot.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ module.exports = function (grunt) {
8484
if (url) {
8585
grunt.verbose.writeln('Taking a snapshot of ' + url + '...');
8686
} else {
87+
if (!(file || wait)) {
88+
throw new Error('Missing parameters "url", "file" or "wait" ' +
89+
'in the target "' + target + '".');
90+
}
8791
grunt.verbose.writeln('Preparing the next snapshot...');
8892
}
8993
return client.setViewportSize(pageOptions.viewport)

0 commit comments

Comments
 (0)