@@ -43,7 +43,7 @@ test('GoFunction with defaults', () => {
43
43
test ( 'GoFunction with using provided runtime' , ( ) => {
44
44
// WHEN
45
45
new GoFunction ( stack , 'handler' , {
46
- entry : 'test/ lambda-handler-vendor/cmd/api',
46
+ entry : path . join ( __dirname , ' lambda-handler-vendor/cmd/api') ,
47
47
runtime : Runtime . PROVIDED ,
48
48
} ) ;
49
49
@@ -60,7 +60,7 @@ test('GoFunction with using provided runtime', () => {
60
60
test ( 'GoFunction with using golang runtime' , ( ) => {
61
61
// WHEN
62
62
new GoFunction ( stack , 'handler' , {
63
- entry : 'test/ lambda-handler-vendor/cmd/api',
63
+ entry : path . join ( __dirname , ' lambda-handler-vendor/cmd/api') ,
64
64
runtime : Runtime . GO_1_X ,
65
65
} ) ;
66
66
@@ -77,7 +77,7 @@ test('GoFunction with using golang runtime', () => {
77
77
test ( 'GoFunction with container env vars' , ( ) => {
78
78
// WHEN
79
79
new GoFunction ( stack , 'handler' , {
80
- entry : 'test/ lambda-handler-vendor/cmd/api',
80
+ entry : path . join ( __dirname , ' lambda-handler-vendor/cmd/api') ,
81
81
bundling : {
82
82
environment : {
83
83
KEY : 'VALUE' ,
@@ -94,15 +94,15 @@ test('GoFunction with container env vars', () => {
94
94
95
95
test ( 'throws with the wrong runtime family' , ( ) => {
96
96
expect ( ( ) => new GoFunction ( stack , 'handler' , {
97
- entry : 'test/ lambda-handler-vendor/cmd/api',
97
+ entry : path . join ( __dirname , ' lambda-handler-vendor/cmd/api') ,
98
98
runtime : Runtime . PYTHON_3_8 ,
99
99
} ) ) . toThrow ( / O n l y ` g o ` a n d ` p r o v i d e d ` r u n t i m e s a r e s u p p o r t e d / ) ;
100
100
} ) ;
101
101
102
102
test ( 'resolves entry to an absolute path' , ( ) => {
103
103
// WHEN
104
104
new GoFunction ( stack , 'fn' , {
105
- entry : 'test/ lambda-handler-vendor/cmd/api/main.go',
105
+ entry : path . join ( __dirname , ' lambda-handler-vendor/cmd/api/main.go') ,
106
106
} ) ;
107
107
108
108
expect ( Bundling . bundle ) . toHaveBeenCalledWith ( expect . objectContaining ( {
@@ -112,22 +112,22 @@ test('resolves entry to an absolute path', () => {
112
112
113
113
test ( 'throws with no existing go.mod file' , ( ) => {
114
114
expect ( ( ) => new GoFunction ( stack , 'handler' , {
115
- entry : 'test/ lambda-handler-vendor/cmd/api',
115
+ entry : path . join ( __dirname , ' lambda-handler-vendor/cmd/api') ,
116
116
moduleDir : '/does/not/exist/go.mod' ,
117
117
} ) ) . toThrow ( / g o .m o d f i l e a t \/ d o e s \/ n o t \/ e x i s t \/ g o .m o d d o e s n ' t e x i s t / ) ;
118
118
} ) ;
119
119
120
120
test ( 'throws with incorrect moduleDir file' , ( ) => {
121
121
expect ( ( ) => new GoFunction ( stack , 'handler' , {
122
- entry : 'test/ lambda-handler-vendor/cmd/api',
122
+ entry : path . join ( __dirname , ' lambda-handler-vendor/cmd/api') ,
123
123
moduleDir : '/does/not/exist.mod' ,
124
124
} ) ) . toThrow ( / m o d u l e D i r i s s p e c i f y i n g a f i l e t h a t i s n o t g o .m o d / ) ;
125
125
} ) ;
126
126
127
127
test ( 'custom moduleDir can be used' , ( ) => {
128
128
new GoFunction ( stack , 'handler' , {
129
- entry : 'test/ lambda-handler-vendor/cmd/api',
130
- moduleDir : 'test/ lambda-handler-vendor',
129
+ entry : path . join ( __dirname , ' lambda-handler-vendor/cmd/api') ,
130
+ moduleDir : path . join ( __dirname , ' lambda-handler-vendor') ,
131
131
} ) ;
132
132
133
133
Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::Lambda::Function' , {
@@ -137,8 +137,8 @@ test('custom moduleDir can be used', () => {
137
137
138
138
test ( 'custom moduleDir with file path can be used' , ( ) => {
139
139
new GoFunction ( stack , 'handler' , {
140
- entry : 'test/ lambda-handler-vendor/cmd/api',
141
- moduleDir : 'test/ lambda-handler-vendor/go.mod',
140
+ entry : path . join ( __dirname , ' lambda-handler-vendor/cmd/api') ,
141
+ moduleDir : path . join ( __dirname , ' lambda-handler-vendor/go.mod') ,
142
142
} ) ;
143
143
144
144
Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::Lambda::Function' , {
0 commit comments