npm install errorshots --dev
To be able to upload your error shots to an Amazon S3 bucket you'll need to specify the following environment variables:
ERROR_SHOTS_S3_ACCESS_KEY
ERROR_SHOTS_S3_SECRET_ACCESS_KEY
ERROR_SHOTS_S3_BUCKET
ERROR_SHOTS_S3_REGION
By default Error Shots will look for error files in $(npm config get cache)/_logs
.
If you've provided a .errorshots file in your project root, the errorshots will be fetched from there instead of the default behavior. All paths containing wildcard (*) will be uploaded as individual files, and paths pointing to directories will be uploaded as directories.
errorshot.png # This will be uploaded as individual files
logs/* # This will be uploaded as individual files
error_logs # This will be uploaded as a directory
# Prints a list of all error logs found
$ errorshots list
# Push errorshots to AWS S3
$ errorshots push s3
on_failure:
- errorshots push s3
Important: To avoid Travis output the uploaded file path as [secure]
be sure that you set your Travis ERROR_SHOTS_S3_BUCKET
and ERROR_SHOTS_S3_REGION
env variables as public.
To automatically create public access to all files you'll upload to your S3 bucket, add the following policy to your bucket (don't forget to replace YOUR_BUCKET with your bucket name).
{
"Version": "2018-01-13",
"Statement": [
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::YOUR_BUCKET/*"
}
]
}
- Fork the repository
- Create a new branch named after the feature or bug your adding/fixing
- Implement your code with test cases added, describing what you've done
- Run
npm run lint
andnpm run test
- Push your code
- Make a pull request