This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"extends": [ | |
"airbnb-base", | |
"plugin:jest/all", | |
"plugin:import/errors", | |
"plugin:import/warnings", | |
"plugin:import/typescript", | |
"plugin:@typescript-eslint/recommended" | |
], | |
"plugins": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
"lib": ["es2017"], | |
"removeComments": true, | |
"moduleResolution": "node", | |
"noUnusedLocals": true, | |
"noUnusedParameters": true, | |
"sourceMap": true, | |
"target": "es2017", | |
"outDir": "lib", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
presets: [ | |
[‘@babel/preset-env', { targets: { node: ‘current’ } }], | |
‘@babel/preset-typescript’, | |
], | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('who tests the tests?', () => { | |
it('can run a test', () => { | |
expect.hasAssertions(); | |
expect(1).toBe(1); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"test": "NODE_ENV=test ./node_modules/.bin/jest --ci --verbose", | |
"lint": "eslint . --ext .js,.jsx,.ts,.tsx", | |
"buildtest": "tsc --noEmit" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { APIGatewayProxyHandler } from ‘aws-lambda'; | |
import { echo } from ‘@queries/exampleQuery'; | |
import 'source-map-support/register’; | |
export const hello: APIGatewayProxyHandler = async (event) => ({ | |
statusCode: 200, | |
body: JSON.stringify({ | |
message: echo(‘Module aliasing is really the best’), | |
input: event, | |
}, null, 2), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": [ | |
"lambda:CreateFunction", | |
"lambda:ListVersionsByFunction", | |
"s3:CreateBucket", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
setupFiles: ['./tests/setup/setEnvironment.js'], | |
transform: { | |
'^.+\\.ts?$': 'babel-jest', | |
}, | |
moduleNameMapper: { | |
'^@repositories/(.*)$': '<rootDir>/src/repositories/$1', | |
'^@clients/(.*)$': '<rootDir>/src/clients/$1', | |
'^@transformers/(.*)$': '<rootDir>/src/transformers/$1', | |
'^@src/(.*)$': '<rootDir>/src/$1', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type | |
module.exports = async () => { | |
/* eslint-disable global-require */ | |
const serverless = new (require('serverless'))(); | |
await serverless.init(); | |
const service = await serverless.variables.populateService(); | |
const resources = service.resources.Resources; | |
const tables = Object.keys(resources) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DocumentClient } from 'aws-sdk/clients/dynamodb'; | |
import DynamoDB from '@dazn/lambda-powertools-dynamodb-client'; | |
/* | |
* This checks the environment and either outputs a raw DynamoDocumentClient for offline testing | |
* or it outputs the dazn-powertools DynamoDocumentClient that adds context and tracing | |
*/ | |
export default ['test'].includes(process.env.NODE_ENV) | |
? new DocumentClient({ | |
region: process.env.AWS_REGION, |
OlderNewer