File tree Expand file tree Collapse file tree 3 files changed +2169
-20
lines changed
Expand file tree Collapse file tree 3 files changed +2169
-20
lines changed Original file line number Diff line number Diff line change 1010 "scripts" : {
1111 "prepublish" : " npm run build" ,
1212 "build" : " rm -rf dist && tsc" ,
13- "test" : " npm run lint" ,
13+ "pretest" : " npm run lint" ,
14+ "test" : " jest" ,
1415 "lint" : " tslint -c tslint.json 'src/**/*.ts'"
1516 },
1617 "repository" : {
2526 ],
2627 "devDependencies" : {
2728 "@types/fs-extra" : " 2.0.0" ,
29+ "@types/jest" : " ^19.2.4" ,
2830 "@types/lodash" : " ^4.14.62" ,
31+ "jest" : " ^20.0.4" ,
32+ "ts-jest" : " ^20.0.6" ,
2933 "tslint" : " ^5.1.0"
3034 },
3135 "dependencies" : {
3236 "fs-p" : " 2.0.0" ,
3337 "globby" : " ^6.1.0" ,
3438 "lodash" : " ^4.17.4" ,
3539 "typescript" : " ^2.2.2"
40+ },
41+ "jest" : {
42+ "transform" : {
43+ ".(ts|tsx)" : " <rootDir>/node_modules/ts-jest/preprocessor.js"
44+ },
45+ "testRegex" : " (/__tests__/.*|\\ .(test|spec))\\ .(ts|tsx|js)$" ,
46+ "moduleFileExtensions" : [
47+ " ts" ,
48+ " tsx" ,
49+ " js"
50+ ]
3651 }
3752}
Original file line number Diff line number Diff line change 1+ import { extractFileNames } from '../src/typescript'
2+ import { ServerlessFunction } from '../src/types'
3+
4+ const functions : { [ key : string ] : ServerlessFunction } = {
5+ hello : {
6+ handler : 'my-folder/hello.handler' ,
7+ package : {
8+ include : [ ] ,
9+ exclude : [ ]
10+ }
11+ } ,
12+ world : {
13+ handler : 'my-folder/my-subfolder/world.handler' ,
14+ package : {
15+ include : [ ] ,
16+ exclude : [ ]
17+ }
18+ } ,
19+ create : {
20+ handler : 'create.create' ,
21+ package : {
22+ include : [ ] ,
23+ exclude : [ ]
24+ }
25+ } ,
26+ }
27+
28+ describe ( 'extractFileName' , ( ) => {
29+ it ( 'get function filenames from serverless service' , ( ) => {
30+ expect (
31+ extractFileNames ( functions ) ,
32+ ) . toEqual (
33+ [
34+ 'my-folder/hello.ts' ,
35+ 'my-folder/my-subfolder/world.ts' ,
36+ 'create.ts' ,
37+ ] ,
38+ )
39+ } )
40+ } )
41+
You can’t perform that action at this time.
0 commit comments