This commit is contained in:
Jaga Santagostino
2017-06-10 11:24:17 +02:00
parent 4c58a7a564
commit ca934c8fbf
3 changed files with 2162 additions and 13 deletions
+16 -1
View File
@@ -10,7 +10,8 @@
"scripts": {
"prepublish": "npm run build",
"build": "rm -rf dist && tsc",
"test": "npm run lint",
"pretest": "npm run lint",
"test": "jest",
"lint": "tslint -c tslint.json 'src/**/*.ts'"
},
"repository": {
@@ -25,7 +26,10 @@
],
"devDependencies": {
"@types/fs-extra": "2.0.0",
"@types/jest": "^19.2.4",
"@types/lodash": "^4.14.62",
"jest": "^20.0.4",
"ts-jest": "^20.0.6",
"tslint": "^5.1.0"
},
"dependencies": {
@@ -33,5 +37,16 @@
"globby": "^6.1.0",
"lodash": "^4.17.4",
"typescript": "^2.2.2"
},
"jest": {
"transform": {
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
]
}
}
+41
View File
@@ -0,0 +1,41 @@
import {extractFileNames} from '../src/typescript'
import {ServerlessFunction} from '../src/types'
const functions: { [key: string]: ServerlessFunction } = {
hello: {
handler: 'my-folder/hello.handler',
package: {
include: [],
exclude: []
}
},
world: {
handler: 'my-folder/my-subfolder/world.handler',
package: {
include: [],
exclude: []
}
},
create: {
handler: 'create.create',
package: {
include: [],
exclude: []
}
},
}
describe('extractFileName', () => {
it('get function filenames from serverless service', () => {
expect(
extractFileNames(functions),
).toEqual(
[
'my-folder/hello.ts',
'my-folder/my-subfolder/world.ts',
'create.ts',
],
)
})
})
+2105 -12
View File
File diff suppressed because it is too large Load Diff