Example #1
0
 it('should not throw any errors if no script', () => {
   disableLog()
   return lambda._postInstallScript(program, codeDirectory).then((dummy) => {
     enableLog()
     assert.isUndefined(dummy)
   })
 })
Example #2
0
 it('should throw any errors if script fails', () => {
   fs.writeFileSync(postInstallScriptPath, '___fails___')
   disableLog()
   return lambda._postInstallScript(program, codeDirectory).catch((err) => {
     enableLog()
     assert.instanceOf(err, Error)
     assert.match(err.message, /^Error: Command failed:/)
   })
 })
Example #3
0
 it('running script gives expected output', () => {
   fs.writeFileSync(
     postInstallScriptPath,
     fs.readFileSync(path.join('test', 'post_install.sh'))
   )
   fs.chmodSync(path.join(codeDirectory, 'post_install.sh'), '755')
   return lambda._postInstallScript(program, codeDirectory).then((dummy) => {
     assert.isUndefined(dummy)
   }).catch((err) => {
     assert.isNull(err)
     assert.equal(
       `=> Running post install script post_install.sh\n\t\tYour environment is ${program.environment}\n`,
       hook.captured()
     )
   })
 })