@platforma-sdk/tengo-builder 2.3.14 → 2.4.0
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/dist/compiler/source.cjs +156 -92
- package/dist/compiler/source.cjs.map +1 -1
- package/dist/compiler/source.d.ts +8 -6
- package/dist/compiler/source.d.ts.map +1 -1
- package/dist/compiler/source.js +156 -92
- package/dist/compiler/source.js.map +1 -1
- package/dist/compiler/test.artifacts.d.ts +5 -2
- package/dist/compiler/test.artifacts.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/compiler/source.test.ts +209 -50
- package/src/compiler/source.ts +203 -108
- package/src/compiler/test.artifacts.ts +50 -4
|
@@ -1,18 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
newGetSoftwareInfoRE,
|
|
3
|
+
newGetTemplateIdRE,
|
|
4
|
+
parseSource,
|
|
5
|
+
sourceParserContext,
|
|
6
|
+
lineProcessingResult,
|
|
7
|
+
} from './source';
|
|
2
8
|
import { createLogger } from './util';
|
|
3
9
|
import {
|
|
4
10
|
testLocalLib1Name,
|
|
5
11
|
testLocalLib1Src,
|
|
12
|
+
testLocalLib1SrcNormalized,
|
|
6
13
|
testLocalLib2Name,
|
|
7
14
|
testLocalLib2Src,
|
|
8
|
-
|
|
15
|
+
testLocalLib2SrcNormalized,
|
|
9
16
|
testLocalTpl3Src,
|
|
10
|
-
testLocalTpl3Name
|
|
17
|
+
testLocalTpl3Name,
|
|
18
|
+
testTrickyCasesSrc,
|
|
19
|
+
testTrickyCasesNormalized,
|
|
11
20
|
} from './test.artifacts';
|
|
12
21
|
import { parseSingleSourceLine } from './source';
|
|
22
|
+
import { FullArtifactName } from './package';
|
|
13
23
|
import { expect, describe, test } from 'vitest';
|
|
14
24
|
import { ConsoleLoggerAdapter } from '@milaboratories/ts-helpers';
|
|
15
25
|
|
|
26
|
+
const stubTplName: FullArtifactName = {
|
|
27
|
+
type: 'template',
|
|
28
|
+
pkg: 'stub-pkg',
|
|
29
|
+
id: 'stub-name',
|
|
30
|
+
version: '1.2.3',
|
|
31
|
+
};
|
|
32
|
+
|
|
16
33
|
test('test lib 1 parsing', () => {
|
|
17
34
|
const logger = createLogger('error');
|
|
18
35
|
|
|
@@ -34,6 +51,7 @@ test('test lib 2 parsing', () => {
|
|
|
34
51
|
const logger = createLogger('error');
|
|
35
52
|
|
|
36
53
|
const libSrc = parseSource(logger, 'dist', testLocalLib2Src, testLocalLib2Name, true);
|
|
54
|
+
expect(libSrc.src).toEqual(testLocalLib2SrcNormalized);
|
|
37
55
|
expect(libSrc.dependencies).toEqual([
|
|
38
56
|
{ type: 'library', pkg: 'package1', id: 'someid' },
|
|
39
57
|
{ type: 'library', pkg: '@platforma-sdk/workflow-tengo', id: 'assets' },
|
|
@@ -51,8 +69,71 @@ test('test tpl 3 parsing', () => {
|
|
|
51
69
|
expect(tplSrc.compilerOptions[0].name).toEqual('hash_override');
|
|
52
70
|
});
|
|
53
71
|
|
|
72
|
+
describe('import statements', () => {
|
|
73
|
+
test('dot multiline works', () => {
|
|
74
|
+
const logger = createLogger('error');
|
|
75
|
+
|
|
76
|
+
const multilineImport = `
|
|
77
|
+
importer := import("@platforma-sdk/workflow-tengo:assets")
|
|
78
|
+
importer.
|
|
79
|
+
importSoftware("my:software") // works well
|
|
80
|
+
`
|
|
81
|
+
|
|
82
|
+
const parsed = parseSource(logger, 'dist', multilineImport, stubTplName, true);
|
|
83
|
+
|
|
84
|
+
let softwareFound = false
|
|
85
|
+
for (const dep of parsed.dependencies) {
|
|
86
|
+
softwareFound = softwareFound || `${dep.type}:${dep.pkg}:${dep.id}` == 'software:my:software';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
expect(softwareFound).toBe(true);
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
test('bracket multiline is forbidden', () => {
|
|
93
|
+
// This is
|
|
94
|
+
const logger = createLogger('info');
|
|
95
|
+
|
|
96
|
+
const multilineImport = `
|
|
97
|
+
importer := import("@platforma-sdk/workflow-tengo:assets")
|
|
98
|
+
importer.
|
|
99
|
+
importSoftware(
|
|
100
|
+
"my:software"
|
|
101
|
+
) // does not work for now
|
|
102
|
+
`
|
|
103
|
+
|
|
104
|
+
expect(() => parseSource(logger, 'dist', multilineImport, stubTplName, true)).toThrow('in the same line with brackets');
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
test('variable import is not allowed', () => {
|
|
108
|
+
const logger = createLogger('info');
|
|
109
|
+
|
|
110
|
+
const importByVariable = `
|
|
111
|
+
importer := import("@platforma-sdk/workflow-tengo:assets")
|
|
112
|
+
softwareID := "my:software"
|
|
113
|
+
importer.importSoftware(softwareID) // breaks because of variable reference. We require literals.
|
|
114
|
+
`
|
|
115
|
+
|
|
116
|
+
expect(() => parseSource(logger, 'dist', importByVariable, stubTplName, true)).toThrow('variables are not allowed');
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
test('test tricky cases parsing', () => {
|
|
120
|
+
const logger = createLogger('error');
|
|
121
|
+
|
|
122
|
+
const trickyCasesSrc = parseSource(logger, 'dist', testTrickyCasesSrc, stubTplName, true);
|
|
123
|
+
expect(trickyCasesSrc.src).toEqual(testTrickyCasesNormalized);
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
|
|
54
127
|
describe('parseSingleSourceLine', () => {
|
|
55
|
-
|
|
128
|
+
const testCases: {
|
|
129
|
+
name: string;
|
|
130
|
+
line: string;
|
|
131
|
+
context: sourceParserContext;
|
|
132
|
+
localPackageName: string;
|
|
133
|
+
globalizeImports?: boolean;
|
|
134
|
+
expected: lineProcessingResult;
|
|
135
|
+
}[] = [
|
|
136
|
+
|
|
56
137
|
{
|
|
57
138
|
name: 'empty line',
|
|
58
139
|
line: ' ',
|
|
@@ -60,18 +141,22 @@ describe('parseSingleSourceLine', () => {
|
|
|
60
141
|
isInCommentBlock: false,
|
|
61
142
|
canDetectOptions: true,
|
|
62
143
|
lineNo: 1,
|
|
63
|
-
|
|
144
|
+
artifactImportREs: new Map(),
|
|
145
|
+
importLikeREs: new Map(),
|
|
146
|
+
multilineStatement: '',
|
|
64
147
|
},
|
|
65
148
|
localPackageName: 'test-package',
|
|
66
149
|
expected: {
|
|
67
150
|
line: ' ',
|
|
68
|
-
|
|
151
|
+
artifacts: [],
|
|
69
152
|
option: undefined,
|
|
70
153
|
context: {
|
|
71
154
|
isInCommentBlock: false,
|
|
72
155
|
canDetectOptions: true,
|
|
73
156
|
lineNo: 1,
|
|
74
|
-
|
|
157
|
+
artifactImportREs: new Map(),
|
|
158
|
+
importLikeREs: new Map(),
|
|
159
|
+
multilineStatement: '',
|
|
75
160
|
}
|
|
76
161
|
}
|
|
77
162
|
},
|
|
@@ -82,18 +167,22 @@ describe('parseSingleSourceLine', () => {
|
|
|
82
167
|
isInCommentBlock: false,
|
|
83
168
|
canDetectOptions: true,
|
|
84
169
|
lineNo: 1,
|
|
85
|
-
|
|
170
|
+
artifactImportREs: new Map(),
|
|
171
|
+
importLikeREs: new Map(),
|
|
172
|
+
multilineStatement: '',
|
|
86
173
|
},
|
|
87
174
|
localPackageName: 'test-package',
|
|
88
175
|
expected: {
|
|
89
176
|
line: '',
|
|
90
|
-
|
|
177
|
+
artifacts: [],
|
|
91
178
|
option: undefined,
|
|
92
179
|
context: {
|
|
93
180
|
isInCommentBlock: false,
|
|
94
181
|
canDetectOptions: true,
|
|
95
182
|
lineNo: 1,
|
|
96
|
-
|
|
183
|
+
artifactImportREs: new Map(),
|
|
184
|
+
importLikeREs: new Map(),
|
|
185
|
+
multilineStatement: '',
|
|
97
186
|
}
|
|
98
187
|
}
|
|
99
188
|
},
|
|
@@ -104,18 +193,22 @@ describe('parseSingleSourceLine', () => {
|
|
|
104
193
|
isInCommentBlock: false,
|
|
105
194
|
canDetectOptions: true,
|
|
106
195
|
lineNo: 1,
|
|
107
|
-
|
|
196
|
+
artifactImportREs: new Map(),
|
|
197
|
+
importLikeREs: new Map(),
|
|
198
|
+
multilineStatement: '',
|
|
108
199
|
},
|
|
109
200
|
localPackageName: 'test-package',
|
|
110
201
|
expected: {
|
|
111
202
|
line: '',
|
|
112
|
-
|
|
203
|
+
artifacts: [],
|
|
113
204
|
option: undefined,
|
|
114
205
|
context: {
|
|
115
206
|
isInCommentBlock: true,
|
|
116
207
|
canDetectOptions: true,
|
|
117
208
|
lineNo: 1,
|
|
118
|
-
|
|
209
|
+
artifactImportREs: new Map(),
|
|
210
|
+
importLikeREs: new Map(),
|
|
211
|
+
multilineStatement: '',
|
|
119
212
|
}
|
|
120
213
|
}
|
|
121
214
|
},
|
|
@@ -126,18 +219,22 @@ describe('parseSingleSourceLine', () => {
|
|
|
126
219
|
isInCommentBlock: true,
|
|
127
220
|
canDetectOptions: true,
|
|
128
221
|
lineNo: 1,
|
|
129
|
-
|
|
222
|
+
artifactImportREs: new Map(),
|
|
223
|
+
importLikeREs: new Map(),
|
|
224
|
+
multilineStatement: '',
|
|
130
225
|
},
|
|
131
226
|
localPackageName: 'test-package',
|
|
132
227
|
expected: {
|
|
133
228
|
line: '',
|
|
134
|
-
|
|
229
|
+
artifacts: [],
|
|
135
230
|
option: undefined,
|
|
136
231
|
context: {
|
|
137
232
|
isInCommentBlock: true,
|
|
138
233
|
canDetectOptions: true,
|
|
139
234
|
lineNo: 1,
|
|
140
|
-
|
|
235
|
+
artifactImportREs: new Map(),
|
|
236
|
+
importLikeREs: new Map(),
|
|
237
|
+
multilineStatement: '',
|
|
141
238
|
}
|
|
142
239
|
}
|
|
143
240
|
},
|
|
@@ -148,18 +245,48 @@ describe('parseSingleSourceLine', () => {
|
|
|
148
245
|
isInCommentBlock: true,
|
|
149
246
|
canDetectOptions: true,
|
|
150
247
|
lineNo: 1,
|
|
151
|
-
|
|
248
|
+
artifactImportREs: new Map(),
|
|
249
|
+
importLikeREs: new Map(),
|
|
250
|
+
multilineStatement: '',
|
|
152
251
|
},
|
|
153
252
|
localPackageName: 'test-package',
|
|
154
253
|
expected: {
|
|
155
254
|
line: '',
|
|
156
|
-
|
|
255
|
+
artifacts: [],
|
|
157
256
|
option: undefined,
|
|
158
257
|
context: {
|
|
159
258
|
isInCommentBlock: false,
|
|
160
259
|
canDetectOptions: true,
|
|
161
260
|
lineNo: 1,
|
|
162
|
-
|
|
261
|
+
artifactImportREs: new Map(),
|
|
262
|
+
importLikeREs: new Map(),
|
|
263
|
+
multilineStatement: '',
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: 'comment-like lines are safe',
|
|
269
|
+
line: 'cmd.saveFile("results/*")',
|
|
270
|
+
context: {
|
|
271
|
+
isInCommentBlock: false,
|
|
272
|
+
canDetectOptions: false,
|
|
273
|
+
lineNo: 100,
|
|
274
|
+
artifactImportREs: new Map(),
|
|
275
|
+
importLikeREs: new Map(),
|
|
276
|
+
multilineStatement: '',
|
|
277
|
+
},
|
|
278
|
+
localPackageName: 'test-package',
|
|
279
|
+
expected: {
|
|
280
|
+
line: 'cmd.saveFile("results/*")',
|
|
281
|
+
artifacts: [],
|
|
282
|
+
option: undefined,
|
|
283
|
+
context: {
|
|
284
|
+
isInCommentBlock: false,
|
|
285
|
+
canDetectOptions: false,
|
|
286
|
+
lineNo: 100,
|
|
287
|
+
artifactImportREs: new Map(),
|
|
288
|
+
importLikeREs: new Map(),
|
|
289
|
+
multilineStatement: '',
|
|
163
290
|
}
|
|
164
291
|
}
|
|
165
292
|
},
|
|
@@ -170,18 +297,22 @@ describe('parseSingleSourceLine', () => {
|
|
|
170
297
|
isInCommentBlock: false,
|
|
171
298
|
canDetectOptions: true,
|
|
172
299
|
lineNo: 1,
|
|
173
|
-
|
|
300
|
+
artifactImportREs: new Map(),
|
|
301
|
+
importLikeREs: new Map(),
|
|
302
|
+
multilineStatement: '',
|
|
174
303
|
},
|
|
175
304
|
localPackageName: 'test-package',
|
|
176
305
|
expected: {
|
|
177
306
|
line: '//tengo:nocheck',
|
|
178
|
-
|
|
307
|
+
artifacts: [],
|
|
179
308
|
option: { name: 'nocheck', args: [] },
|
|
180
309
|
context: {
|
|
181
310
|
isInCommentBlock: false,
|
|
182
311
|
canDetectOptions: true,
|
|
183
312
|
lineNo: 1,
|
|
184
|
-
|
|
313
|
+
artifactImportREs: new Map(),
|
|
314
|
+
importLikeREs: new Map(),
|
|
315
|
+
multilineStatement: '',
|
|
185
316
|
}
|
|
186
317
|
}
|
|
187
318
|
},
|
|
@@ -192,18 +323,22 @@ describe('parseSingleSourceLine', () => {
|
|
|
192
323
|
isInCommentBlock: false,
|
|
193
324
|
canDetectOptions: true,
|
|
194
325
|
lineNo: 1,
|
|
195
|
-
|
|
326
|
+
artifactImportREs: new Map(),
|
|
327
|
+
importLikeREs: new Map(),
|
|
328
|
+
multilineStatement: '',
|
|
196
329
|
},
|
|
197
330
|
localPackageName: 'test-package',
|
|
198
331
|
expected: {
|
|
199
332
|
line: 'const x = 5',
|
|
200
|
-
|
|
333
|
+
artifacts: [],
|
|
201
334
|
option: undefined,
|
|
202
335
|
context: {
|
|
203
336
|
isInCommentBlock: false,
|
|
204
337
|
canDetectOptions: false,
|
|
205
338
|
lineNo: 1,
|
|
206
|
-
|
|
339
|
+
artifactImportREs: new Map(),
|
|
340
|
+
importLikeREs: new Map(),
|
|
341
|
+
multilineStatement: '',
|
|
207
342
|
}
|
|
208
343
|
}
|
|
209
344
|
},
|
|
@@ -214,21 +349,24 @@ describe('parseSingleSourceLine', () => {
|
|
|
214
349
|
isInCommentBlock: false,
|
|
215
350
|
canDetectOptions: true,
|
|
216
351
|
lineNo: 1,
|
|
217
|
-
|
|
352
|
+
artifactImportREs: new Map(),
|
|
353
|
+
importLikeREs: new Map(),
|
|
354
|
+
multilineStatement: '',
|
|
218
355
|
},
|
|
219
356
|
localPackageName: 'test-package',
|
|
220
357
|
expected: {
|
|
221
358
|
line: '// tengo:nocheck',
|
|
222
|
-
|
|
359
|
+
artifacts: [],
|
|
223
360
|
option: undefined,
|
|
224
361
|
context: {
|
|
225
362
|
isInCommentBlock: false,
|
|
226
363
|
canDetectOptions: true,
|
|
227
364
|
lineNo: 1,
|
|
228
|
-
|
|
365
|
+
artifactImportREs: new Map(),
|
|
366
|
+
importLikeREs: new Map(),
|
|
367
|
+
multilineStatement: '',
|
|
229
368
|
},
|
|
230
|
-
|
|
231
|
-
}
|
|
369
|
+
},
|
|
232
370
|
},
|
|
233
371
|
{
|
|
234
372
|
name: 'regular import',
|
|
@@ -237,18 +375,22 @@ describe('parseSingleSourceLine', () => {
|
|
|
237
375
|
isInCommentBlock: false,
|
|
238
376
|
canDetectOptions: true,
|
|
239
377
|
lineNo: 1,
|
|
240
|
-
|
|
378
|
+
artifactImportREs: new Map(),
|
|
379
|
+
importLikeREs: new Map(),
|
|
380
|
+
multilineStatement: '',
|
|
241
381
|
},
|
|
242
382
|
localPackageName: 'test-package',
|
|
243
383
|
expected: {
|
|
244
384
|
line: 'fmt := import("fmt")',
|
|
245
|
-
|
|
385
|
+
artifacts: [],
|
|
246
386
|
option: undefined,
|
|
247
387
|
context: {
|
|
248
388
|
isInCommentBlock: false,
|
|
249
389
|
canDetectOptions: false,
|
|
250
390
|
lineNo: 1,
|
|
251
|
-
|
|
391
|
+
artifactImportREs: new Map(),
|
|
392
|
+
importLikeREs: new Map(),
|
|
393
|
+
multilineStatement: '',
|
|
252
394
|
}
|
|
253
395
|
}
|
|
254
396
|
},
|
|
@@ -259,18 +401,22 @@ describe('parseSingleSourceLine', () => {
|
|
|
259
401
|
isInCommentBlock: false,
|
|
260
402
|
canDetectOptions: true,
|
|
261
403
|
lineNo: 1,
|
|
262
|
-
|
|
404
|
+
artifactImportREs: new Map(),
|
|
405
|
+
importLikeREs: new Map(),
|
|
406
|
+
multilineStatement: '',
|
|
263
407
|
},
|
|
264
408
|
localPackageName: 'test-package',
|
|
265
409
|
expected: {
|
|
266
410
|
line: 'myLib := import("test-package:myLib")',
|
|
267
|
-
|
|
411
|
+
artifacts: [{ pkg: 'test-package', id: 'myLib', type: 'library' }],
|
|
268
412
|
option: undefined,
|
|
269
413
|
context: {
|
|
270
414
|
isInCommentBlock: false,
|
|
271
415
|
canDetectOptions: false,
|
|
272
416
|
lineNo: 1,
|
|
273
|
-
|
|
417
|
+
artifactImportREs: new Map(),
|
|
418
|
+
importLikeREs: new Map(),
|
|
419
|
+
multilineStatement: '',
|
|
274
420
|
}
|
|
275
421
|
}
|
|
276
422
|
},
|
|
@@ -281,19 +427,23 @@ describe('parseSingleSourceLine', () => {
|
|
|
281
427
|
isInCommentBlock: false,
|
|
282
428
|
canDetectOptions: true,
|
|
283
429
|
lineNo: 1,
|
|
284
|
-
|
|
430
|
+
artifactImportREs: new Map(),
|
|
431
|
+
importLikeREs: new Map(),
|
|
432
|
+
multilineStatement: '',
|
|
285
433
|
},
|
|
286
434
|
localPackageName: 'test-package',
|
|
287
435
|
globalizeImports: true,
|
|
288
436
|
expected: {
|
|
289
437
|
line: 'myLib := import("test-package:myLib")',
|
|
290
|
-
|
|
438
|
+
artifacts: [{ pkg: 'test-package', id: 'myLib', type: 'library' }],
|
|
291
439
|
option: undefined,
|
|
292
440
|
context: {
|
|
293
441
|
isInCommentBlock: false,
|
|
294
442
|
canDetectOptions: false,
|
|
295
443
|
lineNo: 1,
|
|
296
|
-
|
|
444
|
+
artifactImportREs: new Map(),
|
|
445
|
+
importLikeREs: new Map(),
|
|
446
|
+
multilineStatement: '',
|
|
297
447
|
}
|
|
298
448
|
}
|
|
299
449
|
},
|
|
@@ -304,23 +454,27 @@ describe('parseSingleSourceLine', () => {
|
|
|
304
454
|
isInCommentBlock: false,
|
|
305
455
|
canDetectOptions: true,
|
|
306
456
|
lineNo: 1,
|
|
307
|
-
|
|
457
|
+
artifactImportREs: new Map(),
|
|
458
|
+
importLikeREs: new Map(),
|
|
459
|
+
multilineStatement: '',
|
|
308
460
|
},
|
|
309
461
|
localPackageName: 'test-package',
|
|
310
462
|
expected: {
|
|
311
463
|
line: 'plapi := import("plapi")',
|
|
312
|
-
|
|
464
|
+
artifacts: [],
|
|
313
465
|
option: undefined,
|
|
314
466
|
context: {
|
|
315
467
|
isInCommentBlock: false,
|
|
316
468
|
canDetectOptions: false,
|
|
317
469
|
lineNo: 1,
|
|
318
|
-
|
|
470
|
+
artifactImportREs: (() => {
|
|
319
471
|
const r = new Map();
|
|
320
472
|
r.set('template', newGetTemplateIdRE('plapi'));
|
|
321
473
|
r.set('software', newGetSoftwareInfoRE('plapi'));
|
|
322
474
|
return r;
|
|
323
475
|
})(),
|
|
476
|
+
importLikeREs: new Map(),
|
|
477
|
+
multilineStatement: '',
|
|
324
478
|
}
|
|
325
479
|
}
|
|
326
480
|
},
|
|
@@ -331,31 +485,36 @@ describe('parseSingleSourceLine', () => {
|
|
|
331
485
|
isInCommentBlock: false,
|
|
332
486
|
canDetectOptions: true,
|
|
333
487
|
lineNo: 1,
|
|
334
|
-
|
|
488
|
+
artifactImportREs: new Map(),
|
|
489
|
+
importLikeREs: new Map(),
|
|
490
|
+
multilineStatement: '',
|
|
335
491
|
},
|
|
336
492
|
localPackageName: 'test-package',
|
|
337
493
|
expected: {
|
|
338
494
|
line: 'll := import("@milaboratory/tengo-sdk:ll")',
|
|
339
|
-
|
|
495
|
+
artifacts: [{
|
|
340
496
|
id: 'll',
|
|
341
497
|
pkg: '@milaboratory/tengo-sdk',
|
|
342
498
|
type: 'library',
|
|
343
|
-
},
|
|
499
|
+
}],
|
|
344
500
|
option: undefined,
|
|
345
501
|
context: {
|
|
346
502
|
isInCommentBlock: false,
|
|
347
503
|
canDetectOptions: false,
|
|
348
504
|
lineNo: 1,
|
|
349
|
-
|
|
505
|
+
artifactImportREs: (() => {
|
|
350
506
|
const r = new Map();
|
|
351
507
|
r.set('template', newGetTemplateIdRE('ll'));
|
|
352
508
|
r.set('software', newGetSoftwareInfoRE('ll'));
|
|
353
509
|
return r;
|
|
354
|
-
})()
|
|
510
|
+
})(),
|
|
511
|
+
importLikeREs: new Map(),
|
|
512
|
+
multilineStatement: '',
|
|
355
513
|
}
|
|
356
|
-
}
|
|
514
|
+
},
|
|
357
515
|
}
|
|
358
|
-
]
|
|
516
|
+
]
|
|
517
|
+
test.each(testCases)('$name', ({ line, context, localPackageName, globalizeImports, expected }) => {
|
|
359
518
|
const result = parseSingleSourceLine(
|
|
360
519
|
new ConsoleLoggerAdapter(),
|
|
361
520
|
line,
|
|
@@ -365,7 +524,7 @@ describe('parseSingleSourceLine', () => {
|
|
|
365
524
|
);
|
|
366
525
|
|
|
367
526
|
expect(result.line).toBe(expected.line);
|
|
368
|
-
expect(result.
|
|
527
|
+
expect(result.artifacts).toEqual(expected.artifacts);
|
|
369
528
|
expect(result.option).toEqual(expected.option);
|
|
370
529
|
expect(result.context).toMatchObject(context);
|
|
371
530
|
});
|