diff --git a/.gitignore b/.gitignore index 7ecc11ddb..0d5cd2ea9 100755 --- a/.gitignore +++ b/.gitignore @@ -57,5 +57,4 @@ jest # DotNet obj/ -[Bb]in/ [Oo]bj/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f0c3cbf6..93db86918 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# 1.43.0 (2019-05-20) + +- [Update services.md](https://github.com/serverless/serverless/pull/6138) +- [Azure: exclude development dependency files when packaging functions](https://github.com/serverless/serverless/pull/6137) +- [Update release process docs and toolings](https://github.com/serverless/serverless/pull/6113) +- [Update AWS Node.js runtime to version 10](https://github.com/serverless/serverless/pull/6142) +- [Fix tests setup issues](https://github.com/serverless/serverless/pull/6147) + +## Meta +- [Comparison since last release](https://github.com/serverless/serverless/compare/v1.42.3...v1.43.0) + # 1.42.3 (2019-05-14) - [Update deploy.md](https://github.com/serverless/serverless/pull/6110) diff --git a/RELEASE_CHECKLIST.md b/RELEASE_CHECKLIST.md index 672996109..606b0c43c 100644 --- a/RELEASE_CHECKLIST.md +++ b/RELEASE_CHECKLIST.md @@ -8,30 +8,27 @@ More info about our release process can be found in the [`RELEASE_PROCESS.md`](. - [ ] Look through all open issues and PRs (if any) of that milestone and close them / move them to another milestone if still open -- [ ] Look through all closed issues and PRs of that milestone to see what has changed. Run `./scripts/prs-since-last-tag` or if you want to run against a specific tag `./scripts/prs-since-last-tag v1.20.0` to get a list of all merged PR's since a specific tag -- [ ] Close milestone on GitHub -- [ ] Create a new draft release in GitHub - -# Testing - -- [ ] Create a Serverless service (with some events), deploy and test it intensively -- [ ] Look through the milestone and test all of the new major changes -- [ ] Run `npm test` -- [ ] Run `npm run simple-integration-test` -- [ ] Run `npm run complex-integration-test` +- [ ] Create a new branch for the release +- [ ] Bump the version number in `package.json` +- [ ] Run `./scripts/prs-since-last-tag ` +- [ ] Save the terminal output to your clipboard +- [ ] Close the milestone on GitHub +- [ ] Create a new [**draft** release](https://github.com/serverless/serverless/releases/new) in GitHub + - [ ] Use the content in your clipboard as a description (without the heading) + - [ ] Ensure that the "Tag version" follows our naming convention ## Prepare Package -- [ ] Create a new branch to bump version in `package.json` -- [ ] Install the latest `npm` version or Docker container with latest `node` and `npm` -- [ ] Bump version in `package.json`, remove `node_modules` folder and run `npm install` and `npm prune --production && npm shrinkwrap` -- [ ] Look through closed PRs and update `CHANGELOG.md` +- [ ] Install the latest `npm` version or Docker container with latest `node` and `npm` (Ensure to work with an `npm` version which is distributed with latest `node` version) +- [ ] Remove the `node_modules` folder and the `package-lock.json` file and run `npm install` (Removing both ensures that `package-lock.json` is updated with the latest versions of dependencies) +- [ ] Update `CHANGELOG.md` with the content from your clipboard - [ ] Make sure all files that need to be pushed are included in `package.json -> files` -- [ ] Send PR and merge PR with new version to be released -- [ ] Add the changes you made to `CHANGELOG.md` to the description of the GitHub release draft -- [ ] Go back to branch you want to release from (e.g. `master`) and pull bumped version changes from GitHub +- [ ] Commit your changes (make sure that `package.json`, `package-lock.json` and `CHANGELOG.md` are updated) +- [ ] Push your branch and open up a new PR +- [ ] Await approval and merge the PR into `master` +- [ ] Go back to the branch you want to release from (e.g. `master`) and pull the changes from GitHub - [ ] Make sure there are no local changes to your repository (or reset with `git reset --hard HEAD`) -- [ ] Check `package.json`, `package-lock.json` and `npm-shrinkwrap.json` version config to make sure it fits what we want to release +- [ ] Check `package.json` and `package-lock.json` version config to make sure it fits what we want to release ## Releasing @@ -42,6 +39,3 @@ milestone if still open - [ ] Validate that `npm install` works (`npm install -g serverless@` or `npm install -g serverless` if latest is released) -## Post-Release - -- [ ] Run `./scripts/generate-release-contributors-list ` and hand the generated list over to the release blog post author diff --git a/bin/test b/bin/test index 0a6536f35..4d5da5468 100755 --- a/bin/test +++ b/bin/test @@ -7,14 +7,7 @@ process.on('unhandledRejection', err => { }); if (process.argv.length <= 2) { - process.argv.push( - '!(node_modules)/**/*.test.js', - '--require=sinon-bluebird', - '-R', - 'spec', - '--recursive', - '--no-exit' - ); + process.argv.push('--require=sinon-bluebird', '!(node_modules)/**/*.test.js'); } require('mocha/bin/_mocha'); diff --git a/bin/test-isolated b/bin/test-isolated new file mode 100755 index 000000000..7d057ce39 --- /dev/null +++ b/bin/test-isolated @@ -0,0 +1,66 @@ +#!/usr/bin/env node + +// Basic isolated tests runner +// Ensures each test file is run in distinct process and does not interfere with other test runs. +// To be used to confirm test files do not introduce and work by chance of side effects +// Temporary solution until we migrate to runner which provides that (reliably) on its own + +'use strict'; + +process.on('unhandledRejection', err => { + throw err; +}); + +const globby = require('globby'); +const spawn = require('child-process-ext/spawn'); +const chalk = require('chalk'); + +const patterns = process.argv.length <= 2 ? ['**/*.test.js'] : process.argv.slice(2); +patterns.push('!node_modules/**'); + +const resolveGitStatus = () => + spawn('git', ['status', '--porcelain']).then( + ({ stdoutBuffer }) => String(stdoutBuffer), + error => { + process.stdout.write(error.stdoutBuffer); + process.stderr.write(error.stderrBuffer); + throw error; + } + ); + +const initialGitStatusDeferred = resolveGitStatus(); + +const run = path => { + const onFinally = () => + Promise.all([initialGitStatusDeferred, resolveGitStatus()]).then( + ([initialStatus, currentStatus]) => { + if (initialStatus !== currentStatus) { + process.stderr.write(chalk.red.bold(`${path} didn't clean created temporary files\n\n`)); + process.exit(1); + } + } + ); + + return spawn('./bin/test', ['--require=sinon-bluebird', path], { + stdio: 'inherit', + env: { FORCE_COLOR: '1', PATH: process.env.PATH }, + }).then(onFinally, error => + onFinally(error).then(() => { + process.stderr.write(chalk.red.bold(`${path} failed\n\n`)); + if (error.code === 2) process.exit(2); + throw error; + }) + ); +}; + +globby(patterns).then(paths => { + if (!paths.length) { + process.stderr.write(chalk.red.bold('No test files matched\n\n')); + process.exit(1); + } + return initialGitStatusDeferred.then(function self() { + const path = paths.shift(); + if (path) return run(path).then(self); + return null; + }); +}); diff --git a/docs/providers/aws/cli-reference/print.md b/docs/providers/aws/cli-reference/print.md index 4009dac29..39584d5b9 100644 --- a/docs/providers/aws/cli-reference/print.md +++ b/docs/providers/aws/cli-reference/print.md @@ -42,7 +42,7 @@ custom: provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x stage: ${opt:stage, "dev"} functions: @@ -66,7 +66,7 @@ custom: bucketName: test provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x stage: dev # <-- Resolved functions: hello: diff --git a/docs/providers/aws/events/apigateway.md b/docs/providers/aws/events/apigateway.md index ad8ff969d..d8bfb68af 100644 --- a/docs/providers/aws/events/apigateway.md +++ b/docs/providers/aws/events/apigateway.md @@ -1220,7 +1220,7 @@ service: my-api provider: name: aws - runtime: nodejs8.10 + runtime: nodejs10.x stage: dev region: eu-west-2 @@ -1390,7 +1390,7 @@ Resource policies are policy documents that are used to control the invocation o ```yml provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x resourcePolicy: - Effect: Allow diff --git a/docs/providers/aws/events/websocket.md b/docs/providers/aws/events/websocket.md index 320df6bc6..8d88f4681 100644 --- a/docs/providers/aws/events/websocket.md +++ b/docs/providers/aws/events/websocket.md @@ -60,7 +60,7 @@ service: serverless-ws-test provider: name: aws - runtime: nodejs8.10 + runtime: nodejs10.x websocketsApiName: custom-websockets-api-name websocketsApiRouteSelectionExpression: $request.body.action # custom routes are selected by the value of the action property in the body @@ -127,7 +127,7 @@ functions: identitySource: - 'route.request.header.Auth' - 'route.request.querystring.Auth' - + auth: handler: handler.auth ``` @@ -147,7 +147,7 @@ functions: identitySource: - 'route.request.header.Auth' - 'route.request.querystring.Auth' - + auth: handler: handler.auth ``` @@ -177,7 +177,7 @@ const sendMessageToClient = (url, connectionId, payload) => new Promise((resolve module.exports.defaultHandler = async (event, context) => { const domain = event.requestContext.domainName; const stage = event.requestContext.stage; - const connectionId = event.requestContext.connectionId; + const connectionId = event.requestContext.connectionId; const callbackUrlForAWS = util.format(util.format('https://%s/%s', domain, stage)); //construct the needed url await sendMessageToClient(callbackUrlForAWS, connectionId, event); diff --git a/docs/providers/aws/examples/hello-world/node/serverless.yml b/docs/providers/aws/examples/hello-world/node/serverless.yml index 97b220d9f..4d44fe7c3 100644 --- a/docs/providers/aws/examples/hello-world/node/serverless.yml +++ b/docs/providers/aws/examples/hello-world/node/serverless.yml @@ -3,7 +3,7 @@ service: hello-world # Service Name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: helloWorld: diff --git a/docs/providers/aws/guide/credentials.md b/docs/providers/aws/guide/credentials.md index 208c58e55..2fb055262 100644 --- a/docs/providers/aws/guide/credentials.md +++ b/docs/providers/aws/guide/credentials.md @@ -131,7 +131,7 @@ You can even set up different profiles for different accounts, which can be used service: new-service provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x stage: dev profile: devProfile ``` @@ -176,7 +176,7 @@ This example `serverless.yml` snippet will load the profile depending upon the s service: new-service provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x stage: ${opt:stage, self:custom.defaultStage} profile: ${self:custom.profiles.${self:provider.stage}} custom: diff --git a/docs/providers/aws/guide/functions.md b/docs/providers/aws/guide/functions.md index ecdfe09ed..af8154cc6 100644 --- a/docs/providers/aws/guide/functions.md +++ b/docs/providers/aws/guide/functions.md @@ -24,7 +24,7 @@ service: myService provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x memorySize: 512 # optional, in MB, default is 1024 timeout: 10 # optional, in seconds, default is 6 versionFunctions: false # optional, default is true @@ -59,7 +59,7 @@ service: myService provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: functionOne: @@ -79,7 +79,7 @@ service: myService provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x memorySize: 512 # will be inherited by all functions functions: @@ -95,7 +95,7 @@ service: myService provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: functionOne: @@ -133,7 +133,7 @@ service: myService provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x iamRoleStatements: # permissions for all of your functions can be set here - Effect: Allow Action: # Gives permission to DynamoDB tables in a specific region @@ -390,7 +390,7 @@ service: service provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: @@ -443,7 +443,7 @@ service: myService provider: name: aws - runtime: nodejs8.10 + runtime: nodejs10.x tracing: lambda: true ``` diff --git a/docs/providers/aws/guide/serverless.yml.md b/docs/providers/aws/guide/serverless.yml.md index 1ccfe878b..413602b47 100644 --- a/docs/providers/aws/guide/serverless.yml.md +++ b/docs/providers/aws/guide/serverless.yml.md @@ -25,7 +25,7 @@ frameworkVersion: ">=1.0.0 <2.0.0" provider: name: aws - runtime: nodejs8.10 + runtime: nodejs10.x stage: ${opt:stage, 'dev'} # Set the default stage used. Default is dev region: ${opt:region, 'us-east-1'} # Overwrite the default region used. Default is us-east-1 stackName: custom-stack-name # Use a custom name for the CloudFormation stack @@ -148,7 +148,7 @@ functions: description: My function # The description of your function. memorySize: 512 # memorySize for this specific function. reservedConcurrency: 5 # optional, reserved concurrency limit for this function. By default, AWS uses account concurrency limit - runtime: nodejs6.10 # Runtime for this specific function. Overrides the default which is set on the provider level + runtime: nodejs10.x # Runtime for this specific function. Overrides the default which is set on the provider level timeout: 10 # Timeout for this specific function. Overrides the default set above. role: arn:aws:iam::XXXXXX:role/role # IAM role which will be used for this function onError: arn:aws:sns:us-east-1:XXXXXX:sns-topic # Optional SNS topic / SQS arn (Ref, Fn::GetAtt and Fn::ImportValue are supported as well) which will be used for the DeadLetterConfig diff --git a/docs/providers/aws/guide/services.md b/docs/providers/aws/guide/services.md index e69c24278..b2d73b8ba 100644 --- a/docs/providers/aws/guide/services.md +++ b/docs/providers/aws/guide/services.md @@ -37,8 +37,6 @@ comments/ ``` This makes sense since related functions usually use common infrastructure resources, and you want to keep those functions and resources together as a single unit of deployment, for better organization and separation of concerns. -**Note:** Currently, every service will create a separate REST API on AWS API Gateway. Due to a limitation with AWS API Gateway, you can only have a custom domain per one REST API. If you plan on making a large REST API, please make note of this limitation. Also, [a fix is in the works](https://github.com/serverless/serverless/issues/3078) and is a top priority. - ## Creation To create a service, use the `create` command. You must also pass in a runtime (e.g., node.js, python etc.) you would like to write the service in. You can also pass in a path to create a directory and auto-name your service: @@ -101,7 +99,7 @@ service: users provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x stage: dev # Set the default stage used. Default is dev region: us-east-1 # Overwrite the default region used. Default is us-east-1 stackName: my-custom-stack-name-${self:provider.stage} # Overwrite default CloudFormation stack name. Default is ${self:service}-${self:provider.stage} @@ -231,7 +229,7 @@ service: users provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x memorySize: 512 … @@ -248,7 +246,7 @@ service: users provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x memorySize: 512 … diff --git a/docs/providers/aws/guide/variables.md b/docs/providers/aws/guide/variables.md index 804820b22..895269374 100644 --- a/docs/providers/aws/guide/variables.md +++ b/docs/providers/aws/guide/variables.md @@ -183,7 +183,7 @@ You can add such custom output to CloudFormation stack. For example: service: another-service provider: name: aws - runtime: nodejs8.10 + runtime: nodejs10.x region: ap-northeast-1 memorySize: 512 functions: @@ -562,7 +562,7 @@ service: new-service provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x variableSyntax: "\\${{([ ~:a-zA-Z0-9._@\\'\",\\-\\/\\(\\)]+?)}}" # notice the double quotes for yaml to ignore the escape characters! # variableSyntax: "\\${((?!AWS)[ ~:a-zA-Z0-9._@'\",\\-\\/\\(\\)]+?)}" # Use this for allowing CloudFormation Pseudo-Parameters in your serverless.yml -- e.g. ${AWS::Region}. All other Serverless variables work as usual. diff --git a/lib/classes/Error.test.js b/lib/classes/Error.test.js index c1832f123..c24b50e95 100644 --- a/lib/classes/Error.test.js +++ b/lib/classes/Error.test.js @@ -67,10 +67,18 @@ describe('Error', () => { }); describe('#logError()', () => { + let BK_SLS_DEBUG; + beforeEach(() => { + BK_SLS_DEBUG = process.env.SLS_DEBUG; delete process.env.SLS_DEBUG; }); + afterEach(() => { + if (BK_SLS_DEBUG) process.env.SLS_DEBUG = BK_SLS_DEBUG; + else delete process.env.SLS_DEBUG; + }); + it('should log error and exit', () => { const error = new ServerlessError('a message', 'a status code'); logError(error); @@ -107,7 +115,7 @@ describe('Error', () => { }); it('should print stack trace with SLS_DEBUG', () => { - process.env.SLS_DEBUG = 1; + process.env.SLS_DEBUG = '1'; const error = new ServerlessError('a message'); logError(error); diff --git a/lib/classes/PluginManager.test.js b/lib/classes/PluginManager.test.js index 55ea550be..b9ff5d086 100644 --- a/lib/classes/PluginManager.test.js +++ b/lib/classes/PluginManager.test.js @@ -22,6 +22,7 @@ const BbPromise = require('bluebird'); const getCacheFilePath = require('../utils/getCacheFilePath'); chai.use(require('chai-as-promised')); +chai.use(require('sinon-chai')); const expect = chai.expect; @@ -1059,8 +1060,10 @@ describe('PluginManager', () => { describe('#loadHooks()', () => { let deprecatedPluginInstance; let consoleLogStub; + let BK_SLS_DEBUG; beforeEach(() => { + BK_SLS_DEBUG = process.env.SLS_DEBUG; deprecatedPluginInstance = new DeprecatedLifecycleEventsPluginMock(); pluginManager.deprecatedEvents = { 'deprecated:deprecated': 'new:new', @@ -1069,9 +1072,10 @@ describe('PluginManager', () => { }); afterEach(() => { + if (BK_SLS_DEBUG) process.env.SLS_DEBUG = BK_SLS_DEBUG; + else delete process.env.SLS_DEBUG; pluginManager.deprecatedEvents = {}; pluginManager.serverless.cli.log.restore(); - delete process.env.SLS_DEBUG; }); it('should replace deprecated events with the new ones', () => { @@ -1088,7 +1092,7 @@ describe('PluginManager', () => { }); it('should log a debug message about deprecated when using SLS_DEBUG', () => { - process.env.SLS_DEBUG = true; + process.env.SLS_DEBUG = '1'; pluginManager.loadHooks(deprecatedPluginInstance); expect(consoleLogStub.calledOnce).to.equal(true); @@ -1430,6 +1434,7 @@ describe('PluginManager', () => { it('should show warning if in debug mode and the given command has no hooks', () => { const consoleLogStub = sinon.stub(pluginManager.serverless.cli, 'log').returns(); + const BK_SLS_DEBUG = process.env.SLS_DEBUG; process.env.SLS_DEBUG = '*'; class HooklessPlugin { constructor() { @@ -1446,7 +1451,9 @@ describe('PluginManager', () => { return pluginManager.run(commandsArray).then(() => { expect(consoleLogStub.called).is.equal(true); pluginManager.serverless.cli.log.restore(); - process.env.SLS_DEBUG = undefined; + }).finally(() => { + if (BK_SLS_DEBUG) process.env.SLS_DEBUG = BK_SLS_DEBUG; + else delete process.env.SLS_DEBUG; }); }); @@ -1719,7 +1726,10 @@ describe('PluginManager', () => { it('should show warning in debug mode and when the given command has no hooks', () => { const consoleLogStub = sinon.stub(pluginManager.serverless.cli, 'log').returns(); + + const BK_SLS_DEBUG = process.env.SLS_DEBUG; process.env.SLS_DEBUG = '*'; + class HooklessPlugin { constructor() { this.commands = { @@ -1732,11 +1742,15 @@ describe('PluginManager', () => { const commandsArray = ['foo']; - return pluginManager.run(commandsArray).then(() => { - expect(consoleLogStub.called).is.equal(true); - pluginManager.serverless.cli.log.restore(); - process.env.SLS_DEBUG = undefined; - }); + return pluginManager.run(commandsArray) + .then(() => { + expect(consoleLogStub.called).is.equal(true); + pluginManager.serverless.cli.log.restore(); + }) + .finally(() => { + if (BK_SLS_DEBUG) process.env.SLS_DEBUG = BK_SLS_DEBUG; + else delete process.env.SLS_DEBUG; + }); }); describe('when invoking a command', () => { diff --git a/lib/classes/Service.js b/lib/classes/Service.js index 7bd1a2ed9..0ec8d0606 100644 --- a/lib/classes/Service.js +++ b/lib/classes/Service.js @@ -162,6 +162,8 @@ class Service { that.layers = serverlessFile.layers || {}; } + that.outputs = serverlessFile.outputs; + return this; } diff --git a/lib/classes/Service.test.js b/lib/classes/Service.test.js index 3c57f91d6..0ececfd87 100644 --- a/lib/classes/Service.test.js +++ b/lib/classes/Service.test.js @@ -97,14 +97,14 @@ describe('Service', () => { const data = { provider: { name: 'testProvider', - runtime: 'nodejs6.10', + runtime: 'nodejs10.x', }, }; const serviceInstance = new Service(serverless, data); expect(serviceInstance.provider.name).to.be.equal('testProvider'); - expect(serviceInstance.provider.runtime).to.be.equal('nodejs6.10'); + expect(serviceInstance.provider.runtime).to.be.equal('nodejs10.x'); }); }); diff --git a/lib/classes/Utils.test.js b/lib/classes/Utils.test.js index 1c3fd1a2c..aa0f2d49f 100644 --- a/lib/classes/Utils.test.js +++ b/lib/classes/Utils.test.js @@ -728,7 +728,7 @@ describe('Utils', () => { service: 'new-service', provider: { name: 'aws', - runtime: 'nodejs6.10', + runtime: 'nodejs10.x', stage: 'dev', region: 'us-east-1', variableSyntax: '\\${foo}', diff --git a/lib/plugins/aws/invoke/index.test.js b/lib/plugins/aws/invoke/index.test.js index 915911695..1d31aa963 100644 --- a/lib/plugins/aws/invoke/index.test.js +++ b/lib/plugins/aws/invoke/index.test.js @@ -51,6 +51,7 @@ describe('AwsInvoke', () => { }); describe('#extendedValidate()', () => { + let backupIsTTY; beforeEach(() => { serverless.config.servicePath = true; serverless.service.environment = { @@ -73,6 +74,15 @@ describe('AwsInvoke', () => { }; awsInvoke.options.data = null; awsInvoke.options.path = false; + + // Ensure there's no attempt to read path from stdin + backupIsTTY = process.stdin.isTTY; + process.stdin.isTTY = true; + }); + + afterEach(() => { + if (backupIsTTY) process.stdin.isTTY = backupIsTTY; + delete process.stdin.isTTY; }); it('it should throw error if function is not provided', () => { diff --git a/lib/plugins/aws/invokeLocal/index.js b/lib/plugins/aws/invokeLocal/index.js index cc75d1dad..692be94a1 100644 --- a/lib/plugins/aws/invokeLocal/index.js +++ b/lib/plugins/aws/invokeLocal/index.js @@ -38,7 +38,7 @@ class AwsInvokeLocal { getRuntime() { return this.options.functionObj.runtime || this.serverless.service.provider.runtime - || 'nodejs4.3'; + || 'nodejs10.x'; } validateFile(filePath, key) { diff --git a/lib/plugins/aws/invokeLocal/index.test.js b/lib/plugins/aws/invokeLocal/index.test.js index f2919a400..8bb7ddf4b 100644 --- a/lib/plugins/aws/invokeLocal/index.test.js +++ b/lib/plugins/aws/invokeLocal/index.test.js @@ -83,6 +83,7 @@ describe('AwsInvokeLocal', () => { }); describe('#extendedValidate()', () => { + let backupIsTTY; beforeEach(() => { serverless.config.servicePath = true; serverless.service.environment = { @@ -105,6 +106,15 @@ describe('AwsInvokeLocal', () => { }; awsInvokeLocal.options.data = null; awsInvokeLocal.options.path = false; + + // Ensure there's no attempt to read path from stdin + backupIsTTY = process.stdin.isTTY; + process.stdin.isTTY = true; + }); + + afterEach(() => { + if (backupIsTTY) process.stdin.isTTY = backupIsTTY; + delete process.stdin.isTTY; }); it('should not throw error when there are no input data', () => { @@ -250,7 +260,9 @@ describe('AwsInvokeLocal', () => { }); describe('#loadEnvVars()', () => { + let BK_AWS_PROFILE; beforeEach(() => { + BK_AWS_PROFILE = process.env.AWS_PROFILE; serverless.config.servicePath = true; serverless.service.provider = { environment: { @@ -270,7 +282,8 @@ describe('AwsInvokeLocal', () => { }); afterEach(() => { - delete process.env.AWS_PROFILE; + if (BK_AWS_PROFILE) process.env.AWS_PROFILE = BK_AWS_PROFILE; + else delete process.env.AWS_PROFILE; }); it('it should load provider env vars', () => awsInvokeLocal @@ -382,7 +395,7 @@ describe('AwsInvokeLocal', () => { ); it('should call invokeLocalNodeJs for any node.js runtime version', () => { - awsInvokeLocal.options.functionObj.runtime = 'nodejs6.10'; + awsInvokeLocal.options.functionObj.runtime = 'nodejs10.x'; return awsInvokeLocal.invokeLocal().then(() => { expect(invokeLocalNodeJsStub.calledOnce).to.be.equal(true); expect(invokeLocalNodeJsStub.calledWithExactly( @@ -482,8 +495,8 @@ describe('AwsInvokeLocal', () => { }); }); - it('should call invokeLocalDocker if using --docker option with nodejs8.10', () => { - awsInvokeLocal.options.functionObj.runtime = 'nodejs8.10'; + it('should call invokeLocalDocker if using --docker option with nodejs10.x', () => { + awsInvokeLocal.options.functionObj.runtime = 'nodejs10.x'; awsInvokeLocal.options.functionObj.handler = 'handler.foobar'; awsInvokeLocal.options.docker = true; return awsInvokeLocal.invokeLocal().then(() => { @@ -1163,7 +1176,7 @@ describe('AwsInvokeLocal', () => { handler: 'handler.hello', name: 'hello', timeout: 4, - runtime: 'nodejs8.10', + runtime: 'nodejs10.x', environment: { functionVar: 'functionValue', }, @@ -1183,6 +1196,7 @@ describe('AwsInvokeLocal', () => { delete require.cache[require.resolve('./index')]; delete require.cache[require.resolve('child_process')]; serverless.pluginManager.spawn.restore(); + fse.removeSync('.serverless'); }); it('calls docker with packaged artifact', () => @@ -1190,9 +1204,9 @@ describe('AwsInvokeLocal', () => { expect(pluginMangerSpawnPackageStub.calledOnce).to.equal(true); expect(spawnStub.getCall(0).args).to.deep.equal(['docker', ['version']]); expect(spawnStub.getCall(1).args).to.deep.equal(['docker', - ['images', '-q', 'lambci/lambda:nodejs8.10']]); + ['images', '-q', 'lambci/lambda:nodejs10.x']]); expect(spawnStub.getCall(2).args).to.deep.equal(['docker', - ['pull', 'lambci/lambda:nodejs8.10']]); + ['pull', 'lambci/lambda:nodejs10.x']]); expect(spawnStub.getCall(3).args).to.deep.equal(['docker', [ 'build', '-t', diff --git a/lib/plugins/aws/lib/getServiceState.test.js b/lib/plugins/aws/lib/getServiceState.test.js index 72dc72462..02f4bf187 100644 --- a/lib/plugins/aws/lib/getServiceState.test.js +++ b/lib/plugins/aws/lib/getServiceState.test.js @@ -1,11 +1,14 @@ 'use strict'; -const expect = require('chai').expect; +const chai = require('chai'); const sinon = require('sinon'); const Serverless = require('../../../Serverless'); const AwsProvider = require('../provider/awsProvider'); const getServiceState = require('./getServiceState'); +const expect = chai.expect; +chai.use(require('sinon-chai')); + describe('#getServiceState()', () => { let serverless; let readFileSyncStub; diff --git a/lib/plugins/aws/package/compile/events/apiGateway/lib/restApi.test.js b/lib/plugins/aws/package/compile/events/apiGateway/lib/restApi.test.js index 559d825d5..127e61e03 100644 --- a/lib/plugins/aws/package/compile/events/apiGateway/lib/restApi.test.js +++ b/lib/plugins/aws/package/compile/events/apiGateway/lib/restApi.test.js @@ -1,10 +1,13 @@ 'use strict'; -const expect = require('chai').expect; +const chai = require('chai'); const AwsCompileApigEvents = require('../index'); const Serverless = require('../../../../../../../Serverless'); const AwsProvider = require('../../../../../provider/awsProvider'); +const expect = chai.expect; +chai.use(require('chai-as-promised')); + describe('#compileRestApi()', () => { let serverless; let awsCompileApigEvents; diff --git a/lib/plugins/aws/package/compile/functions/index.js b/lib/plugins/aws/package/compile/functions/index.js index 410480c74..ad3a6f18c 100644 --- a/lib/plugins/aws/package/compile/functions/index.js +++ b/lib/plugins/aws/package/compile/functions/index.js @@ -115,7 +115,7 @@ class AwsCompileFunctions { || 6; const Runtime = functionObject.runtime || this.serverless.service.provider.runtime - || 'nodejs4.3'; + || 'nodejs10.x'; newFunction.Properties.Handler = Handler; newFunction.Properties.FunctionName = FunctionName; diff --git a/lib/plugins/aws/package/compile/functions/index.test.js b/lib/plugins/aws/package/compile/functions/index.test.js index 722285ba2..430924b85 100644 --- a/lib/plugins/aws/package/compile/functions/index.test.js +++ b/lib/plugins/aws/package/compile/functions/index.test.js @@ -416,7 +416,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, }, }; @@ -460,7 +460,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, VpcConfig: { SecurityGroupIds: ['xxx'], @@ -507,7 +507,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, VpcConfig: { SecurityGroupIds: ['xxx'], @@ -556,7 +556,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, Tags: [ { Key: 'foo', Value: 'bar' }, @@ -604,7 +604,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, Tags: [ { Key: 'foo', Value: 'bar' }, @@ -657,7 +657,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, Tags: [ { Key: 'foo', Value: 'bar' }, @@ -765,7 +765,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, DeadLetterConfig: { TargetArn: 'arn:aws:sns:region:accountid:foo', @@ -834,7 +834,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, DeadLetterConfig: { TargetArn: { @@ -880,7 +880,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, DeadLetterConfig: { TargetArn: { @@ -926,7 +926,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, DeadLetterConfig: { TargetArn: { @@ -972,7 +972,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, DeadLetterConfig: { TargetArn: 'arn:aws:sns:region:accountid:foo', @@ -1085,7 +1085,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, KmsKeyArn: 'arn:aws:kms:region:accountid:foo/bar', }, @@ -1133,7 +1133,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func1.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, KmsKeyArn: 'arn:aws:kms:region:accountid:foo/function', }, @@ -1154,7 +1154,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func2.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, KmsKeyArn: 'arn:aws:kms:region:accountid:foo/service', }, @@ -1213,7 +1213,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, KmsKeyArn: 'arn:aws:kms:region:accountid:foo/bar', }, @@ -1267,7 +1267,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, KmsKeyArn: 'arn:aws:kms:region:accountid:foo/bar', }, @@ -1338,7 +1338,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, TracingConfig: { Mode: 'Active', @@ -1388,7 +1388,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func1.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, TracingConfig: { Mode: 'Active', @@ -1411,7 +1411,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func2.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, TracingConfig: { Mode: 'PassThrough', @@ -1471,7 +1471,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, TracingConfig: { Mode: 'Active', @@ -1527,7 +1527,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, TracingConfig: { Mode: 'PassThrough', @@ -1581,7 +1581,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, Environment: { Variables: { @@ -1631,7 +1631,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, Environment: { Variables: { @@ -1680,7 +1680,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, Environment: { Variables: { @@ -1732,7 +1732,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, Environment: { Variables: { @@ -1846,7 +1846,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 128, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 10, }, }; @@ -1902,7 +1902,7 @@ describe('AwsCompileFunctions', () => { }); }); - it('should default to the nodejs4.3 runtime when no provider runtime is given', () => { + it('should default to the nodejs10.x runtime when no provider runtime is given', () => { const s3Folder = awsCompileFunctions.serverless.service.package.artifactDirectoryName; const s3FileName = awsCompileFunctions.serverless.service.package.artifact .split(path.sep).pop(); @@ -1928,7 +1928,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, }, }; @@ -2069,12 +2069,12 @@ describe('AwsCompileFunctions', () => { const expectedOutputs = { FuncLambdaFunctionQualifiedArn: { Description: 'Current Lambda function version', - Value: { Ref: 'FuncLambdaVersionl6Rjpaz0gycgsEDI51sLed039fH2uR4W8Q2IW8cNo' }, + Value: { Ref: 'FuncLambdaVersionpcyXz9PqN5xesfBZOOhY7t6jhi8kOCyGDknpfuhJ4' }, }, AnotherFuncLambdaFunctionQualifiedArn: { Description: 'Current Lambda function version', Value: { - Ref: 'AnotherFuncLambdaVersion6JZQneYqP4bC0Z3ywMc3XJPyECHK4RMGhpv8iis4E', + Ref: 'AnotherFuncLambdaVersionIo6IWr3BPLeAaVjlRwEGEz4vvDzC43h07eOBY0fXyI', }, }, }; @@ -2103,12 +2103,12 @@ describe('AwsCompileFunctions', () => { const expectedOutputs = { FuncLambdaFunctionQualifiedArn: { Description: 'Current Lambda function version', - Value: { Ref: 'FuncLambdaVersionl6Rjpaz0gycgsEDI51sLed039fH2uR4W8Q2IW8cNo' }, + Value: { Ref: 'FuncLambdaVersionpcyXz9PqN5xesfBZOOhY7t6jhi8kOCyGDknpfuhJ4' }, }, AnotherFuncLambdaFunctionQualifiedArn: { Description: 'Current Lambda function version', Value: { - Ref: 'AnotherFuncLambdaVersion6JZQneYqP4bC0Z3ywMc3XJPyECHK4RMGhpv8iis4E', + Ref: 'AnotherFuncLambdaVersionIo6IWr3BPLeAaVjlRwEGEz4vvDzC43h07eOBY0fXyI', }, }, }; @@ -2143,7 +2143,7 @@ describe('AwsCompileFunctions', () => { 'FuncLambdaFunctionQualifiedArn', { Description: 'Current Lambda function version', - Value: { Ref: 'FuncLambdaVersiona6VymfU25aF6eS2qysm7sHqPyy8RqYUzoTvDeBrrBA' }, + Value: { Ref: 'FuncLambdaVersionI1xWetHMVQO8bvzGqgmokPl25rtJA0A8g6lZNYdkdg' }, } ); @@ -2168,7 +2168,7 @@ describe('AwsCompileFunctions', () => { .then(() => { expect( awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate - .Resources.FuncLambdaVersionOKy3yjVllZnozzdvQqHlRN8lBwkZyA6l76TCAEyork + .Resources.FuncLambdaVersionBzAYHivcbYLoEZcl7hN9cBrakBNygN0PiUC9UjQVMA .Properties.Description ).to.equal('Lambda function description'); }); @@ -2225,7 +2225,7 @@ describe('AwsCompileFunctions', () => { MemorySize: 1024, ReservedConcurrentExecutions: 5, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, }, }; @@ -2266,7 +2266,7 @@ describe('AwsCompileFunctions', () => { MemorySize: 1024, ReservedConcurrentExecutions: 0, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, }, }; @@ -2434,7 +2434,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, }, }; @@ -2475,7 +2475,7 @@ describe('AwsCompileFunctions', () => { Handler: 'func.function.handler', MemorySize: 1024, Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] }, - Runtime: 'nodejs4.3', + Runtime: 'nodejs10.x', Timeout: 6, Layers: ['arn:aws:xxx:*:*'], }, diff --git a/lib/plugins/aws/package/compile/layers/index.test.js b/lib/plugins/aws/package/compile/layers/index.test.js index c9ec66124..22245035b 100644 --- a/lib/plugins/aws/package/compile/layers/index.test.js +++ b/lib/plugins/aws/package/compile/layers/index.test.js @@ -292,7 +292,7 @@ describe('AwsCompileLayers', () => { test: { path: 'layer', description: 'desc', - compatibleRuntimes: ['nodejs8.10'], + compatibleRuntimes: ['nodejs10.x'], licenseInfo: 'GPL', }, }; @@ -305,7 +305,7 @@ describe('AwsCompileLayers', () => { }, LayerName: 'test', Description: 'desc', - CompatibleRuntimes: ['nodejs8.10'], + CompatibleRuntimes: ['nodejs10.x'], LicenseInfo: 'GPL', }, }; diff --git a/lib/plugins/aws/provider/awsProvider.test.js b/lib/plugins/aws/provider/awsProvider.test.js index 1cf09dbf2..89d2c7ee0 100644 --- a/lib/plugins/aws/provider/awsProvider.test.js +++ b/lib/plugins/aws/provider/awsProvider.test.js @@ -30,8 +30,8 @@ describe('AwsProvider', () => { beforeEach(() => { serverless = new Serverless(options); + serverless.cli = new serverless.classes.CLI(); awsProvider = new AwsProvider(serverless, options); - awsProvider.serverless.cli = new serverless.classes.CLI(); }); describe('#getProviderName()', () => { @@ -41,10 +41,16 @@ describe('AwsProvider', () => { }); describe('#constructor()', () => { - afterEach('Environment Variable Cleanup', () => { - // clear env + let backupProxyEnv; + + beforeEach('Environment Variable Cleanup', () => { + backupProxyEnv = process.env.proxy; delete process.env.proxy; }); + afterEach('Environment Variable Cleanup', () => { + if (backupProxyEnv) process.env.proxy = backupProxyEnv; + else delete process.env.proxy; + }); it('should set Serverless instance', () => { expect(typeof awsProvider.serverless).to.not.equal('undefined'); @@ -59,18 +65,20 @@ describe('AwsProvider', () => { }); it('should have no AWS logger', () => { - expect(awsProvider.sdk.config.logger).to.be.undefined; + expect(awsProvider.sdk.config.logger).to.be.null; }); it('should set AWS logger', () => { const BK_SLS_DEBUG = process.env.SLS_DEBUG; process.env.SLS_DEBUG = 'true'; - const newAwsProvider = new AwsProvider(serverless, options); + try { + const newAwsProvider = new AwsProvider(serverless, options); - expect(typeof newAwsProvider.sdk.config.logger).to.not.equal('undefined'); - - // reset env - process.env.SLS_DEBUG = BK_SLS_DEBUG; + expect(typeof newAwsProvider.sdk.config.logger).to.not.equal('undefined'); + } finally { + if (BK_SLS_DEBUG) process.env.SLS_DEBUG = BK_SLS_DEBUG; + else delete process.env.SLS_DEBUG; + } }); it('should set AWS proxy', () => { @@ -81,13 +89,16 @@ describe('AwsProvider', () => { }); it('should set AWS timeout', () => { + const BK_AWS_CLIENT_TIMEOUT = process.env.AWS_CLIENT_TIMEOUT; process.env.AWS_CLIENT_TIMEOUT = '120000'; - const newAwsProvider = new AwsProvider(serverless, options); + try { + const newAwsProvider = new AwsProvider(serverless, options); - expect(typeof newAwsProvider.sdk.config.httpOptions.timeout).to.not.equal('undefined'); - - // clear env - delete process.env.AWS_CLIENT_TIMEOUT; + expect(typeof newAwsProvider.sdk.config.httpOptions.timeout).to.not.equal('undefined'); + } finally { + if (BK_AWS_CLIENT_TIMEOUT) process.env.AWS_CLIENT_TIMEOUT = BK_AWS_CLIENT_TIMEOUT; + else delete process.env.AWS_CLIENT_TIMEOUT; + } }); describe('stage name validation', () => { @@ -131,10 +142,16 @@ describe('AwsProvider', () => { }); describe('certificate authority - environment variable', () => { - afterEach('Environment Variable Cleanup', () => { - // clear env + let backupCaEnv; + + beforeEach('Environment Variable Cleanup', () => { + backupCaEnv = process.env.ca; delete process.env.ca; }); + afterEach('Environment Variable Cleanup', () => { + if (backupCaEnv) process.env.ca = backupCaEnv; + else delete process.env.ca; + }); it('should set AWS ca single', () => { process.env.ca = '-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----'; const newAwsProvider = new AwsProvider(serverless, options); @@ -165,7 +182,14 @@ describe('AwsProvider', () => { const tmpdir = os.tmpdir(); let file1 = null; let file2 = null; + let backupEnv; beforeEach('Create CA Files and env vars', () => { + backupEnv = { + ca: process.env.ca, + cafile: process.env.cafile, + }; + delete process.env.ca; + delete process.env.cafile; file1 = path.join(tmpdir, 'ca1.txt'); file2 = path.join(tmpdir, 'ca2.txt'); fs.writeFileSync(file1, certContents); @@ -173,6 +197,10 @@ describe('AwsProvider', () => { }); afterEach('CA File Cleanup', () => { + for (const key of Object.keys(backupEnv)) { + if (backupEnv[key]) process.env[key] = backupEnv[key]; + else delete process.env[key]; + } // delete files fs.unlinkSync(file1); fs.unlinkSync(file2); @@ -255,7 +283,9 @@ describe('AwsProvider', () => { describe('#request()', () => { beforeEach(() => { - sinon.stub(global, 'setTimeout', (cb) => { cb(); }); + const originalSetTimeout = setTimeout; + sinon.stub(global, 'setTimeout', (cb, timeout) => + originalSetTimeout(cb, Math.min(timeout || 0, 10))); }); afterEach(() => { @@ -785,8 +815,11 @@ describe('AwsProvider', () => { const relevantEnvironment = { AWS_SHARED_CREDENTIALS_FILE: testUtils.getTmpFilePath('credentials'), }; + let BK_AWS_PROFILE; beforeEach(() => { + BK_AWS_PROFILE = process.env.AWS_PROFILE; + delete process.env.AWS_PROFILE; originalProviderProfile = serverless.service.provider.profile; originalEnvironmentVariables = testUtils.replaceEnv(relevantEnvironment); serverless.utils.writeFileSync( @@ -803,6 +836,8 @@ describe('AwsProvider', () => { }); afterEach(() => { + if (BK_AWS_PROFILE) process.env.AWS_PROFILE = BK_AWS_PROFILE; + else delete process.env.AWS_PROFILE; testUtils.replaceEnv(originalEnvironmentVariables); serverless.service.provider.profile = originalProviderProfile; }); @@ -1011,13 +1046,25 @@ describe('AwsProvider', () => { secretAccessKey: 'secretAccessKey', sessionToken: 'sessionToken', }; + const backup = { + AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID, + AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY, + AWS_SESSION_TOKEN: process.env.AWS_SESSION_TOKEN, + }; process.env.AWS_ACCESS_KEY_ID = testVal.accessKeyId; process.env.AWS_SECRET_ACCESS_KEY = testVal.secretAccessKey; process.env.AWS_SESSION_TOKEN = testVal.sessionToken; - const credentials = newAwsProvider.getCredentials(); - expect(credentials.credentials.accessKeyId).to.equal(testVal.accessKeyId); - expect(credentials.credentials.secretAccessKey).to.equal(testVal.secretAccessKey); - expect(credentials.credentials.sessionToken).to.equal(testVal.sessionToken); + try { + const credentials = newAwsProvider.getCredentials(); + expect(credentials.credentials.accessKeyId).to.equal(testVal.accessKeyId); + expect(credentials.credentials.secretAccessKey).to.equal(testVal.secretAccessKey); + expect(credentials.credentials.sessionToken).to.equal(testVal.sessionToken); + } finally { + for (const key of Object.keys(backup)) { + if (backup[key]) process.env[key] = backup[key]; + else delete process.env[key]; + } + } }); it('should get credentials from environment declared stage specific credentials', () => { @@ -1026,52 +1073,94 @@ describe('AwsProvider', () => { secretAccessKey: 'secretAccessKey', sessionToken: 'sessionToken', }; + const backup = { + AWS_TESTSTAGE_ACCESS_KEY_ID: process.env.AWS_TESTSTAGE_ACCESS_KEY_ID, + AWS_TESTSTAGE_SECRET_ACCESS_KEY: process.env.AWS_TESTSTAGE_SECRET_ACCESS_KEY, + AWS_TESTSTAGE_SESSION_TOKEN: process.env.AWS_TESTSTAGE_SESSION_TOKEN, + }; process.env.AWS_TESTSTAGE_ACCESS_KEY_ID = testVal.accessKeyId; process.env.AWS_TESTSTAGE_SECRET_ACCESS_KEY = testVal.secretAccessKey; process.env.AWS_TESTSTAGE_SESSION_TOKEN = testVal.sessionToken; - const credentials = newAwsProvider.getCredentials(); - expect(credentials.credentials.accessKeyId).to.equal(testVal.accessKeyId); - expect(credentials.credentials.secretAccessKey).to.equal(testVal.secretAccessKey); - expect(credentials.credentials.sessionToken).to.equal(testVal.sessionToken); + try { + const credentials = newAwsProvider.getCredentials(); + expect(credentials.credentials.accessKeyId).to.equal(testVal.accessKeyId); + expect(credentials.credentials.secretAccessKey).to.equal(testVal.secretAccessKey); + expect(credentials.credentials.sessionToken).to.equal(testVal.sessionToken); + } finally { + for (const key of Object.keys(backup)) { + if (backup[key]) process.env[key] = backup[key]; + else delete process.env[key]; + } + } }); it('should get credentials from environment declared for-all-stages profile', () => { + const BK_AWS_PROFILE = process.env.AWS_PROFILE; process.env.AWS_PROFILE = 'notDefault'; - const credentials = newAwsProvider.getCredentials(); - expect(credentials.credentials.profile).to.equal('notDefault'); + try { + const credentials = newAwsProvider.getCredentials(); + expect(credentials.credentials.profile).to.equal('notDefault'); + } finally { + if (BK_AWS_PROFILE) process.env.AWS_PROFILE = BK_AWS_PROFILE; + else delete process.env.AWS_PROFILE; + } }); it('should get credentials from environment declared stage-specific profile', () => { + const BK_AWS_TESTSTAGE_PROFILE = process.env.AWS_TESTSTAGE_PROFILE; process.env.AWS_TESTSTAGE_PROFILE = 'notDefault'; - const credentials = newAwsProvider.getCredentials(); - expect(credentials.credentials.profile).to.equal('notDefault'); + try { + const credentials = newAwsProvider.getCredentials(); + expect(credentials.credentials.profile).to.equal('notDefault'); + } finally { + if (BK_AWS_TESTSTAGE_PROFILE) process.env.AWS_TESTSTAGE_PROFILE = BK_AWS_TESTSTAGE_PROFILE; + else delete process.env.AWS_TESTSTAGE_PROFILE; + } }); it('should get credentials when profile is provied via --aws-profile option', () => { + const BK_AWS_PROFILE = process.env.AWS_PROFILE; process.env.AWS_PROFILE = 'notDefaultTemporary'; - newAwsProvider.options['aws-profile'] = 'notDefault'; + try { + newAwsProvider.options['aws-profile'] = 'notDefault'; - const credentials = newAwsProvider.getCredentials(); - expect(credentials.credentials.profile).to.equal('notDefault'); + const credentials = newAwsProvider.getCredentials(); + expect(credentials.credentials.profile).to.equal('notDefault'); + } finally { + if (BK_AWS_PROFILE) process.env.AWS_PROFILE = BK_AWS_PROFILE; + else delete process.env.AWS_PROFILE; + } }); it('should get credentials when profile is provied via --aws-profile option even if profile is defined in serverless.yml', () => { // eslint-disable-line max-len + const BK_AWS_PROFILE = process.env.AWS_PROFILE; process.env.AWS_PROFILE = 'notDefaultTemporary'; - newAwsProvider.options['aws-profile'] = 'notDefault'; + try { + newAwsProvider.options['aws-profile'] = 'notDefault'; - serverless.service.provider.profile = 'notDefaultTemporary2'; + serverless.service.provider.profile = 'notDefaultTemporary2'; - const credentials = newAwsProvider.getCredentials(); - expect(credentials.credentials.profile).to.equal('notDefault'); + const credentials = newAwsProvider.getCredentials(); + expect(credentials.credentials.profile).to.equal('notDefault'); + } finally { + if (BK_AWS_PROFILE) process.env.AWS_PROFILE = BK_AWS_PROFILE; + else delete process.env.AWS_PROFILE; + } }); it('should get credentials when profile is provied via process.env.AWS_PROFILE even if profile is defined in serverless.yml', () => { // eslint-disable-line max-len + const BK_AWS_PROFILE = process.env.AWS_PROFILE; process.env.AWS_PROFILE = 'notDefault'; - serverless.service.provider.profile = 'notDefaultTemporary'; + try { + serverless.service.provider.profile = 'notDefaultTemporary'; - const credentials = newAwsProvider.getCredentials(); - expect(credentials.credentials.profile).to.equal('notDefault'); + const credentials = newAwsProvider.getCredentials(); + expect(credentials.credentials.profile).to.equal('notDefault'); + } finally { + if (BK_AWS_PROFILE) process.env.AWS_PROFILE = BK_AWS_PROFILE; + else delete process.env.AWS_PROFILE; + } }); it('should set the signatureVersion to v4 if the serverSideEncryption is aws:kms', () => { diff --git a/lib/plugins/create/templates/aws-alexa-typescript/serverless.yml b/lib/plugins/create/templates/aws-alexa-typescript/serverless.yml index d4ea38e3f..6dde48d3a 100644 --- a/lib/plugins/create/templates/aws-alexa-typescript/serverless.yml +++ b/lib/plugins/create/templates/aws-alexa-typescript/serverless.yml @@ -9,7 +9,7 @@ plugins: provider: name: aws - runtime: nodejs8.10 + runtime: nodejs10.x custom: alexa: diff --git a/lib/plugins/create/templates/aws-clojurescript-gradle/serverless.yml b/lib/plugins/create/templates/aws-clojurescript-gradle/serverless.yml index fac71f26d..a297fee2a 100644 --- a/lib/plugins/create/templates/aws-clojurescript-gradle/serverless.yml +++ b/lib/plugins/create/templates/aws-clojurescript-gradle/serverless.yml @@ -21,7 +21,7 @@ service: aws-clojurescript-gradle provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x # you can overwrite defaults here # stage: dev diff --git a/lib/plugins/create/templates/aws-kotlin-nodejs-gradle/serverless.yml b/lib/plugins/create/templates/aws-kotlin-nodejs-gradle/serverless.yml index 41e3ce7f0..a2c045481 100644 --- a/lib/plugins/create/templates/aws-kotlin-nodejs-gradle/serverless.yml +++ b/lib/plugins/create/templates/aws-kotlin-nodejs-gradle/serverless.yml @@ -21,7 +21,7 @@ service: aws-kotlin-nodejs-gradle # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x # you can overwrite defaults here # stage: dev diff --git a/lib/plugins/create/templates/aws-nodejs-ecma-script/serverless.yml b/lib/plugins/create/templates/aws-nodejs-ecma-script/serverless.yml index cabaaa77c..e6fd291ab 100644 --- a/lib/plugins/create/templates/aws-nodejs-ecma-script/serverless.yml +++ b/lib/plugins/create/templates/aws-nodejs-ecma-script/serverless.yml @@ -9,7 +9,7 @@ plugins: provider: name: aws - runtime: nodejs8.10 + runtime: nodejs10.x functions: first: diff --git a/lib/plugins/create/templates/aws-nodejs-typescript/serverless.yml b/lib/plugins/create/templates/aws-nodejs-typescript/serverless.yml index 5effc539d..7ece1abf0 100644 --- a/lib/plugins/create/templates/aws-nodejs-typescript/serverless.yml +++ b/lib/plugins/create/templates/aws-nodejs-typescript/serverless.yml @@ -9,7 +9,7 @@ plugins: provider: name: aws - runtime: nodejs8.10 + runtime: nodejs10.x functions: hello: diff --git a/lib/plugins/create/templates/aws-nodejs/serverless.yml b/lib/plugins/create/templates/aws-nodejs/serverless.yml index e1c9b3fc0..cb2f09e97 100644 --- a/lib/plugins/create/templates/aws-nodejs/serverless.yml +++ b/lib/plugins/create/templates/aws-nodejs/serverless.yml @@ -21,7 +21,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs8.10 + runtime: nodejs10.x # you can overwrite defaults here # stage: dev diff --git a/lib/plugins/create/templates/azure-nodejs/serverless.yml b/lib/plugins/create/templates/azure-nodejs/serverless.yml index 74e94f9fd..3e49bd916 100644 --- a/lib/plugins/create/templates/azure-nodejs/serverless.yml +++ b/lib/plugins/create/templates/azure-nodejs/serverless.yml @@ -25,13 +25,15 @@ plugins: - serverless-azure-functions # you can add packaging information here -#package: +package: # include: # - include-me.js # - include-me-dir/** -# exclude: + exclude: # - exclude-me.js # - exclude-me-dir/** + - local.settings.json + - .vscode/** functions: hello: diff --git a/lib/plugins/create/templates/hello-world/serverless.yml b/lib/plugins/create/templates/hello-world/serverless.yml index 22f21292b..a2e0a0fd2 100644 --- a/lib/plugins/create/templates/hello-world/serverless.yml +++ b/lib/plugins/create/templates/hello-world/serverless.yml @@ -10,7 +10,7 @@ service: serverless-hello-world # The `provider` block defines where your service will be deployed provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x # The `functions` block defines what code to deploy functions: diff --git a/lib/plugins/info/info.test.js b/lib/plugins/info/info.test.js index be89c6234..24aba7c65 100644 --- a/lib/plugins/info/info.test.js +++ b/lib/plugins/info/info.test.js @@ -1,10 +1,13 @@ 'use strict'; -const expect = require('chai').expect; +const chai = require('chai'); const Info = require('./info'); const Serverless = require('../../Serverless'); const sinon = require('sinon'); +const expect = chai.expect; +chai.use(require('chai-as-promised')); + describe('Info', () => { let info; let serverless; diff --git a/lib/plugins/invoke/invoke.test.js b/lib/plugins/invoke/invoke.test.js index c4830bee6..3db7fb64b 100644 --- a/lib/plugins/invoke/invoke.test.js +++ b/lib/plugins/invoke/invoke.test.js @@ -11,23 +11,30 @@ const expect = chai.expect; describe('Invoke', () => { let invoke; let serverless; + let BK_IS_LOCAL; beforeEach(() => { + BK_IS_LOCAL = process.env.IS_LOCAL; + delete process.env.IS_LOCAL; serverless = new Serverless(); invoke = new Invoke(serverless); }); + afterEach(() => { + if (BK_IS_LOCAL) process.env.IS_LOCAL = BK_IS_LOCAL; + else delete process.env.IS_LOCAL; + }); + describe('#constructor()', () => { it('should have commands', () => expect(invoke.commands).to.be.not.empty); it('should have hooks', () => expect(invoke.hooks).to.be.not.empty); }); describe('#loadEnvVarsForLocal()', () => { - it('should set IS_LOCAL', () => { - delete process.env.IS_LOCAL; - return expect(invoke.loadEnvVarsForLocal()).to.be.fulfilled - .then(() => expect(process.env.IS_LOCAL).to.equal('true')); - }); + it('should set IS_LOCAL', () => + expect(invoke.loadEnvVarsForLocal()).to.be.fulfilled.then(() => + expect(process.env.IS_LOCAL).to.equal('true') + )); }); describe('hooks', () => { @@ -36,11 +43,10 @@ describe('Invoke', () => { expect(invoke.commands.invoke.commands.local.lifecycleEvents).to.contain('loadEnvVars'); }); - it('should set IS_LOCAL', () => { - delete process.env.IS_LOCAL; - return expect(invoke.hooks['invoke:local:loadEnvVars']()).to.be.fulfilled - .then(() => expect(process.env.IS_LOCAL).to.equal('true')); - }); + it('should set IS_LOCAL', () => + expect(invoke.hooks['invoke:local:loadEnvVars']()).to.be.fulfilled.then(() => + expect(process.env.IS_LOCAL).to.equal('true') + )); it('should accept a single env option', () => { invoke.options = { env: 'NAME=value' }; diff --git a/lib/plugins/print/print.test.js b/lib/plugins/print/print.test.js index 25e01f5f9..5787492db 100644 --- a/lib/plugins/print/print.test.js +++ b/lib/plugins/print/print.test.js @@ -1,13 +1,16 @@ 'use strict'; const os = require('os'); -const expect = require('chai').expect; +const chai = require('chai'); const sinon = require('sinon'); const proxyquire = require('proxyquire'); const Serverless = require('../../Serverless'); const CLI = require('../../classes/CLI'); const YAML = require('js-yaml'); +chai.use(require('chai-as-promised')); + +const expect = chai.expect; describe('Print', () => { let print; diff --git a/lib/plugins/remove/remove.test.js b/lib/plugins/remove/remove.test.js index 89871dbe5..5d114d7a6 100644 --- a/lib/plugins/remove/remove.test.js +++ b/lib/plugins/remove/remove.test.js @@ -1,10 +1,14 @@ 'use strict'; -const expect = require('chai').expect; +const chai = require('chai'); const Remove = require('./remove'); const Serverless = require('../../Serverless'); const sinon = require('sinon'); +chai.use(require('chai-as-promised')); + +const expect = chai.expect; + describe('Remove', () => { let remove; let serverless; diff --git a/lib/utils/getServerlessConfigFile.test.js b/lib/utils/getServerlessConfigFile.test.js index 17318bb56..33b9661fb 100644 --- a/lib/utils/getServerlessConfigFile.test.js +++ b/lib/utils/getServerlessConfigFile.test.js @@ -1,13 +1,17 @@ 'use strict'; const path = require('path'); -const expect = require('chai').expect; +const chai = require('chai'); const testUtils = require('../../tests/utils'); const writeFileSync = require('./fs/writeFileSync'); const serverlessConfigFileUtils = require('./getServerlessConfigFile'); const getServerlessConfigFile = serverlessConfigFileUtils.getServerlessConfigFile; +chai.use(require('chai-as-promised')); + +const expect = chai.expect; + describe('#getServerlessConfigFile()', () => { let tmpDirPath; diff --git a/package-lock.json b/package-lock.json index e32acea0b..a329e0ca4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,9 +1,19 @@ { "name": "serverless", - "version": "1.42.3", + "version": "1.43.0", "lockfileVersion": 1, "requires": true, "dependencies": { + "2-thenable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/2-thenable/-/2-thenable-1.0.0.tgz", + "integrity": "sha512-HqiDzaLDFCXkcCO/SwoyhRwqYtINFHF7t9BDRq4x90TOKNAJpiqUt9X5lQ08bwxYzc067HUywDjGySpebHcUpw==", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.47" + } + }, "@babel/code-frame": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", @@ -1589,6 +1599,33 @@ "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, + "child-process-ext": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/child-process-ext/-/child-process-ext-2.0.0.tgz", + "integrity": "sha512-yTIjjYfLcZ8/gje3+O//GW57REjRaYx+I+7SEHnkzMJSrSESFGPStDG01hWpYWgdhcC5oTTP8Vstp/rXM3ddCg==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.5", + "es5-ext": "^0.10.46", + "split2": "^3.1", + "stream-promise": "^3.1" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + } + } + }, "ci-info": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", @@ -8181,6 +8218,28 @@ "extend-shallow": "^3.0.0" } }, + "split2": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.1.1.tgz", + "integrity": "sha512-emNzr1s7ruq4N+1993yht631/JH+jaj0NYBosuKmLcq+JkGQ9MmTw1RB1fGaTCzUuseRIClrlSLHRNYGwWQ58Q==", + "dev": true, + "requires": { + "readable-stream": "^3.0.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.3.0.tgz", + "integrity": "sha512-EsI+s3k3XsW+fU8fQACLN59ky34AZ14LoeVZpYwmZvldCFo0r0gnelwF2TcMjLor/BTL5aDJVBMkss0dthToPw==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -8295,6 +8354,17 @@ "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", "dev": true }, + "stream-promise": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/stream-promise/-/stream-promise-3.2.0.tgz", + "integrity": "sha512-P+7muTGs2C8yRcgJw/PPt61q7O517tDHiwYEzMWo1GSBCcZedUMT/clz7vUNsSxFphIlJ6QUL4GexQKlfJoVtA==", + "dev": true, + "requires": { + "2-thenable": "^1.0.0", + "es5-ext": "^0.10.49", + "is-stream": "^1.1.0" + } + }, "string-length": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", diff --git a/package.json b/package.json index 7e593e5d0..da31c03b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "serverless", - "version": "1.42.3", + "version": "1.43.0", "engines": { "node": ">=4.0" }, @@ -52,6 +52,7 @@ }, "scripts": { "test-bare": "node bin/test", + "test-isolated": "node bin/test-isolated", "test": "istanbul cover -x \"**/*.test.js\" bin/test", "lint": "eslint . --cache", "docs": "node scripts/generate-readme.js", @@ -70,6 +71,7 @@ "devDependencies": { "chai": "^3.5.0", "chai-as-promised": "^6.0.0", + "child-process-ext": "^2.0.0", "coveralls": "^3.0.3", "eslint": "^3.3.1", "eslint-config-airbnb": "^10.0.1", diff --git a/scripts/prs-since-last-tag b/scripts/prs-since-last-tag index 17b9a8d3d..90c9575dd 100755 --- a/scripts/prs-since-last-tag +++ b/scripts/prs-since-last-tag @@ -12,12 +12,12 @@ version=$(jq -r .version package.json) token=$(git config --global github.token) echo "# $version ($(date +%F))" +echo for pr in $(git log --reverse --grep "Merge pull request" "$last_tag"..HEAD | sed -nEe 's/.*#([0-9]+).*/\1/p'); do title=$(curl -s https://$token@api.github.com/repos/serverless/serverless/pulls/$pr | jq -r .title) - echo " - [$title](https://github.com/serverless/serverless/pull/$pr)" + echo "- [$title](https://github.com/serverless/serverless/pull/$pr)" done echo echo "## Meta" -echo " - [Comparison since last release](https://github.com/serverless/serverless/compare/$last_tag...v$version)" -echo +echo "- [Comparison since last release](https://github.com/serverless/serverless/compare/$last_tag...v$version)" echo diff --git a/tests/integration/aws/api-gateway/integration-lambda-proxy/api-keys/service/serverless.yml b/tests/integration/aws/api-gateway/integration-lambda-proxy/api-keys/service/serverless.yml index c790bf1e9..19f08adba 100644 --- a/tests/integration/aws/api-gateway/integration-lambda-proxy/api-keys/service/serverless.yml +++ b/tests/integration/aws/api-gateway/integration-lambda-proxy/api-keys/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x apiKeys: - WillBeReplacedBeforeDeployment diff --git a/tests/integration/aws/api-gateway/integration-lambda-proxy/cors/service/serverless.yml b/tests/integration/aws/api-gateway/integration-lambda-proxy/cors/service/serverless.yml index 630d7f28b..b0f885660 100644 --- a/tests/integration/aws/api-gateway/integration-lambda-proxy/cors/service/serverless.yml +++ b/tests/integration/aws/api-gateway/integration-lambda-proxy/cors/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/api-gateway/integration-lambda-proxy/custom-authorizers/service/serverless.yml b/tests/integration/aws/api-gateway/integration-lambda-proxy/custom-authorizers/service/serverless.yml index f02629f9f..c5d573a40 100644 --- a/tests/integration/aws/api-gateway/integration-lambda-proxy/custom-authorizers/service/serverless.yml +++ b/tests/integration/aws/api-gateway/integration-lambda-proxy/custom-authorizers/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/api-gateway/integration-lambda-proxy/simple-api/service/serverless.yml b/tests/integration/aws/api-gateway/integration-lambda-proxy/simple-api/service/serverless.yml index 78e77a2a0..b72f5a4c1 100644 --- a/tests/integration/aws/api-gateway/integration-lambda-proxy/simple-api/service/serverless.yml +++ b/tests/integration/aws/api-gateway/integration-lambda-proxy/simple-api/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/api-gateway/integration-lambda/api-keys/service/serverless.yml b/tests/integration/aws/api-gateway/integration-lambda/api-keys/service/serverless.yml index f183f62f6..dca0516ba 100644 --- a/tests/integration/aws/api-gateway/integration-lambda/api-keys/service/serverless.yml +++ b/tests/integration/aws/api-gateway/integration-lambda/api-keys/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x apiKeys: - WillBeReplacedBeforeDeployment diff --git a/tests/integration/aws/api-gateway/integration-lambda/cors/service/serverless.yml b/tests/integration/aws/api-gateway/integration-lambda/cors/service/serverless.yml index 2fefd441e..89d6fc2d6 100644 --- a/tests/integration/aws/api-gateway/integration-lambda/cors/service/serverless.yml +++ b/tests/integration/aws/api-gateway/integration-lambda/cors/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/api-gateway/integration-lambda/custom-authorizers/service/serverless.yml b/tests/integration/aws/api-gateway/integration-lambda/custom-authorizers/service/serverless.yml index bbe8486fd..c0b5a7250 100644 --- a/tests/integration/aws/api-gateway/integration-lambda/custom-authorizers/service/serverless.yml +++ b/tests/integration/aws/api-gateway/integration-lambda/custom-authorizers/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/api-gateway/integration-lambda/simple-api/service/serverless.yml b/tests/integration/aws/api-gateway/integration-lambda/simple-api/service/serverless.yml index 5906e242a..b4ef6a1a2 100644 --- a/tests/integration/aws/api-gateway/integration-lambda/simple-api/service/serverless.yml +++ b/tests/integration/aws/api-gateway/integration-lambda/simple-api/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/cloud-watch-event/multiple-events-multiple-functions/service/serverless.yml b/tests/integration/aws/cloud-watch-event/multiple-events-multiple-functions/service/serverless.yml index a885180bd..ab1075c76 100644 --- a/tests/integration/aws/cloud-watch-event/multiple-events-multiple-functions/service/serverless.yml +++ b/tests/integration/aws/cloud-watch-event/multiple-events-multiple-functions/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: cwe1: diff --git a/tests/integration/aws/cloud-watch-event/multiple-events-single-function/service/serverless.yml b/tests/integration/aws/cloud-watch-event/multiple-events-single-function/service/serverless.yml index 8612c47e2..b17378649 100644 --- a/tests/integration/aws/cloud-watch-event/multiple-events-single-function/service/serverless.yml +++ b/tests/integration/aws/cloud-watch-event/multiple-events-single-function/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: cwe1: diff --git a/tests/integration/aws/cloud-watch-event/single-event-multiple-functions/service/serverless.yml b/tests/integration/aws/cloud-watch-event/single-event-multiple-functions/service/serverless.yml index 98985d743..ac28afdca 100644 --- a/tests/integration/aws/cloud-watch-event/single-event-multiple-functions/service/serverless.yml +++ b/tests/integration/aws/cloud-watch-event/single-event-multiple-functions/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: cwe1: diff --git a/tests/integration/aws/cloud-watch-event/single-event-single-function/service/serverless.yml b/tests/integration/aws/cloud-watch-event/single-event-single-function/service/serverless.yml index 4e528e7c3..09df4393c 100644 --- a/tests/integration/aws/cloud-watch-event/single-event-single-function/service/serverless.yml +++ b/tests/integration/aws/cloud-watch-event/single-event-single-function/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: cwe1: diff --git a/tests/integration/aws/cognito-user-pool/multiple-pools-multiple-events-multiple-functions/service/serverless.yml b/tests/integration/aws/cognito-user-pool/multiple-pools-multiple-events-multiple-functions/service/serverless.yml index 7dc6f310a..9335d606a 100644 --- a/tests/integration/aws/cognito-user-pool/multiple-pools-multiple-events-multiple-functions/service/serverless.yml +++ b/tests/integration/aws/cognito-user-pool/multiple-pools-multiple-events-multiple-functions/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: preSignUp1: diff --git a/tests/integration/aws/cognito-user-pool/multiple-pools-single-event-single-function/service/serverless.yml b/tests/integration/aws/cognito-user-pool/multiple-pools-single-event-single-function/service/serverless.yml index 121de6025..e2d62ae50 100644 --- a/tests/integration/aws/cognito-user-pool/multiple-pools-single-event-single-function/service/serverless.yml +++ b/tests/integration/aws/cognito-user-pool/multiple-pools-single-event-single-function/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: preSignUp: diff --git a/tests/integration/aws/cognito-user-pool/single-pool-multiple-events-multiple-functions/service/serverless.yml b/tests/integration/aws/cognito-user-pool/single-pool-multiple-events-multiple-functions/service/serverless.yml index 9ecaf3f5f..b3d78c5b9 100644 --- a/tests/integration/aws/cognito-user-pool/single-pool-multiple-events-multiple-functions/service/serverless.yml +++ b/tests/integration/aws/cognito-user-pool/single-pool-multiple-events-multiple-functions/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: preSignUp: diff --git a/tests/integration/aws/cognito-user-pool/single-pool-single-event-single-function/service/serverless.yml b/tests/integration/aws/cognito-user-pool/single-pool-single-event-single-function/service/serverless.yml index 97167e310..4e5dcd826 100644 --- a/tests/integration/aws/cognito-user-pool/single-pool-single-event-single-function/service/serverless.yml +++ b/tests/integration/aws/cognito-user-pool/single-pool-single-event-single-function/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: preSignUp: diff --git a/tests/integration/aws/general/custom-resources/service/serverless.yml b/tests/integration/aws/general/custom-resources/service/serverless.yml index 58e8c1047..30d1b454f 100644 --- a/tests/integration/aws/general/custom-resources/service/serverless.yml +++ b/tests/integration/aws/general/custom-resources/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/general/environment-variables/service/serverless.yml b/tests/integration/aws/general/environment-variables/service/serverless.yml index e660815a2..00cc3e865 100644 --- a/tests/integration/aws/general/environment-variables/service/serverless.yml +++ b/tests/integration/aws/general/environment-variables/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x environment: provider_level_variable_1: provider_level_1 provider_level_variable_2: provider_level_2 diff --git a/tests/integration/aws/general/nested-handlers/service/serverless.yml b/tests/integration/aws/general/nested-handlers/service/serverless.yml index 9e874ba9a..870644b34 100644 --- a/tests/integration/aws/general/nested-handlers/service/serverless.yml +++ b/tests/integration/aws/general/nested-handlers/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/general/overwrite-resources/service/serverless.yml b/tests/integration/aws/general/overwrite-resources/service/serverless.yml index 6f255c362..19d78e077 100644 --- a/tests/integration/aws/general/overwrite-resources/service/serverless.yml +++ b/tests/integration/aws/general/overwrite-resources/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/general/package/service/serverless.yml b/tests/integration/aws/general/package/service/serverless.yml index cb030f421..b01bfe299 100644 --- a/tests/integration/aws/general/package/service/serverless.yml +++ b/tests/integration/aws/general/package/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/iot/multiple-rules-multiple-functions/service/serverless.yml b/tests/integration/aws/iot/multiple-rules-multiple-functions/service/serverless.yml index 0b1188863..c018fbd45 100644 --- a/tests/integration/aws/iot/multiple-rules-multiple-functions/service/serverless.yml +++ b/tests/integration/aws/iot/multiple-rules-multiple-functions/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: iot1: diff --git a/tests/integration/aws/iot/multiple-rules-single-function/service/serverless.yml b/tests/integration/aws/iot/multiple-rules-single-function/service/serverless.yml index ac4825ba3..5e13e0c96 100644 --- a/tests/integration/aws/iot/multiple-rules-single-function/service/serverless.yml +++ b/tests/integration/aws/iot/multiple-rules-single-function/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: iot1: diff --git a/tests/integration/aws/iot/single-rule-multiple-functions/service/serverless.yml b/tests/integration/aws/iot/single-rule-multiple-functions/service/serverless.yml index b41a289c6..0d8e4d393 100644 --- a/tests/integration/aws/iot/single-rule-multiple-functions/service/serverless.yml +++ b/tests/integration/aws/iot/single-rule-multiple-functions/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: iot1: diff --git a/tests/integration/aws/iot/single-rule-single-function/service/serverless.yml b/tests/integration/aws/iot/single-rule-single-function/service/serverless.yml index 4235c46b0..cb7ecf35f 100644 --- a/tests/integration/aws/iot/single-rule-single-function/service/serverless.yml +++ b/tests/integration/aws/iot/single-rule-single-function/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: iot1: diff --git a/tests/integration/aws/s3/multiple-events-multiple-functions-multiple-buckets/service/serverless.yml b/tests/integration/aws/s3/multiple-events-multiple-functions-multiple-buckets/service/serverless.yml index 49dce85ce..05cee4c24 100644 --- a/tests/integration/aws/s3/multiple-events-multiple-functions-multiple-buckets/service/serverless.yml +++ b/tests/integration/aws/s3/multiple-events-multiple-functions-multiple-buckets/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/s3/multiple-events-multiple-functions-single-bucket/service/serverless.yml b/tests/integration/aws/s3/multiple-events-multiple-functions-single-bucket/service/serverless.yml index 3c046a71e..b7d95c417 100644 --- a/tests/integration/aws/s3/multiple-events-multiple-functions-single-bucket/service/serverless.yml +++ b/tests/integration/aws/s3/multiple-events-multiple-functions-single-bucket/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: create: diff --git a/tests/integration/aws/s3/multiple-events-single-function-single-bucket/service/serverless.yml b/tests/integration/aws/s3/multiple-events-single-function-single-bucket/service/serverless.yml index 3d14e700a..212cb8ab2 100644 --- a/tests/integration/aws/s3/multiple-events-single-function-single-bucket/service/serverless.yml +++ b/tests/integration/aws/s3/multiple-events-single-function-single-bucket/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/s3/single-event-single-function-single-bucket/service/serverless.yml b/tests/integration/aws/s3/single-event-single-function-single-bucket/service/serverless.yml index 90a22cd81..17446857c 100644 --- a/tests/integration/aws/s3/single-event-single-function-single-bucket/service/serverless.yml +++ b/tests/integration/aws/s3/single-event-single-function-single-bucket/service/serverless.yml @@ -3,7 +3,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/schedule/multiple-schedules-multiple-functions/service/serverless.yml b/tests/integration/aws/schedule/multiple-schedules-multiple-functions/service/serverless.yml index 4ed8d4953..6bcb6fe38 100644 --- a/tests/integration/aws/schedule/multiple-schedules-multiple-functions/service/serverless.yml +++ b/tests/integration/aws/schedule/multiple-schedules-multiple-functions/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/sns/existing-topic/service/serverless.yml b/tests/integration/aws/sns/existing-topic/service/serverless.yml index 472535142..8be85bc03 100644 --- a/tests/integration/aws/sns/existing-topic/service/serverless.yml +++ b/tests/integration/aws/sns/existing-topic/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/sns/multiple-topics-multiple-functions/service/serverless.yml b/tests/integration/aws/sns/multiple-topics-multiple-functions/service/serverless.yml index 6e35cd187..209f3cba8 100644 --- a/tests/integration/aws/sns/multiple-topics-multiple-functions/service/serverless.yml +++ b/tests/integration/aws/sns/multiple-topics-multiple-functions/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/sns/multiple-topics-single-function/service/serverless.yml b/tests/integration/aws/sns/multiple-topics-single-function/service/serverless.yml index 3a29ef219..c0f1f29f9 100644 --- a/tests/integration/aws/sns/multiple-topics-single-function/service/serverless.yml +++ b/tests/integration/aws/sns/multiple-topics-single-function/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/sns/single-topic-multiple-functions/service/serverless.yml b/tests/integration/aws/sns/single-topic-multiple-functions/service/serverless.yml index 28ec23690..e81c8c2c6 100644 --- a/tests/integration/aws/sns/single-topic-multiple-functions/service/serverless.yml +++ b/tests/integration/aws/sns/single-topic-multiple-functions/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/aws/sns/single-topic-single-function/service/serverless.yml b/tests/integration/aws/sns/single-topic-single-function/service/serverless.yml index 2168713c2..3430ea40c 100644 --- a/tests/integration/aws/sns/single-topic-single-function/service/serverless.yml +++ b/tests/integration/aws/sns/single-topic-single-function/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/general/custom-plugins/service/serverless.yml b/tests/integration/general/custom-plugins/service/serverless.yml index 9357321be..b572235a4 100644 --- a/tests/integration/general/custom-plugins/service/serverless.yml +++ b/tests/integration/general/custom-plugins/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: diff --git a/tests/integration/general/local-plugins/service/serverless.yml b/tests/integration/general/local-plugins/service/serverless.yml index 0a155c126..c89417975 100644 --- a/tests/integration/general/local-plugins/service/serverless.yml +++ b/tests/integration/general/local-plugins/service/serverless.yml @@ -2,7 +2,7 @@ service: aws-nodejs # NOTE: update this with your service name provider: name: aws - runtime: nodejs6.10 + runtime: nodejs10.x functions: hello: