Skip to content

Commit 3af0f6d

Browse files
committed
fix: Allow the option "force" to be used within a command only
1 parent 1107121 commit 3af0f6d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ Default value: false
236236

237237
If set to `true`, it suppresses failures, which happened during taking snapshots. Instead of making the Grunt fail, the errors will be written only to the console.
238238

239+
This option can be set for the whole task or within a single command object.
240+
239241
### Sub-tasks
240242

241243
File names for snapshots can be used as sub-task names. Separate sub-tasks initialize separate instance of the webdriver:

tasks/html-dom-snapshot.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,16 @@ module.exports = grunt => {
458458
client, command, commandOptions, detected))
459459
}
460460
}), viewportSet)
461+
.catch(error => {
462+
const force = command.options && command.options.force
463+
if (force) {
464+
grunt.output.warn(error.stack)
465+
grunt.log.warn(error)
466+
grunt.log.warn('Ignoring the command execution failure.')
467+
} else {
468+
throw error
469+
}
470+
})
461471
.then(() => {
462472
if (file) {
463473
return makeSnapshotAndScreenshot()

0 commit comments

Comments
 (0)