mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
Merge branch 'master' into plat-916
This commit is contained in:
commit
df5cfd4e4d
1
.gitignore
vendored
1
.gitignore
vendored
@ -57,5 +57,4 @@ jest
|
||||
|
||||
# DotNet
|
||||
obj/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
11
CHANGELOG.md
11
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)
|
||||
|
||||
@ -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 <OLD-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@<new-tag>` or `npm install -g serverless` if latest is released)
|
||||
|
||||
## Post-Release
|
||||
|
||||
- [ ] Run `./scripts/generate-release-contributors-list <old-tag> <new-tag>` and hand the generated list over to the release blog post author
|
||||
|
||||
9
bin/test
9
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');
|
||||
|
||||
66
bin/test-isolated
Executable file
66
bin/test-isolated
Executable file
@ -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;
|
||||
});
|
||||
});
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ service: hello-world # Service Name
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
helloWorld:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
```
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
…
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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', () => {
|
||||
|
||||
@ -162,6 +162,8 @@ class Service {
|
||||
that.layers = serverlessFile.layers || {};
|
||||
}
|
||||
|
||||
that.outputs = serverlessFile.outputs;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -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}',
|
||||
|
||||
@ -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', () => {
|
||||
|
||||
@ -38,7 +38,7 @@ class AwsInvokeLocal {
|
||||
getRuntime() {
|
||||
return this.options.functionObj.runtime
|
||||
|| this.serverless.service.provider.runtime
|
||||
|| 'nodejs4.3';
|
||||
|| 'nodejs10.x';
|
||||
}
|
||||
|
||||
validateFile(filePath, key) {
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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:*:*'],
|
||||
},
|
||||
|
||||
@ -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',
|
||||
},
|
||||
};
|
||||
|
||||
@ -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', () => {
|
||||
|
||||
@ -9,7 +9,7 @@ plugins:
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs8.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
custom:
|
||||
alexa:
|
||||
|
||||
@ -21,7 +21,7 @@ service: aws-clojurescript-gradle
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
# you can overwrite defaults here
|
||||
# stage: dev
|
||||
|
||||
@ -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
|
||||
|
||||
@ -9,7 +9,7 @@ plugins:
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs8.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
first:
|
||||
|
||||
@ -9,7 +9,7 @@ plugins:
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs8.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
hello:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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' };
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
72
package-lock.json
generated
72
package-lock.json
generated
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
cwe1:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
cwe1:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
cwe1:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
cwe1:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
preSignUp1:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
preSignUp:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
preSignUp:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
preSignUp:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
iot1:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
iot1:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
iot1:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
iot1:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
hello:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
create:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
hello:
|
||||
|
||||
@ -3,7 +3,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
hello:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
hello:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
hello:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
hello:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
hello:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
hello:
|
||||
|
||||
@ -2,7 +2,7 @@ service: aws-nodejs
|
||||
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
runtime: nodejs10.x
|
||||
|
||||
functions:
|
||||
hello:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user