Skip to content

Commit a12c212

Browse files
PauloGoncalvesBHPaulo Gonçalves
authored and
Paulo Gonçalves
committed
feat: advise when run test unauthenticated
1 parent bf72e10 commit a12c212

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

serverless-runner/helpers/requester.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ function runTest({ file, functionName, resolve, startTestTime }) {
2424
})
2525
.promise()
2626
.then(onTestExecuted.bind(null, { file, startTestTime, resolve }))
27+
.catch(error => {
28+
if (error.message.includes('Check your AWS Secret Access Key and signing method')) {
29+
console.error({ error: 'Unauthenticated. Check your AWS Secret Access Key (AWS_SECRET_ACCESS_KEY) and Acess Key (AWS_ACCESS_KEY_ID).' })
30+
} else {
31+
console.error({ error: error.message, stackTrace: error.stack })
32+
}
33+
process.exit(1)
34+
})
2735
}
2836

2937
const onTestExecuted = ({ file, startTestTime, resolve }, response) => {
@@ -33,7 +41,6 @@ const onTestExecuted = ({ file, startTestTime, resolve }, response) => {
3341
numFailedTests += responseObj.numFailedTests
3442
numPassedTests += responseObj.numPassedTests
3543
numPendingTests += responseObj.numPendingTests
36-
// let total = Date.now() - startTestTime
3744
numTotalTests += responseObj.numTotalTests
3845
totalTimeExecution += Date.now() - startTestTime
3946
resolve({

0 commit comments

Comments
 (0)