Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return () => {
let dirname = path.join(tmpDir, `transloadify_test_${testno++}`)
let client = new TransloaditClient({ authKey, authSecret })
return Q.nfcall(fs.mkdir, dirname)
.then(() => {
for (let evt of ['exit', 'SIGINT', 'uncaughtException']) {
process.on(evt, () => {
try {
rimraf.sync(dirname)
} catch (e) {
if (e.code !== 'ENOENT') throw e
}
process.exit()
})
}
process.chdir(dirname)
return cb(client)
}).fin(() => {
process.chdir(cwd)
after(function () {
let client = new TransloaditClient({ authKey, authSecret })
return Q.nfcall(client.deleteTemplate.bind(client), templateId)
})
})
before(function () {
let client = new TransloaditClient({ authKey, authSecret })
return Q.nfcall(client.createTemplate.bind(client), {
name: 'originalName',
template: JSON.stringify({ stage: 0 })
}).then(response => { templateId = response.id })
})
'assembly-notifications': require('./notifications'),
bills: require('./bills'),
help
}
let command = commands[invocation.mode]
if (invocation.action) command = command[invocation.action]
let client
if (!['help', 'version', 'register'].indexOf(invocation.mode) !== -1) {
if (!process.env.TRANSLOADIT_KEY || !process.env.TRANSLOADIT_SECRET) {
output.error('Please provide API authentication in the environment variables TRANSLOADIT_KEY and TRANSLOADIT_SECRET')
process.exit(1)
}
client = new TransloaditClient({
authKey: process.env.TRANSLOADIT_KEY,
authSecret: process.env.TRANSLOADIT_SECRET
})
}
command(output, client, invocation)