Skip to content

Commit

Permalink
Fix test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 17, 2019
1 parent f516e8f commit fdb38bc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/helpers/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ const GULPFILES_DIR = `${__dirname}/gulpfiles`
// - `gulp --gulpfile GULPFILE TASK` is fired using `execa`
// - the exit code, stdout and stderr are snapshot
export const snapshotTest = async function({ t, methodProps = {}, data }) {
const opts = getOpts({ methodProps, data })
const { exitCode, stdout, stderr } = await fireTask({
...methodProps,
...data,
opts: { ...methodProps.opts, ...data.opts },
opts,
})
// eslint-disable-next-line no-restricted-globals, no-console
console.log(exitCode)
Expand All @@ -22,6 +23,15 @@ export const snapshotTest = async function({ t, methodProps = {}, data }) {
t.pass()
}

const getOpts = function({ methodProps, data }) {
// Allows testing when `opts` is `undefined`
if (methodProps.opts === undefined && data.opts === undefined) {
return
}

return { ...methodProps.opts, ...data.opts }
}

const fireTask = async function({
// Test gulpfile to use
method,
Expand Down

0 comments on commit fdb38bc

Please sign in to comment.