Skip to content

Commit

Permalink
test: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioramos committed Jun 12, 2020
1 parent 1b955dd commit 6abca25
Show file tree
Hide file tree
Showing 80 changed files with 149,553 additions and 562 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ logfile
.nyc_output
coverage
node_modules
test/__fixtures__

.git/*
.DS_Store
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ jobs:
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '13.x'
registry-url: https://npm.pkg.github.com/
scope: '@sergioramos'
- name: Install dependencies
run: yarn install --immutable
env:
YARN_CHECKSUM_BEHAVIOR: update
# - name: Publish
# run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,5 @@ $RECYCLE.BIN/
.yarn/build-state.yml
.yarn/unplugged
.npmrc
.serverless
.serverless
test/__fixtures__/*/plugin
47 changes: 19 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@
"scripts": {
"eslint": "eslint . --ext .js",
"fmt": "prettier --config package.json --write '**/*'",
"test": "NODE_ENV=test c8 -r lcovonly -r html -r text ava"
"test": "NODE_ENV=test ava --timeout 99999"
},
"dependencies": {
"@zeit/node-file-trace": "^0.6.1",
"@zeit/node-file-trace": "^0.6.3",
"apr-find": "^3.0.3",
"apr-for-each": "^3.0.3",
"apr-map": "^3.0.3",
"apr-parallel": "^3.0.3",
"archiver": "^4.0.1",
"globby": "^11.0.0",
"globby": "^11.0.1",
"lodash.sortby": "^4.7.0",
"lodash.topairs": "^4.3.0",
"lodash.uniq": "^4.5.0",
Expand All @@ -44,13 +43,19 @@
"tempy": "^0.5.0"
},
"devDependencies": {
"apr-for-each": "^3.0.3",
"apr-intercept": "^3.0.4",
"apr-reduce": "^3.0.3",
"ava": "^3.8.2",
"c8": "^7.1.2",
"eslint": "^7.1.0",
"directory-tree": "^2.2.4",
"eslint": "^7.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-xo-space": "^0.24.0",
"eslint-config-xo-space": "^0.25.0",
"execa": "^4.0.2",
"hasha": "^5.2.0",
"husky": "^4.2.5",
"lint-staged": "^10.2.6",
"lint-staged": "^10.2.10",
"path-type": "^4.0.0",
"prettier": "^2.0.5"
},
"peerDependencies": {
Expand Down Expand Up @@ -81,26 +86,7 @@
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false,
"overrides": [
{
"files": [
".eslintrc",
".prettierrc"
],
"options": {
"parser": "json"
}
},
{
"files": [
"serverless.js"
],
"options": {
"printWidth": 120
}
}
]
"useTabs": false
},
"eslintConfig": {
"extends": [
Expand All @@ -113,5 +99,10 @@
"camelcase": 0,
"capitalized-comments": 0
}
},
"ava": {
"files": [
"test/*.js"
]
}
}
16 changes: 0 additions & 16 deletions test/__fixtures__/ts-workspace/package.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"name": "hello-handler",
"private": true,
"main": "index.ts",
"devDependencies": {
"aws-lambda": "1.0.6",
"dependencies": {
"framework": "workspace:framework",
"out": "workspace:out"
},
"devDependencies": {
"aws-lambda": "1.0.6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"name": "world-handler",
"private": true,
"main": "index.ts",
"devDependencies": {
"aws-lambda": "1.0.6",
"dependencies": {
"framework": "workspace:framework",
"out": "workspace:out"
},
"devDependencies": {
"aws-lambda": "1.0.6"
}
}
File renamed without changes.
14 changes: 14 additions & 0 deletions test/__fixtures__/ts-ws-all/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "serverless-plugin-tree-shake-ts-ws-all",
"private": true,
"devDependencies": {
"serverless": "^1.72.0",
"typescript": "^3.9.5"
},
"workspaces": [
"handlers/*",
"framework",
"out",
"plugin"
]
}
39 changes: 39 additions & 0 deletions test/__fixtures__/ts-ws-all/serverless.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const { name: service } = require('./package.json');

module.exports = {
service,
plugins: ['./plugin'],
provider: {
name: 'aws',
runtime: 'nodejs12.x',
},
package: {
individually: false,
// we don't need this because of tree-shake
excludeDevDependencies: false,
},
functions: {
hello: {
handler: 'handlers/hello/index.handler',
events: [
{
httpApi: {
method: 'GET',
path: '/hello',
},
},
],
},
world: {
handler: 'handlers/world/index.handler',
events: [
{
httpApi: {
method: 'GET',
path: '/world',
},
},
],
},
},
};
File renamed without changes.

0 comments on commit 6abca25

Please sign in to comment.