Conversation
| }, | ||
| "test:int": { | ||
| "command": "npm start -- --exec \"mocha --timeout 20000 --require @babel/register --recursive ./test/helper.js \"./test/int/**/*.test.js\"\"", | ||
| "command": "start-test --expect 404 http://localhost:3002 'mocha --timeout 20000 --require @babel/register --recursive ./test/helper.js \"./test/int/**/*.test.js\"'", |
There was a problem hiding this comment.
serverless-offline no longer supports the --exec arg
There was a problem hiding this comment.
- the lambda endpoint of 3002 returns a 404 when start-test sends a ping request
- since there is no ping function defined
- but that is good enough to know that serverless-offline is up
| "command": "start-test --expect 404 http://localhost:3002 'mocha --timeout 20000 --require @babel/register --recursive ./test/helper.js \"./test/int/**/*.test.js\"'", | ||
| "env": { | ||
| "NODE_ENV": "test", | ||
| "AES": "false", |
There was a problem hiding this comment.
turn AES off in the serverless-offline http and lambda processes
| "babel-loader": "^9.1.3", | ||
| "babel-plugin-istanbul": "^6.1.1", | ||
| "baton-vcr-replay-for-aws-sdk": "^1.0.1", | ||
| "baton-vcr-serverless-plugin": "^1.0.0", |
There was a problem hiding this comment.
these no longer work with the newer versions of serverless-offline
|
|
||
| handle(event, includeErrors = true) { | ||
| handle(event, includeErrors = !process.env.IS_OFFLINE) { | ||
| return initialize(PIPELINES, this.options) |
There was a problem hiding this comment.
automatically turn off fault handling for integration tests
| } | ||
|
|
||
| export const handle = async (event, context, int = {}) => { | ||
| export const handle = async (event, context) => { |
There was a problem hiding this comment.
this argument can no longer be passed by the int tests
|
|
||
| import { handle } from '../../../src/listener'; | ||
| const invoke = lambdaTest({ functionName: `${process.env.npm_package_name}-dev-listener` }); | ||
|
|
There was a problem hiding this comment.
- this util works similar to supertest in the api gateway integration tests
- it calls the serverless-offline lambda endpoint on 3002
|
|
||
| // monkey patch replay to avoid immediate max retries and ultimately timeout | ||
| const rproxy = require('replay/lib/proxy'); | ||
| rproxy.prototype.setTimeout = () => { }; |
There was a problem hiding this comment.
- serverless-offline now starts the api gateway and lambda endpoints in separate processes from the serverless framework
- but the baton vcr plugin runs in the sls process
- so we need to include Replay in the webpack bundle so that we initialize it in the right processes
There was a problem hiding this comment.
Should update this to not import from root index file. Since this test is still importing from the root index file, you'll have to add all the other aws-sdk dependencies like cloudwatch, etc.
| externals: [ | ||
| nodeExternals() | ||
| ], | ||
| plugins: includeMocks() ? [new EnvironmentPlugin({ REPLAY: process.env.REPLAY })] : undefined, |
There was a problem hiding this comment.
allow developers to set the REPLAY env var from the cli when running/recording tests
No description provided.