@guayaba/workflow-piece-webhook 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +33 -0
- package/README.md +5 -0
- package/assets/logo.png +0 -0
- package/package.json +26 -0
- package/src/i18n/ar.json +28 -0
- package/src/i18n/bg.json +28 -0
- package/src/i18n/ca.json +28 -0
- package/src/i18n/de.json +27 -0
- package/src/i18n/es.json +27 -0
- package/src/i18n/fr.json +27 -0
- package/src/i18n/hi.json +28 -0
- package/src/i18n/hu.json +28 -0
- package/src/i18n/hy.json +28 -0
- package/src/i18n/id.json +28 -0
- package/src/i18n/it.json +28 -0
- package/src/i18n/ja.json +27 -0
- package/src/i18n/ko.json +28 -0
- package/src/i18n/nl.json +27 -0
- package/src/i18n/pl.json +28 -0
- package/src/i18n/pt.json +27 -0
- package/src/i18n/ru.json +28 -0
- package/src/i18n/sv.json +28 -0
- package/src/i18n/translation.json +27 -0
- package/src/i18n/uk.json +28 -0
- package/src/i18n/vi.json +28 -0
- package/src/i18n/zh.json +27 -0
- package/src/index.ts +17 -0
- package/src/lib/actions/return-response-and-wait-for-next-webhook.ts +163 -0
- package/src/lib/actions/return-response.ts +171 -0
- package/src/lib/triggers/catch-hook.ts +319 -0
- package/test/hmac-verification.test.ts +476 -0
- package/tsconfig.json +19 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.spec.json +17 -0
- package/vitest.config.ts +18 -0
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
/// <reference types="vitest/globals" />
|
|
2
|
+
|
|
3
|
+
import { createHmac } from 'crypto';
|
|
4
|
+
import { verifyHmacAuth } from '../src/lib/triggers/catch-hook';
|
|
5
|
+
|
|
6
|
+
describe('verifyHmacAuth', () => {
|
|
7
|
+
const secret = 'test-secret-key';
|
|
8
|
+
const algorithm = 'sha256';
|
|
9
|
+
|
|
10
|
+
// Helper to compute HMAC signature
|
|
11
|
+
function computeSignature(
|
|
12
|
+
body: string,
|
|
13
|
+
secretKey: string,
|
|
14
|
+
algo: string,
|
|
15
|
+
encoding: 'hex' | 'base64'
|
|
16
|
+
): string {
|
|
17
|
+
const hmac = createHmac(algo, secretKey);
|
|
18
|
+
hmac.update(body);
|
|
19
|
+
return hmac.digest(encoding);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe('with hex encoding', () => {
|
|
23
|
+
const encoding = 'hex';
|
|
24
|
+
|
|
25
|
+
test('should return true for valid signature', () => {
|
|
26
|
+
const body = JSON.stringify({ event: 'test', data: 'payload' });
|
|
27
|
+
const signature = computeSignature(body, secret, algorithm, encoding);
|
|
28
|
+
const headers = { 'x-signature': signature };
|
|
29
|
+
|
|
30
|
+
const result = verifyHmacAuth(
|
|
31
|
+
headers,
|
|
32
|
+
body,
|
|
33
|
+
'x-signature',
|
|
34
|
+
secret,
|
|
35
|
+
algorithm,
|
|
36
|
+
encoding,
|
|
37
|
+
''
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
expect(result).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('should return false for invalid signature', () => {
|
|
44
|
+
const body = JSON.stringify({ event: 'test', data: 'payload' });
|
|
45
|
+
const headers = { 'x-signature': 'invalid-signature' };
|
|
46
|
+
|
|
47
|
+
const result = verifyHmacAuth(
|
|
48
|
+
headers,
|
|
49
|
+
body,
|
|
50
|
+
'x-signature',
|
|
51
|
+
secret,
|
|
52
|
+
algorithm,
|
|
53
|
+
encoding,
|
|
54
|
+
''
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
expect(result).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('should return false when signature header is missing', () => {
|
|
61
|
+
const body = JSON.stringify({ event: 'test', data: 'payload' });
|
|
62
|
+
const headers = {};
|
|
63
|
+
|
|
64
|
+
const result = verifyHmacAuth(
|
|
65
|
+
headers,
|
|
66
|
+
body,
|
|
67
|
+
'x-signature',
|
|
68
|
+
secret,
|
|
69
|
+
algorithm,
|
|
70
|
+
encoding,
|
|
71
|
+
''
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
expect(result).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('should return false when signature is computed with wrong secret', () => {
|
|
78
|
+
const body = JSON.stringify({ event: 'test', data: 'payload' });
|
|
79
|
+
const wrongSignature = computeSignature(
|
|
80
|
+
body,
|
|
81
|
+
'wrong-secret',
|
|
82
|
+
algorithm,
|
|
83
|
+
encoding
|
|
84
|
+
);
|
|
85
|
+
const headers = { 'x-signature': wrongSignature };
|
|
86
|
+
|
|
87
|
+
const result = verifyHmacAuth(
|
|
88
|
+
headers,
|
|
89
|
+
body,
|
|
90
|
+
'x-signature',
|
|
91
|
+
secret,
|
|
92
|
+
algorithm,
|
|
93
|
+
encoding,
|
|
94
|
+
''
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
expect(result).toBe(false);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test('should return false when body has been tampered with', () => {
|
|
101
|
+
const originalBody = JSON.stringify({ event: 'test', data: 'payload' });
|
|
102
|
+
const signature = computeSignature(
|
|
103
|
+
originalBody,
|
|
104
|
+
secret,
|
|
105
|
+
algorithm,
|
|
106
|
+
encoding
|
|
107
|
+
);
|
|
108
|
+
const headers = { 'x-signature': signature };
|
|
109
|
+
const tamperedBody = JSON.stringify({ event: 'test', data: 'modified' });
|
|
110
|
+
|
|
111
|
+
const result = verifyHmacAuth(
|
|
112
|
+
headers,
|
|
113
|
+
tamperedBody,
|
|
114
|
+
'x-signature',
|
|
115
|
+
secret,
|
|
116
|
+
algorithm,
|
|
117
|
+
encoding,
|
|
118
|
+
''
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
expect(result).toBe(false);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
describe('with base64 encoding', () => {
|
|
126
|
+
const encoding = 'base64';
|
|
127
|
+
|
|
128
|
+
test('should return true for valid base64 signature', () => {
|
|
129
|
+
const body = JSON.stringify({ event: 'test', data: 'payload' });
|
|
130
|
+
const signature = computeSignature(body, secret, algorithm, encoding);
|
|
131
|
+
const headers = { 'x-signature': signature };
|
|
132
|
+
|
|
133
|
+
const result = verifyHmacAuth(
|
|
134
|
+
headers,
|
|
135
|
+
body,
|
|
136
|
+
'x-signature',
|
|
137
|
+
secret,
|
|
138
|
+
algorithm,
|
|
139
|
+
encoding,
|
|
140
|
+
''
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
expect(result).toBe(true);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test('should return false for invalid base64 signature', () => {
|
|
147
|
+
const body = JSON.stringify({ event: 'test', data: 'payload' });
|
|
148
|
+
const headers = { 'x-signature': 'aW52YWxpZC1zaWduYXR1cmU=' };
|
|
149
|
+
|
|
150
|
+
const result = verifyHmacAuth(
|
|
151
|
+
headers,
|
|
152
|
+
body,
|
|
153
|
+
'x-signature',
|
|
154
|
+
secret,
|
|
155
|
+
algorithm,
|
|
156
|
+
encoding,
|
|
157
|
+
''
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
expect(result).toBe(false);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
describe('with signature prefix', () => {
|
|
165
|
+
const encoding = 'hex';
|
|
166
|
+
|
|
167
|
+
test('should strip prefix before verification (GitHub style sha256=)', () => {
|
|
168
|
+
const body = JSON.stringify({ event: 'push', ref: 'refs/heads/main' });
|
|
169
|
+
const signature = computeSignature(body, secret, algorithm, encoding);
|
|
170
|
+
const prefixedSignature = `sha256=${signature}`;
|
|
171
|
+
const headers = { 'x-hub-signature-256': prefixedSignature };
|
|
172
|
+
|
|
173
|
+
const result = verifyHmacAuth(
|
|
174
|
+
headers,
|
|
175
|
+
body,
|
|
176
|
+
'x-hub-signature-256',
|
|
177
|
+
secret,
|
|
178
|
+
algorithm,
|
|
179
|
+
encoding,
|
|
180
|
+
'sha256='
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
expect(result).toBe(true);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
test('should fail if prefix is missing when expected', () => {
|
|
187
|
+
const body = JSON.stringify({ event: 'push', ref: 'refs/heads/main' });
|
|
188
|
+
const signature = computeSignature(body, secret, algorithm, encoding);
|
|
189
|
+
// Signature without prefix, but prefix is configured
|
|
190
|
+
const headers = { 'x-hub-signature-256': signature };
|
|
191
|
+
|
|
192
|
+
const result = verifyHmacAuth(
|
|
193
|
+
headers,
|
|
194
|
+
body,
|
|
195
|
+
'x-hub-signature-256',
|
|
196
|
+
secret,
|
|
197
|
+
algorithm,
|
|
198
|
+
encoding,
|
|
199
|
+
'sha256='
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
expect(result).toBe(false);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
test('should work with sha1= prefix', () => {
|
|
206
|
+
const sha1Algorithm = 'sha1';
|
|
207
|
+
const body = JSON.stringify({ event: 'ping' });
|
|
208
|
+
const signature = computeSignature(body, secret, sha1Algorithm, encoding);
|
|
209
|
+
const prefixedSignature = `sha1=${signature}`;
|
|
210
|
+
const headers = { 'x-hub-signature': prefixedSignature };
|
|
211
|
+
|
|
212
|
+
const result = verifyHmacAuth(
|
|
213
|
+
headers,
|
|
214
|
+
body,
|
|
215
|
+
'x-hub-signature',
|
|
216
|
+
secret,
|
|
217
|
+
sha1Algorithm,
|
|
218
|
+
encoding,
|
|
219
|
+
'sha1='
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
expect(result).toBe(true);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
describe('with different algorithms', () => {
|
|
227
|
+
const encoding = 'hex';
|
|
228
|
+
|
|
229
|
+
test('should work with SHA-1 algorithm', () => {
|
|
230
|
+
const sha1Algorithm = 'sha1';
|
|
231
|
+
const body = JSON.stringify({ data: 'test' });
|
|
232
|
+
const signature = computeSignature(body, secret, sha1Algorithm, encoding);
|
|
233
|
+
const headers = { 'x-signature': signature };
|
|
234
|
+
|
|
235
|
+
const result = verifyHmacAuth(
|
|
236
|
+
headers,
|
|
237
|
+
body,
|
|
238
|
+
'x-signature',
|
|
239
|
+
secret,
|
|
240
|
+
sha1Algorithm,
|
|
241
|
+
encoding,
|
|
242
|
+
''
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
expect(result).toBe(true);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
test('should work with SHA-512 algorithm', () => {
|
|
249
|
+
const sha512Algorithm = 'sha512';
|
|
250
|
+
const body = JSON.stringify({ data: 'test' });
|
|
251
|
+
const signature = computeSignature(
|
|
252
|
+
body,
|
|
253
|
+
secret,
|
|
254
|
+
sha512Algorithm,
|
|
255
|
+
encoding
|
|
256
|
+
);
|
|
257
|
+
const headers = { 'x-signature': signature };
|
|
258
|
+
|
|
259
|
+
const result = verifyHmacAuth(
|
|
260
|
+
headers,
|
|
261
|
+
body,
|
|
262
|
+
'x-signature',
|
|
263
|
+
secret,
|
|
264
|
+
sha512Algorithm,
|
|
265
|
+
encoding,
|
|
266
|
+
''
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
expect(result).toBe(true);
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test('should fail when algorithm mismatches', () => {
|
|
273
|
+
const body = JSON.stringify({ data: 'test' });
|
|
274
|
+
// Compute with SHA-256
|
|
275
|
+
const signature = computeSignature(body, secret, 'sha256', encoding);
|
|
276
|
+
const headers = { 'x-signature': signature };
|
|
277
|
+
|
|
278
|
+
// Verify expecting SHA-512
|
|
279
|
+
const result = verifyHmacAuth(
|
|
280
|
+
headers,
|
|
281
|
+
body,
|
|
282
|
+
'x-signature',
|
|
283
|
+
secret,
|
|
284
|
+
'sha512',
|
|
285
|
+
encoding,
|
|
286
|
+
''
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
expect(result).toBe(false);
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
describe('with different body types', () => {
|
|
294
|
+
const encoding = 'hex';
|
|
295
|
+
|
|
296
|
+
test('should handle string body', () => {
|
|
297
|
+
const body = 'plain text body';
|
|
298
|
+
const signature = computeSignature(body, secret, algorithm, encoding);
|
|
299
|
+
const headers = { 'x-signature': signature };
|
|
300
|
+
|
|
301
|
+
const result = verifyHmacAuth(
|
|
302
|
+
headers,
|
|
303
|
+
body,
|
|
304
|
+
'x-signature',
|
|
305
|
+
secret,
|
|
306
|
+
algorithm,
|
|
307
|
+
encoding,
|
|
308
|
+
''
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
expect(result).toBe(true);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
test('should handle Buffer body', () => {
|
|
315
|
+
const bodyString = 'buffer body content';
|
|
316
|
+
const body = Buffer.from(bodyString, 'utf8');
|
|
317
|
+
const signature = computeSignature(
|
|
318
|
+
bodyString,
|
|
319
|
+
secret,
|
|
320
|
+
algorithm,
|
|
321
|
+
encoding
|
|
322
|
+
);
|
|
323
|
+
const headers = { 'x-signature': signature };
|
|
324
|
+
|
|
325
|
+
const result = verifyHmacAuth(
|
|
326
|
+
headers,
|
|
327
|
+
body,
|
|
328
|
+
'x-signature',
|
|
329
|
+
secret,
|
|
330
|
+
algorithm,
|
|
331
|
+
encoding,
|
|
332
|
+
''
|
|
333
|
+
);
|
|
334
|
+
|
|
335
|
+
expect(result).toBe(true);
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
test('should handle object body by JSON stringifying', () => {
|
|
339
|
+
const bodyObject = { event: 'test', nested: { key: 'value' } };
|
|
340
|
+
const expectedBodyString = JSON.stringify(bodyObject);
|
|
341
|
+
const signature = computeSignature(
|
|
342
|
+
expectedBodyString,
|
|
343
|
+
secret,
|
|
344
|
+
algorithm,
|
|
345
|
+
encoding
|
|
346
|
+
);
|
|
347
|
+
const headers = { 'x-signature': signature };
|
|
348
|
+
|
|
349
|
+
const result = verifyHmacAuth(
|
|
350
|
+
headers,
|
|
351
|
+
bodyObject,
|
|
352
|
+
'x-signature',
|
|
353
|
+
secret,
|
|
354
|
+
algorithm,
|
|
355
|
+
encoding,
|
|
356
|
+
''
|
|
357
|
+
);
|
|
358
|
+
|
|
359
|
+
expect(result).toBe(true);
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
test('should handle undefined body as empty string', () => {
|
|
363
|
+
const signature = computeSignature('', secret, algorithm, encoding);
|
|
364
|
+
const headers = { 'x-signature': signature };
|
|
365
|
+
|
|
366
|
+
const result = verifyHmacAuth(
|
|
367
|
+
headers,
|
|
368
|
+
undefined,
|
|
369
|
+
'x-signature',
|
|
370
|
+
secret,
|
|
371
|
+
algorithm,
|
|
372
|
+
encoding,
|
|
373
|
+
''
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
expect(result).toBe(true);
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
test('should handle null body as empty string', () => {
|
|
380
|
+
const signature = computeSignature('', secret, algorithm, encoding);
|
|
381
|
+
const headers = { 'x-signature': signature };
|
|
382
|
+
|
|
383
|
+
const result = verifyHmacAuth(
|
|
384
|
+
headers,
|
|
385
|
+
null,
|
|
386
|
+
'x-signature',
|
|
387
|
+
secret,
|
|
388
|
+
algorithm,
|
|
389
|
+
encoding,
|
|
390
|
+
''
|
|
391
|
+
);
|
|
392
|
+
|
|
393
|
+
expect(result).toBe(true);
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
describe('header name case sensitivity', () => {
|
|
398
|
+
const encoding = 'hex';
|
|
399
|
+
|
|
400
|
+
test('should find header with lowercase conversion', () => {
|
|
401
|
+
const body = JSON.stringify({ event: 'test' });
|
|
402
|
+
const signature = computeSignature(body, secret, algorithm, encoding);
|
|
403
|
+
// Header stored with lowercase (as HTTP headers typically are)
|
|
404
|
+
const headers = { 'x-signature': signature };
|
|
405
|
+
|
|
406
|
+
const result = verifyHmacAuth(
|
|
407
|
+
headers,
|
|
408
|
+
body,
|
|
409
|
+
'X-Signature', // Configured with mixed case
|
|
410
|
+
secret,
|
|
411
|
+
algorithm,
|
|
412
|
+
encoding,
|
|
413
|
+
''
|
|
414
|
+
);
|
|
415
|
+
|
|
416
|
+
expect(result).toBe(true);
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
test('should find header with all caps conversion', () => {
|
|
420
|
+
const body = JSON.stringify({ event: 'test' });
|
|
421
|
+
const signature = computeSignature(body, secret, algorithm, encoding);
|
|
422
|
+
const headers = { 'x-hub-signature-256': signature };
|
|
423
|
+
|
|
424
|
+
const result = verifyHmacAuth(
|
|
425
|
+
headers,
|
|
426
|
+
body,
|
|
427
|
+
'X-Hub-Signature-256',
|
|
428
|
+
secret,
|
|
429
|
+
algorithm,
|
|
430
|
+
encoding,
|
|
431
|
+
''
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
expect(result).toBe(true);
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
describe('timing-safe comparison', () => {
|
|
439
|
+
const encoding = 'hex';
|
|
440
|
+
|
|
441
|
+
test('should return false for signatures of different lengths', () => {
|
|
442
|
+
const body = JSON.stringify({ event: 'test' });
|
|
443
|
+
// Short invalid signature
|
|
444
|
+
const headers = { 'x-signature': 'abc123' };
|
|
445
|
+
|
|
446
|
+
const result = verifyHmacAuth(
|
|
447
|
+
headers,
|
|
448
|
+
body,
|
|
449
|
+
'x-signature',
|
|
450
|
+
secret,
|
|
451
|
+
algorithm,
|
|
452
|
+
encoding,
|
|
453
|
+
''
|
|
454
|
+
);
|
|
455
|
+
|
|
456
|
+
expect(result).toBe(false);
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
test('should return false for empty signature', () => {
|
|
460
|
+
const body = JSON.stringify({ event: 'test' });
|
|
461
|
+
const headers = { 'x-signature': '' };
|
|
462
|
+
|
|
463
|
+
const result = verifyHmacAuth(
|
|
464
|
+
headers,
|
|
465
|
+
body,
|
|
466
|
+
'x-signature',
|
|
467
|
+
secret,
|
|
468
|
+
algorithm,
|
|
469
|
+
encoding,
|
|
470
|
+
''
|
|
471
|
+
);
|
|
472
|
+
|
|
473
|
+
expect(result).toBe(false);
|
|
474
|
+
});
|
|
475
|
+
});
|
|
476
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"forceConsistentCasingInFileNames": true,
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noImplicitOverride": true,
|
|
8
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
9
|
+
"noImplicitReturns": true,
|
|
10
|
+
"noFallthroughCasesInSwitch": true
|
|
11
|
+
},
|
|
12
|
+
"files": [],
|
|
13
|
+
"include": [],
|
|
14
|
+
"references": [
|
|
15
|
+
{
|
|
16
|
+
"path": "./tsconfig.lib.json"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"rootDir": ".",
|
|
6
|
+
"baseUrl": ".",
|
|
7
|
+
"paths": {},
|
|
8
|
+
"outDir": "./dist",
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"declarationMap": true,
|
|
11
|
+
"types": ["node"]
|
|
12
|
+
},
|
|
13
|
+
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
|
|
14
|
+
"include": ["src/**/*.ts"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"types": ["vitest/globals", "node"],
|
|
7
|
+
"allowSyntheticDefaultImports": true
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"vitest.config.ts",
|
|
11
|
+
"src/**/*.test.ts",
|
|
12
|
+
"src/**/*.spec.ts",
|
|
13
|
+
"src/**/*.d.ts",
|
|
14
|
+
"test/**/*.test.ts",
|
|
15
|
+
"test/**/*.spec.ts"
|
|
16
|
+
]
|
|
17
|
+
}
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import { defineConfig } from 'vitest/config'
|
|
3
|
+
|
|
4
|
+
const repoRoot = path.resolve(__dirname, '../../../..')
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
test: {
|
|
8
|
+
globals: true,
|
|
9
|
+
environment: 'node',
|
|
10
|
+
},
|
|
11
|
+
resolve: {
|
|
12
|
+
alias: {
|
|
13
|
+
'@guayaba/workflows-shared': path.resolve(repoRoot, 'packages/shared/src/index.ts'),
|
|
14
|
+
'@guayaba/workflows-framework': path.resolve(repoRoot, 'packages/pieces/framework/src/index.ts'),
|
|
15
|
+
'@guayaba/workflows-common': path.resolve(repoRoot, 'packages/pieces/common/src/index.ts'),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
})
|