-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from chanthafef/master
support aliases with ``serverless-bundle test``
- Loading branch information
Showing
13 changed files
with
91 additions
and
3,841 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"parserOptions": { | ||
"sourceType": "module" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { runJestCommand, clearNpmCache } = require("../helpers"); | ||
|
||
beforeEach(async () => { | ||
await clearNpmCache(__dirname); | ||
}); | ||
|
||
afterAll(async () => { | ||
await clearNpmCache(__dirname); | ||
}); | ||
|
||
test("aliases-jest", async () => { | ||
const result = await runJestCommand(__dirname); | ||
|
||
// Ensure Jest ran the included tests successfully | ||
expect(result).not.toMatch(/failed/); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import sum from "libs/sum"; | ||
|
||
const res = (body = {}) => ({ | ||
statusCode: 200, | ||
body: JSON.stringify(body, null, 2) | ||
}); | ||
|
||
export const hello = () => | ||
res({ | ||
sum: sum(1, 2, 3) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default (...numbers) => numbers.reduce((acc, nbr) => acc + nbr); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "aliases-jest", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "handler.js", | ||
"scripts": { | ||
"test": "../../bin/scripts.js test --testPathIgnorePatterns=\"./aliases-jest.test.js\"" | ||
}, | ||
"jest": { | ||
"moduleNameMapper": { | ||
"libs(.*)$": "<rootDir>/libs/$1" | ||
} | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
service: my-service | ||
|
||
plugins: | ||
- '../../index' | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs10.x | ||
|
||
functions: | ||
hello: | ||
handler: handler.hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { hello } from "../handler"; | ||
|
||
test("hello returns sum equal 6 in body", () => { | ||
const expected = 6; | ||
const actual = JSON.parse(hello().body).sum; | ||
|
||
expect(actual).toBe(expected); | ||
}); |
Oops, something went wrong.