@platformatic/generators 2.0.0-alpha.2 → 2.0.0-alpha.3
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/eslint.config.js +3 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.test-d.ts +4 -4
- package/lib/base-generator.d.ts +25 -25
- package/lib/base-generator.js +28 -28
- package/lib/create-gitignore.js +2 -2
- package/lib/create-plugin.d.ts +4 -4
- package/lib/create-plugin.js +9 -9
- package/lib/create-stackable-cli.js +7 -7
- package/lib/create-stackable-files.js +15 -15
- package/lib/create-stackable-plugin.js +3 -3
- package/lib/create-stackable-tests.js +15 -13
- package/lib/errors.js +1 -1
- package/lib/file-generator.d.ts +14 -14
- package/lib/file-generator.js +4 -4
- package/lib/stackable-generator.js +27 -27
- package/lib/utils.d.ts +8 -9
- package/lib/utils.js +18 -23
- package/package.json +9 -8
- package/test/base-generator.test.js +232 -210
- package/test/file-generator.test.js +20 -20
- package/test/fixtures/sample-runtime/platformatic.json +2 -2
- package/test/fixtures/sample-runtime/services/no-plugin/platformatic.json +1 -1
- package/test/fixtures/sample-runtime/services/rival/platformatic.json +1 -1
- package/test/helpers.js +9 -14
- package/test/stackable-generator.test.js +9 -8
- package/test/utils.test.js +27 -27
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { readFile,
|
|
3
|
+
const { readFile, cp } = require('node:fs/promises')
|
|
4
4
|
const { test, after, afterEach, describe } = require('node:test')
|
|
5
5
|
const assert = require('node:assert')
|
|
6
6
|
const { join } = require('node:path')
|
|
@@ -8,25 +8,26 @@ const { join } = require('node:path')
|
|
|
8
8
|
const { fakeLogger, getTempDir, moveToTmpdir, mockNpmJsRequestForPkgs, mockAgent } = require('./helpers')
|
|
9
9
|
const { BaseGenerator } = require('../lib/base-generator')
|
|
10
10
|
const { convertServiceNameToPrefix } = require('../lib/utils')
|
|
11
|
+
const { safeRemove } = require('@platformatic/utils')
|
|
11
12
|
|
|
12
13
|
afterEach(async () => {
|
|
13
14
|
try {
|
|
14
|
-
await
|
|
15
|
+
await safeRemove(join(__dirname, 'tmp'))
|
|
15
16
|
} catch (err) {
|
|
16
17
|
// do nothing
|
|
17
18
|
}
|
|
18
19
|
})
|
|
19
20
|
|
|
20
|
-
test('should write file and dirs', async
|
|
21
|
+
test('should write file and dirs', async t => {
|
|
21
22
|
const dir = await getTempDir()
|
|
22
23
|
const gen = new BaseGenerator({
|
|
23
24
|
logger: fakeLogger,
|
|
24
|
-
module: '@platformatic/service'
|
|
25
|
+
module: '@platformatic/service',
|
|
25
26
|
})
|
|
26
27
|
|
|
27
28
|
gen.setConfig({
|
|
28
29
|
targetDirectory: dir,
|
|
29
|
-
serviceName: 'test-service'
|
|
30
|
+
serviceName: 'test-service',
|
|
30
31
|
})
|
|
31
32
|
|
|
32
33
|
await gen.run()
|
|
@@ -46,25 +47,25 @@ test('should write file and dirs', async (t) => {
|
|
|
46
47
|
assert.ok(gitignore.length > 0) // file is created and not empty
|
|
47
48
|
})
|
|
48
49
|
|
|
49
|
-
test('extended class should generate config', async
|
|
50
|
+
test('extended class should generate config', async t => {
|
|
50
51
|
class ServiceClass extends BaseGenerator {
|
|
51
52
|
constructor (opts) {
|
|
52
53
|
super({
|
|
53
54
|
...opts,
|
|
54
|
-
module: '@platformatic/service'
|
|
55
|
+
module: '@platformatic/service',
|
|
55
56
|
})
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
async _getConfigFileContents () {
|
|
59
60
|
// Implement when extending this class
|
|
60
61
|
return {
|
|
61
|
-
foo: 'bar'
|
|
62
|
+
foo: 'bar',
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
const svc = new ServiceClass({
|
|
67
|
-
logger: fakeLogger
|
|
68
|
+
logger: fakeLogger,
|
|
68
69
|
})
|
|
69
70
|
|
|
70
71
|
await svc.prepare()
|
|
@@ -74,13 +75,13 @@ test('extended class should generate config', async (t) => {
|
|
|
74
75
|
path: '',
|
|
75
76
|
file: 'platformatic.json',
|
|
76
77
|
contents: JSON.stringify({ foo: 'bar' }, null, 2),
|
|
77
|
-
options: {}
|
|
78
|
+
options: {},
|
|
78
79
|
})
|
|
79
80
|
})
|
|
80
81
|
|
|
81
|
-
test('setConfig', async
|
|
82
|
+
test('setConfig', async t => {
|
|
82
83
|
const bg = new BaseGenerator({
|
|
83
|
-
module: '@platformatic/service'
|
|
84
|
+
module: '@platformatic/service',
|
|
84
85
|
})
|
|
85
86
|
|
|
86
87
|
// should init the default config
|
|
@@ -100,17 +101,17 @@ test('setConfig', async (t) => {
|
|
|
100
101
|
serviceName: '',
|
|
101
102
|
envPrefix: '',
|
|
102
103
|
tests: false,
|
|
103
|
-
isUpdating: false
|
|
104
|
+
isUpdating: false,
|
|
104
105
|
})
|
|
105
106
|
|
|
106
107
|
// should not have undefined properties
|
|
107
|
-
Object.entries(bg.config).forEach(
|
|
108
|
+
Object.entries(bg.config).forEach(kv => {
|
|
108
109
|
assert.notStrictEqual(undefined, kv[1])
|
|
109
110
|
})
|
|
110
111
|
|
|
111
112
|
// partial config with defaults
|
|
112
113
|
bg.setConfig({
|
|
113
|
-
port: 3084
|
|
114
|
+
port: 3084,
|
|
114
115
|
})
|
|
115
116
|
|
|
116
117
|
assert.deepEqual(bg.config, {
|
|
@@ -127,7 +128,7 @@ test('setConfig', async (t) => {
|
|
|
127
128
|
serviceName: '',
|
|
128
129
|
envPrefix: '',
|
|
129
130
|
tests: false,
|
|
130
|
-
isUpdating: false
|
|
131
|
+
isUpdating: false,
|
|
131
132
|
})
|
|
132
133
|
|
|
133
134
|
// reset config to defaults
|
|
@@ -146,17 +147,17 @@ test('setConfig', async (t) => {
|
|
|
146
147
|
serviceName: '',
|
|
147
148
|
envPrefix: '',
|
|
148
149
|
tests: false,
|
|
149
|
-
isUpdating: false
|
|
150
|
+
isUpdating: false,
|
|
150
151
|
})
|
|
151
152
|
|
|
152
153
|
// update only some fields
|
|
153
154
|
bg.setConfig({
|
|
154
155
|
hostname: '123.123.123.123',
|
|
155
|
-
port: 3000
|
|
156
|
+
port: 3000,
|
|
156
157
|
})
|
|
157
158
|
|
|
158
159
|
bg.setConfig({
|
|
159
|
-
port: 1234
|
|
160
|
+
port: 1234,
|
|
160
161
|
})
|
|
161
162
|
|
|
162
163
|
assert.deepEqual(bg.config, {
|
|
@@ -173,19 +174,19 @@ test('setConfig', async (t) => {
|
|
|
173
174
|
serviceName: '',
|
|
174
175
|
envPrefix: '',
|
|
175
176
|
tests: false,
|
|
176
|
-
isUpdating: false
|
|
177
|
+
isUpdating: false,
|
|
177
178
|
})
|
|
178
179
|
})
|
|
179
180
|
|
|
180
|
-
test('should append env values', async
|
|
181
|
+
test('should append env values', async t => {
|
|
181
182
|
const bg = new BaseGenerator({
|
|
182
|
-
module: '@platformatic/service'
|
|
183
|
+
module: '@platformatic/service',
|
|
183
184
|
})
|
|
184
185
|
// partial config with defaults
|
|
185
186
|
bg.setConfig({
|
|
186
187
|
env: {
|
|
187
|
-
FOO: 'bar'
|
|
188
|
-
}
|
|
188
|
+
FOO: 'bar',
|
|
189
|
+
},
|
|
189
190
|
})
|
|
190
191
|
|
|
191
192
|
await bg.prepare()
|
|
@@ -196,20 +197,23 @@ test('should append env values', async (t) => {
|
|
|
196
197
|
assert.equal(dotEnvSampleFile.contents.trim(), 'FOO=')
|
|
197
198
|
})
|
|
198
199
|
|
|
199
|
-
test('should add a default env var to the .env.sample config', async
|
|
200
|
+
test('should add a default env var to the .env.sample config', async t => {
|
|
200
201
|
const bg = new BaseGenerator({
|
|
201
|
-
module: '@platformatic/service'
|
|
202
|
+
module: '@platformatic/service',
|
|
202
203
|
})
|
|
203
204
|
// partial config with defaults
|
|
204
205
|
bg.setConfig({
|
|
205
206
|
env: {
|
|
206
|
-
FOO: 'bar'
|
|
207
|
-
}
|
|
207
|
+
FOO: 'bar',
|
|
208
|
+
},
|
|
208
209
|
})
|
|
209
210
|
|
|
210
|
-
bg.addEnvVars(
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
bg.addEnvVars(
|
|
212
|
+
{
|
|
213
|
+
BAR: 'baz',
|
|
214
|
+
},
|
|
215
|
+
{ overwrite: false, default: true }
|
|
216
|
+
)
|
|
213
217
|
|
|
214
218
|
await bg.prepare()
|
|
215
219
|
const dotEnvFile = bg.getFileObject('.env')
|
|
@@ -219,105 +223,118 @@ test('should add a default env var to the .env.sample config', async (t) => {
|
|
|
219
223
|
assert.equal(dotEnvSampleFile.contents.trim(), 'BAR=baz\nFOO=')
|
|
220
224
|
})
|
|
221
225
|
|
|
222
|
-
test('should prepare the questions', async
|
|
226
|
+
test('should prepare the questions', async t => {
|
|
223
227
|
const bg = new BaseGenerator({
|
|
224
|
-
module: '@platformatic/service'
|
|
228
|
+
module: '@platformatic/service',
|
|
225
229
|
})
|
|
226
230
|
// partial config with defaults
|
|
227
231
|
bg.setConfig({
|
|
228
232
|
env: {
|
|
229
|
-
FOO: 'bar'
|
|
230
|
-
}
|
|
233
|
+
FOO: 'bar',
|
|
234
|
+
},
|
|
231
235
|
})
|
|
232
236
|
|
|
233
237
|
await bg.prepareQuestions()
|
|
234
|
-
assert.deepStrictEqual(bg.questions, [
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
238
|
+
assert.deepStrictEqual(bg.questions, [
|
|
239
|
+
{
|
|
240
|
+
type: 'input',
|
|
241
|
+
name: 'targetDirectory',
|
|
242
|
+
message: 'Where would you like to create your project?',
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
type: 'list',
|
|
246
|
+
name: 'typescript',
|
|
247
|
+
message: 'Do you want to use TypeScript?',
|
|
248
|
+
default: false,
|
|
249
|
+
choices: [
|
|
250
|
+
{ name: 'yes', value: true },
|
|
251
|
+
{ name: 'no', value: false },
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
type: 'input',
|
|
256
|
+
name: 'port',
|
|
257
|
+
message: 'What port do you want to use?',
|
|
258
|
+
},
|
|
259
|
+
])
|
|
249
260
|
})
|
|
250
261
|
|
|
251
|
-
test('should prepare the questions with a targetDirectory', async
|
|
262
|
+
test('should prepare the questions with a targetDirectory', async t => {
|
|
252
263
|
const bg = new BaseGenerator({
|
|
253
|
-
module: '@platformatic/service'
|
|
264
|
+
module: '@platformatic/service',
|
|
254
265
|
})
|
|
255
266
|
// partial config with defaults
|
|
256
267
|
bg.setConfig({
|
|
257
268
|
targetDirectory: './foo',
|
|
258
269
|
env: {
|
|
259
|
-
FOO: 'bar'
|
|
260
|
-
}
|
|
270
|
+
FOO: 'bar',
|
|
271
|
+
},
|
|
261
272
|
})
|
|
262
273
|
|
|
263
274
|
await bg.prepareQuestions()
|
|
264
|
-
assert.deepStrictEqual(bg.questions, [
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
+
assert.deepStrictEqual(bg.questions, [
|
|
276
|
+
{
|
|
277
|
+
type: 'list',
|
|
278
|
+
name: 'typescript',
|
|
279
|
+
message: 'Do you want to use TypeScript?',
|
|
280
|
+
default: false,
|
|
281
|
+
choices: [
|
|
282
|
+
{ name: 'yes', value: true },
|
|
283
|
+
{ name: 'no', value: false },
|
|
284
|
+
],
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
type: 'input',
|
|
288
|
+
name: 'port',
|
|
289
|
+
message: 'What port do you want to use?',
|
|
290
|
+
},
|
|
291
|
+
])
|
|
275
292
|
})
|
|
276
293
|
|
|
277
|
-
test('should prepare the questions in runtime context', async
|
|
294
|
+
test('should prepare the questions in runtime context', async t => {
|
|
278
295
|
const bg = new BaseGenerator({
|
|
279
|
-
module: '@platformatic/service'
|
|
296
|
+
module: '@platformatic/service',
|
|
280
297
|
})
|
|
281
298
|
// partial config with defaults
|
|
282
299
|
bg.setConfig({
|
|
283
300
|
isRuntimeContext: true,
|
|
284
301
|
env: {
|
|
285
|
-
FOO: 'bar'
|
|
286
|
-
}
|
|
302
|
+
FOO: 'bar',
|
|
303
|
+
},
|
|
287
304
|
})
|
|
288
305
|
|
|
289
306
|
await bg.prepareQuestions()
|
|
290
307
|
assert.deepStrictEqual(bg.questions, [])
|
|
291
308
|
})
|
|
292
309
|
|
|
293
|
-
test('should return service metadata', async
|
|
310
|
+
test('should return service metadata', async t => {
|
|
294
311
|
const bg = new BaseGenerator({
|
|
295
|
-
module: '@platformatic/service'
|
|
312
|
+
module: '@platformatic/service',
|
|
296
313
|
})
|
|
297
314
|
// partial config with defaults
|
|
298
315
|
bg.setConfig({
|
|
299
316
|
targetDirectory: '/foo/bar',
|
|
300
317
|
env: {
|
|
301
|
-
FOO: 'bar'
|
|
302
|
-
}
|
|
318
|
+
FOO: 'bar',
|
|
319
|
+
},
|
|
303
320
|
})
|
|
304
321
|
|
|
305
322
|
const metadata = await bg.prepare()
|
|
306
323
|
assert.deepEqual(metadata, {
|
|
307
324
|
targetDirectory: '/foo/bar',
|
|
308
325
|
env: {
|
|
309
|
-
FOO: 'bar'
|
|
310
|
-
}
|
|
326
|
+
FOO: 'bar',
|
|
327
|
+
},
|
|
311
328
|
})
|
|
312
329
|
})
|
|
313
330
|
|
|
314
|
-
test('should generate javascript plugin, routes and tests', async
|
|
331
|
+
test('should generate javascript plugin, routes and tests', async t => {
|
|
315
332
|
const bg = new BaseGenerator({
|
|
316
|
-
module: '@platformatic/service'
|
|
333
|
+
module: '@platformatic/service',
|
|
317
334
|
})
|
|
318
335
|
bg.setConfig({
|
|
319
336
|
plugin: true,
|
|
320
|
-
tests: true
|
|
337
|
+
tests: true,
|
|
321
338
|
})
|
|
322
339
|
await bg.prepare()
|
|
323
340
|
assert.ok(bg.getFileObject('example.js', 'plugins'))
|
|
@@ -327,14 +344,14 @@ test('should generate javascript plugin, routes and tests', async (t) => {
|
|
|
327
344
|
assert.ok(bg.getFileObject('example.test.js', join('test', 'plugins')))
|
|
328
345
|
})
|
|
329
346
|
|
|
330
|
-
test('should generate tsConfig file and typescript files', async
|
|
347
|
+
test('should generate tsConfig file and typescript files', async t => {
|
|
331
348
|
const bg = new BaseGenerator({
|
|
332
|
-
module: '@platformatic/service'
|
|
349
|
+
module: '@platformatic/service',
|
|
333
350
|
})
|
|
334
351
|
bg.setConfig({
|
|
335
352
|
typescript: true,
|
|
336
353
|
plugin: true,
|
|
337
|
-
tests: true
|
|
354
|
+
tests: true,
|
|
338
355
|
})
|
|
339
356
|
const template = {
|
|
340
357
|
compilerOptions: {
|
|
@@ -346,15 +363,15 @@ test('should generate tsConfig file and typescript files', async (t) => {
|
|
|
346
363
|
noEmitOnError: true,
|
|
347
364
|
incremental: true,
|
|
348
365
|
strict: true,
|
|
349
|
-
outDir: 'dist'
|
|
366
|
+
outDir: 'dist',
|
|
350
367
|
},
|
|
351
368
|
watchOptions: {
|
|
352
369
|
watchFile: 'fixedPollingInterval',
|
|
353
370
|
watchDirectory: 'fixedPollingInterval',
|
|
354
371
|
fallbackPolling: 'dynamicPriority',
|
|
355
372
|
synchronousWatchDirectory: true,
|
|
356
|
-
excludeDirectories: ['**/node_modules', 'dist']
|
|
357
|
-
}
|
|
373
|
+
excludeDirectories: ['**/node_modules', 'dist'],
|
|
374
|
+
},
|
|
358
375
|
}
|
|
359
376
|
await bg.prepare()
|
|
360
377
|
const tsConfigFile = bg.getFileObject('tsconfig.json')
|
|
@@ -367,9 +384,9 @@ test('should generate tsConfig file and typescript files', async (t) => {
|
|
|
367
384
|
assert.ok(bg.getFileObject('example.test.ts', join('test', 'plugins')))
|
|
368
385
|
})
|
|
369
386
|
|
|
370
|
-
test('should throw if prepare fails', async
|
|
387
|
+
test('should throw if prepare fails', async t => {
|
|
371
388
|
const bg = new BaseGenerator({
|
|
372
|
-
module: '@platformatic/service'
|
|
389
|
+
module: '@platformatic/service',
|
|
373
390
|
})
|
|
374
391
|
|
|
375
392
|
bg._beforePrepare = async () => {
|
|
@@ -386,20 +403,20 @@ test('should throw if prepare fails', async (t) => {
|
|
|
386
403
|
|
|
387
404
|
test('should throw if there is a missing env variable', async () => {
|
|
388
405
|
const bg = new BaseGenerator({
|
|
389
|
-
module: '@platformatic/service'
|
|
406
|
+
module: '@platformatic/service',
|
|
390
407
|
})
|
|
391
408
|
|
|
392
409
|
bg._getConfigFileContents = async () => {
|
|
393
410
|
return {
|
|
394
411
|
FOO: '{FOO}',
|
|
395
|
-
BAR: '{BAR}'
|
|
412
|
+
BAR: '{BAR}',
|
|
396
413
|
}
|
|
397
414
|
}
|
|
398
415
|
|
|
399
416
|
bg.setConfig({
|
|
400
417
|
env: {
|
|
401
|
-
FOO: 'foobar'
|
|
402
|
-
}
|
|
418
|
+
FOO: 'foobar',
|
|
419
|
+
},
|
|
403
420
|
})
|
|
404
421
|
|
|
405
422
|
try {
|
|
@@ -407,13 +424,16 @@ test('should throw if there is a missing env variable', async () => {
|
|
|
407
424
|
assert.fail()
|
|
408
425
|
} catch (err) {
|
|
409
426
|
assert.equal(err.code, 'PLT_GEN_MISSING_ENV_VAR')
|
|
410
|
-
assert.equal(
|
|
427
|
+
assert.equal(
|
|
428
|
+
err.message,
|
|
429
|
+
'Env variable BAR is defined in config file platformatic.json, but not in config.env object.'
|
|
430
|
+
)
|
|
411
431
|
}
|
|
412
432
|
})
|
|
413
433
|
|
|
414
434
|
test('should add package', async () => {
|
|
415
435
|
const bg = new BaseGenerator({
|
|
416
|
-
module: '@platformatic/service'
|
|
436
|
+
module: '@platformatic/service',
|
|
417
437
|
})
|
|
418
438
|
|
|
419
439
|
const packageDefinition = {
|
|
@@ -422,9 +442,9 @@ test('should add package', async () => {
|
|
|
422
442
|
{
|
|
423
443
|
path: 'foobar',
|
|
424
444
|
type: 'string',
|
|
425
|
-
value: 'foobar'
|
|
426
|
-
}
|
|
427
|
-
]
|
|
445
|
+
value: 'foobar',
|
|
446
|
+
},
|
|
447
|
+
],
|
|
428
448
|
}
|
|
429
449
|
await bg.addPackage(packageDefinition)
|
|
430
450
|
|
|
@@ -432,10 +452,10 @@ test('should add package', async () => {
|
|
|
432
452
|
assert.deepEqual(bg.packages[0], packageDefinition)
|
|
433
453
|
})
|
|
434
454
|
|
|
435
|
-
test('support packages', async
|
|
455
|
+
test('support packages', async t => {
|
|
436
456
|
{
|
|
437
457
|
const svc = new BaseGenerator({
|
|
438
|
-
module: '@platformatic/service'
|
|
458
|
+
module: '@platformatic/service',
|
|
439
459
|
})
|
|
440
460
|
const packageDefinitions = [
|
|
441
461
|
{
|
|
@@ -444,20 +464,20 @@ test('support packages', async (t) => {
|
|
|
444
464
|
{
|
|
445
465
|
path: 'threshold',
|
|
446
466
|
value: '1',
|
|
447
|
-
type: 'number'
|
|
467
|
+
type: 'number',
|
|
448
468
|
},
|
|
449
469
|
{
|
|
450
470
|
path: 'foobar',
|
|
451
471
|
value: '123',
|
|
452
472
|
type: 'number',
|
|
453
|
-
name: 'FST_PLUGIN_STATIC_FOOBAR'
|
|
454
|
-
}
|
|
455
|
-
]
|
|
456
|
-
}
|
|
473
|
+
name: 'FST_PLUGIN_STATIC_FOOBAR',
|
|
474
|
+
},
|
|
475
|
+
],
|
|
476
|
+
},
|
|
457
477
|
]
|
|
458
478
|
svc.setConfig({
|
|
459
479
|
isRuntimeContext: true,
|
|
460
|
-
serviceName: 'my-service'
|
|
480
|
+
serviceName: 'my-service',
|
|
461
481
|
})
|
|
462
482
|
await svc.addPackage(packageDefinitions[0])
|
|
463
483
|
await svc.prepare()
|
|
@@ -471,10 +491,10 @@ test('support packages', async (t) => {
|
|
|
471
491
|
name: '@fastify/compress',
|
|
472
492
|
options: {
|
|
473
493
|
threshold: 1,
|
|
474
|
-
foobar: '{PLT_MY_SERVICE_FST_PLUGIN_STATIC_FOOBAR}'
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
]
|
|
494
|
+
foobar: '{PLT_MY_SERVICE_FST_PLUGIN_STATIC_FOOBAR}',
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
],
|
|
478
498
|
})
|
|
479
499
|
|
|
480
500
|
assert.equal(svc.config.env.PLT_MY_SERVICE_FST_PLUGIN_STATIC_FOOBAR, 123)
|
|
@@ -487,10 +507,10 @@ test('support packages', async (t) => {
|
|
|
487
507
|
{
|
|
488
508
|
// with standard platformatic plugin
|
|
489
509
|
const svc = new BaseGenerator({
|
|
490
|
-
module: '@platformatic/service'
|
|
510
|
+
module: '@platformatic/service',
|
|
491
511
|
})
|
|
492
512
|
svc.setConfig({
|
|
493
|
-
plugin: true
|
|
513
|
+
plugin: true,
|
|
494
514
|
})
|
|
495
515
|
const packageDefinitions = [
|
|
496
516
|
{
|
|
@@ -499,10 +519,10 @@ test('support packages', async (t) => {
|
|
|
499
519
|
{
|
|
500
520
|
path: 'threshold',
|
|
501
521
|
value: '1',
|
|
502
|
-
type: 'number'
|
|
503
|
-
}
|
|
504
|
-
]
|
|
505
|
-
}
|
|
522
|
+
type: 'number',
|
|
523
|
+
},
|
|
524
|
+
],
|
|
525
|
+
},
|
|
506
526
|
]
|
|
507
527
|
await svc.addPackage(packageDefinitions[0])
|
|
508
528
|
await svc.prepare()
|
|
@@ -515,21 +535,21 @@ test('support packages', async (t) => {
|
|
|
515
535
|
{
|
|
516
536
|
name: '@fastify/compress',
|
|
517
537
|
options: {
|
|
518
|
-
threshold: 1
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
]
|
|
538
|
+
threshold: 1,
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
],
|
|
522
542
|
})
|
|
523
543
|
}
|
|
524
544
|
|
|
525
545
|
{
|
|
526
546
|
// with relative path type but no name
|
|
527
547
|
const svc = new BaseGenerator({
|
|
528
|
-
module: '@platformatic/service'
|
|
548
|
+
module: '@platformatic/service',
|
|
529
549
|
})
|
|
530
550
|
svc.setConfig({
|
|
531
551
|
isRuntimeContext: true,
|
|
532
|
-
plugin: true
|
|
552
|
+
plugin: true,
|
|
533
553
|
})
|
|
534
554
|
const packageDefinitions = [
|
|
535
555
|
{
|
|
@@ -538,10 +558,10 @@ test('support packages', async (t) => {
|
|
|
538
558
|
{
|
|
539
559
|
path: 'root',
|
|
540
560
|
value: 'public',
|
|
541
|
-
type: 'path'
|
|
542
|
-
}
|
|
543
|
-
]
|
|
544
|
-
}
|
|
561
|
+
type: 'path',
|
|
562
|
+
},
|
|
563
|
+
],
|
|
564
|
+
},
|
|
545
565
|
]
|
|
546
566
|
await svc.addPackage(packageDefinitions[0])
|
|
547
567
|
await svc.prepare()
|
|
@@ -554,22 +574,22 @@ test('support packages', async (t) => {
|
|
|
554
574
|
{
|
|
555
575
|
name: '@fastify/static',
|
|
556
576
|
options: {
|
|
557
|
-
root: join('{PLT_ROOT}', 'public')
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
]
|
|
577
|
+
root: join('{PLT_ROOT}', 'public'),
|
|
578
|
+
},
|
|
579
|
+
},
|
|
580
|
+
],
|
|
561
581
|
})
|
|
562
582
|
}
|
|
563
583
|
|
|
564
584
|
{
|
|
565
585
|
// with relative path type and name
|
|
566
586
|
const svc = new BaseGenerator({
|
|
567
|
-
module: '@platformatic/service'
|
|
587
|
+
module: '@platformatic/service',
|
|
568
588
|
})
|
|
569
589
|
svc.setConfig({
|
|
570
590
|
isRuntimeContext: true,
|
|
571
591
|
plugin: true,
|
|
572
|
-
serviceName: 'my-service'
|
|
592
|
+
serviceName: 'my-service',
|
|
573
593
|
})
|
|
574
594
|
const packageDefinitions = [
|
|
575
595
|
{
|
|
@@ -579,10 +599,10 @@ test('support packages', async (t) => {
|
|
|
579
599
|
path: 'root',
|
|
580
600
|
value: 'public',
|
|
581
601
|
type: 'path',
|
|
582
|
-
name: 'FST_PLUGIN_STATIC_ROOT'
|
|
583
|
-
}
|
|
584
|
-
]
|
|
585
|
-
}
|
|
602
|
+
name: 'FST_PLUGIN_STATIC_ROOT',
|
|
603
|
+
},
|
|
604
|
+
],
|
|
605
|
+
},
|
|
586
606
|
]
|
|
587
607
|
await svc.addPackage(packageDefinitions[0])
|
|
588
608
|
await svc.prepare()
|
|
@@ -595,10 +615,10 @@ test('support packages', async (t) => {
|
|
|
595
615
|
{
|
|
596
616
|
name: '@fastify/static',
|
|
597
617
|
options: {
|
|
598
|
-
root: join('{PLT_ROOT}', '{PLT_MY_SERVICE_FST_PLUGIN_STATIC_ROOT}')
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
]
|
|
618
|
+
root: join('{PLT_ROOT}', '{PLT_MY_SERVICE_FST_PLUGIN_STATIC_ROOT}'),
|
|
619
|
+
},
|
|
620
|
+
},
|
|
621
|
+
],
|
|
602
622
|
})
|
|
603
623
|
}
|
|
604
624
|
|
|
@@ -618,17 +638,17 @@ test('support packages', async (t) => {
|
|
|
618
638
|
// })
|
|
619
639
|
|
|
620
640
|
const svc = new BaseGenerator({
|
|
621
|
-
module: '@platformatic/service'
|
|
641
|
+
module: '@platformatic/service',
|
|
622
642
|
})
|
|
623
643
|
const packageDefinitions = [
|
|
624
644
|
{
|
|
625
645
|
name: 'foobar',
|
|
626
|
-
options: []
|
|
627
|
-
}
|
|
646
|
+
options: [],
|
|
647
|
+
},
|
|
628
648
|
]
|
|
629
649
|
svc.setConfig({
|
|
630
650
|
isRuntimeContext: true,
|
|
631
|
-
serviceName: 'my-service'
|
|
651
|
+
serviceName: 'my-service',
|
|
632
652
|
})
|
|
633
653
|
await svc.addPackage(packageDefinitions[0])
|
|
634
654
|
await svc.prepare()
|
|
@@ -644,24 +664,24 @@ test('support packages', async (t) => {
|
|
|
644
664
|
.get('https://registry.npmjs.org')
|
|
645
665
|
.intercept({
|
|
646
666
|
method: 'GET',
|
|
647
|
-
path: '/foobar'
|
|
667
|
+
path: '/foobar',
|
|
648
668
|
})
|
|
649
669
|
.reply(500, {
|
|
650
|
-
message: 'Internal Server Error'
|
|
670
|
+
message: 'Internal Server Error',
|
|
651
671
|
})
|
|
652
672
|
|
|
653
673
|
const svc = new BaseGenerator({
|
|
654
|
-
module: '@platformatic/service'
|
|
674
|
+
module: '@platformatic/service',
|
|
655
675
|
})
|
|
656
676
|
const packageDefinitions = [
|
|
657
677
|
{
|
|
658
678
|
name: 'foobar',
|
|
659
|
-
options: []
|
|
660
|
-
}
|
|
679
|
+
options: [],
|
|
680
|
+
},
|
|
661
681
|
]
|
|
662
682
|
svc.setConfig({
|
|
663
683
|
isRuntimeContext: true,
|
|
664
|
-
serviceName: 'my-service'
|
|
684
|
+
serviceName: 'my-service',
|
|
665
685
|
})
|
|
666
686
|
await svc.addPackage(packageDefinitions[0])
|
|
667
687
|
await svc.prepare()
|
|
@@ -677,27 +697,28 @@ test('support packages', async (t) => {
|
|
|
677
697
|
.get('https://registry.npmjs.org')
|
|
678
698
|
.intercept({
|
|
679
699
|
method: 'GET',
|
|
680
|
-
path: '/foobarxxx'
|
|
700
|
+
path: '/foobarxxx',
|
|
681
701
|
})
|
|
682
702
|
.reply(200, {
|
|
683
703
|
'dist-tags': {
|
|
684
|
-
latest: '1.42.0'
|
|
685
|
-
}
|
|
686
|
-
})
|
|
704
|
+
latest: '1.42.0',
|
|
705
|
+
},
|
|
706
|
+
})
|
|
707
|
+
.delay(3000)
|
|
687
708
|
|
|
688
709
|
const svc = new BaseGenerator({
|
|
689
|
-
module: '@platformatic/service'
|
|
710
|
+
module: '@platformatic/service',
|
|
690
711
|
})
|
|
691
712
|
const packageName = 'foobarxxx'
|
|
692
713
|
const packageDefinitions = [
|
|
693
714
|
{
|
|
694
715
|
name: packageName,
|
|
695
|
-
options: []
|
|
696
|
-
}
|
|
716
|
+
options: [],
|
|
717
|
+
},
|
|
697
718
|
]
|
|
698
719
|
svc.setConfig({
|
|
699
720
|
isRuntimeContext: true,
|
|
700
|
-
serviceName: 'my-service'
|
|
721
|
+
serviceName: 'my-service',
|
|
701
722
|
})
|
|
702
723
|
await svc.addPackage(packageDefinitions[0])
|
|
703
724
|
await svc.prepare()
|
|
@@ -713,24 +734,24 @@ test('support packages', async (t) => {
|
|
|
713
734
|
.get('https://registry.npmjs.org')
|
|
714
735
|
.intercept({
|
|
715
736
|
method: 'GET',
|
|
716
|
-
path: '/foobar'
|
|
737
|
+
path: '/foobar',
|
|
717
738
|
})
|
|
718
739
|
.reply(500, {
|
|
719
|
-
message: 'Internal Server Error'
|
|
740
|
+
message: 'Internal Server Error',
|
|
720
741
|
})
|
|
721
742
|
|
|
722
743
|
const svc = new BaseGenerator({
|
|
723
|
-
module: '@platformatic/service'
|
|
744
|
+
module: '@platformatic/service',
|
|
724
745
|
})
|
|
725
746
|
const packageDefinitions = [
|
|
726
747
|
{
|
|
727
748
|
name: 'foobar',
|
|
728
|
-
options: []
|
|
729
|
-
}
|
|
749
|
+
options: [],
|
|
750
|
+
},
|
|
730
751
|
]
|
|
731
752
|
svc.setConfig({
|
|
732
753
|
isRuntimeContext: true,
|
|
733
|
-
serviceName: 'my-service'
|
|
754
|
+
serviceName: 'my-service',
|
|
734
755
|
})
|
|
735
756
|
await svc.addPackage(packageDefinitions[0])
|
|
736
757
|
await svc.prepare()
|
|
@@ -740,10 +761,10 @@ test('support packages', async (t) => {
|
|
|
740
761
|
assert.equal(packageJson.dependencies.foobar, 'latest')
|
|
741
762
|
}
|
|
742
763
|
})
|
|
743
|
-
test('should load data from directory', async
|
|
764
|
+
test('should load data from directory', async t => {
|
|
744
765
|
const runtimeDirectory = join(__dirname, 'fixtures', 'sample-runtime')
|
|
745
766
|
const bg = new BaseGenerator({
|
|
746
|
-
module: '@platformatic/service'
|
|
767
|
+
module: '@platformatic/service',
|
|
747
768
|
})
|
|
748
769
|
const data = await bg.loadFromDir('rival', runtimeDirectory)
|
|
749
770
|
const expected = {
|
|
@@ -758,39 +779,40 @@ test('should load data from directory', async (t) => {
|
|
|
758
779
|
path: 'name',
|
|
759
780
|
type: 'string',
|
|
760
781
|
value: 'googleOAuth2',
|
|
761
|
-
name: 'FST_PLUGIN_OAUTH2_NAME'
|
|
782
|
+
name: 'FST_PLUGIN_OAUTH2_NAME',
|
|
762
783
|
},
|
|
763
784
|
{
|
|
764
785
|
path: 'credentials.client.id',
|
|
765
786
|
type: 'string',
|
|
766
787
|
value: 'sample_client_id',
|
|
767
|
-
name: 'FST_PLUGIN_OAUTH2_CREDENTIALS_CLIENT_ID'
|
|
788
|
+
name: 'FST_PLUGIN_OAUTH2_CREDENTIALS_CLIENT_ID',
|
|
768
789
|
},
|
|
769
790
|
{
|
|
770
791
|
path: 'credentials.client.secret',
|
|
771
792
|
type: 'string',
|
|
772
793
|
value: 'sample_client_secret',
|
|
773
|
-
name: 'FST_PLUGIN_OAUTH2_CREDENTIALS_CLIENT_SECRET'
|
|
794
|
+
name: 'FST_PLUGIN_OAUTH2_CREDENTIALS_CLIENT_SECRET',
|
|
774
795
|
},
|
|
775
796
|
{
|
|
776
797
|
path: 'startRedirectPath',
|
|
777
798
|
type: 'string',
|
|
778
799
|
value: '/login/google',
|
|
779
|
-
name: 'FST_PLUGIN_OAUTH2_REDIRECT_PATH'
|
|
800
|
+
name: 'FST_PLUGIN_OAUTH2_REDIRECT_PATH',
|
|
780
801
|
},
|
|
781
802
|
{
|
|
782
803
|
path: 'callbackUri',
|
|
783
804
|
type: 'string',
|
|
784
805
|
value: 'http://localhost:3000/login/google/callback',
|
|
785
|
-
name: 'FST_PLUGIN_OAUTH2_CALLBACK_URI'
|
|
786
|
-
}
|
|
787
|
-
]
|
|
788
|
-
}
|
|
806
|
+
name: 'FST_PLUGIN_OAUTH2_CALLBACK_URI',
|
|
807
|
+
},
|
|
808
|
+
],
|
|
809
|
+
},
|
|
810
|
+
],
|
|
789
811
|
}
|
|
790
812
|
assert.deepEqual(data, expected)
|
|
791
813
|
})
|
|
792
814
|
|
|
793
|
-
test('on update should just touch the packages configuration', async
|
|
815
|
+
test('on update should just touch the packages configuration', async t => {
|
|
794
816
|
mockNpmJsRequestForPkgs(['@fastify/foo-plugin'])
|
|
795
817
|
const runtimeDirectory = join(__dirname, 'fixtures', 'sample-runtime', 'services', 'rival')
|
|
796
818
|
const dir = await moveToTmpdir(after)
|
|
@@ -798,10 +820,10 @@ test('on update should just touch the packages configuration', async (t) => {
|
|
|
798
820
|
|
|
799
821
|
const bg = new BaseGenerator({
|
|
800
822
|
module: '@platformatic/service',
|
|
801
|
-
targetDirectory: dir
|
|
823
|
+
targetDirectory: dir,
|
|
802
824
|
})
|
|
803
825
|
bg.setConfig({
|
|
804
|
-
isUpdating: true
|
|
826
|
+
isUpdating: true,
|
|
805
827
|
})
|
|
806
828
|
await bg.addPackage({
|
|
807
829
|
name: '@fastify/foo-plugin',
|
|
@@ -810,9 +832,9 @@ test('on update should just touch the packages configuration', async (t) => {
|
|
|
810
832
|
path: 'name',
|
|
811
833
|
type: 'string',
|
|
812
834
|
value: 'foobar',
|
|
813
|
-
name: 'FST_PLUGIN_FOO_FOOBAR'
|
|
814
|
-
}
|
|
815
|
-
]
|
|
835
|
+
name: 'FST_PLUGIN_FOO_FOOBAR',
|
|
836
|
+
},
|
|
837
|
+
],
|
|
816
838
|
})
|
|
817
839
|
await bg.prepare()
|
|
818
840
|
|
|
@@ -825,16 +847,16 @@ test('on update should just touch the packages configuration', async (t) => {
|
|
|
825
847
|
{
|
|
826
848
|
name: '@fastify/foo-plugin',
|
|
827
849
|
options: {
|
|
828
|
-
name: '{FST_PLUGIN_FOO_FOOBAR}'
|
|
829
|
-
}
|
|
830
|
-
}
|
|
850
|
+
name: '{FST_PLUGIN_FOO_FOOBAR}',
|
|
851
|
+
},
|
|
852
|
+
},
|
|
831
853
|
])
|
|
832
854
|
assert.deepEqual(bg.config.dependencies, {
|
|
833
|
-
'@fastify/foo-plugin': '1.42.0'
|
|
855
|
+
'@fastify/foo-plugin': '1.42.0',
|
|
834
856
|
})
|
|
835
857
|
})
|
|
836
858
|
|
|
837
|
-
test('on update should just touch the packages configuration', async
|
|
859
|
+
test('on update should just touch the packages configuration', async t => {
|
|
838
860
|
mockNpmJsRequestForPkgs(['@fastify/foo-plugin'])
|
|
839
861
|
const runtimeDirectory = join(__dirname, 'fixtures', 'sample-runtime', 'services', 'no-plugin')
|
|
840
862
|
const dir = await moveToTmpdir(after)
|
|
@@ -842,10 +864,10 @@ test('on update should just touch the packages configuration', async (t) => {
|
|
|
842
864
|
|
|
843
865
|
const bg = new BaseGenerator({
|
|
844
866
|
module: '@platformatic/service',
|
|
845
|
-
targetDirectory: dir
|
|
867
|
+
targetDirectory: dir,
|
|
846
868
|
})
|
|
847
869
|
bg.setConfig({
|
|
848
|
-
isUpdating: true
|
|
870
|
+
isUpdating: true,
|
|
849
871
|
})
|
|
850
872
|
await bg.addPackage({
|
|
851
873
|
name: '@fastify/foo-plugin',
|
|
@@ -854,9 +876,9 @@ test('on update should just touch the packages configuration', async (t) => {
|
|
|
854
876
|
path: 'name',
|
|
855
877
|
type: 'string',
|
|
856
878
|
value: 'foobar',
|
|
857
|
-
name: 'FST_PLUGIN_FOO_FOOBAR'
|
|
858
|
-
}
|
|
859
|
-
]
|
|
879
|
+
name: 'FST_PLUGIN_FOO_FOOBAR',
|
|
880
|
+
},
|
|
881
|
+
],
|
|
860
882
|
})
|
|
861
883
|
await bg.prepare()
|
|
862
884
|
|
|
@@ -867,19 +889,19 @@ test('on update should just touch the packages configuration', async (t) => {
|
|
|
867
889
|
const configFileContents = JSON.parse(bg.files[0].contents)
|
|
868
890
|
assert.equal(configFileContents.plugins, undefined)
|
|
869
891
|
assert.deepEqual(bg.config.dependencies, {
|
|
870
|
-
'@fastify/foo-plugin': '1.42.0'
|
|
892
|
+
'@fastify/foo-plugin': '1.42.0',
|
|
871
893
|
})
|
|
872
894
|
})
|
|
873
895
|
|
|
874
896
|
describe('runtime context', () => {
|
|
875
|
-
test('should set config.envPrefix correctly', async
|
|
897
|
+
test('should set config.envPrefix correctly', async t => {
|
|
876
898
|
const bg = new BaseGenerator({
|
|
877
|
-
module: '@platformatic/service'
|
|
899
|
+
module: '@platformatic/service',
|
|
878
900
|
})
|
|
879
901
|
|
|
880
902
|
bg.setConfig({
|
|
881
903
|
isRuntimeContext: true,
|
|
882
|
-
serviceName: 'sample-service'
|
|
904
|
+
serviceName: 'sample-service',
|
|
883
905
|
})
|
|
884
906
|
|
|
885
907
|
assert.equal(bg.config.envPrefix, 'SAMPLE_SERVICE')
|
|
@@ -890,20 +912,20 @@ describe('runtime context', () => {
|
|
|
890
912
|
envPrefix: 'ANOTHER_PREFIX',
|
|
891
913
|
env: {
|
|
892
914
|
FOO: 'bar',
|
|
893
|
-
BAZ: 'baz'
|
|
894
|
-
}
|
|
915
|
+
BAZ: 'baz',
|
|
916
|
+
},
|
|
895
917
|
})
|
|
896
918
|
|
|
897
919
|
assert.equal(bg.config.envPrefix, 'ANOTHER_PREFIX')
|
|
898
920
|
assert.deepEqual(bg.config.env, {
|
|
899
921
|
PLT_ANOTHER_PREFIX_FOO: 'bar',
|
|
900
|
-
PLT_ANOTHER_PREFIX_BAZ: 'baz'
|
|
922
|
+
PLT_ANOTHER_PREFIX_BAZ: 'baz',
|
|
901
923
|
})
|
|
902
924
|
})
|
|
903
925
|
|
|
904
|
-
test('should generate correct env file from config.env', async
|
|
926
|
+
test('should generate correct env file from config.env', async t => {
|
|
905
927
|
const bg = new BaseGenerator({
|
|
906
|
-
module: '@platformatic/service'
|
|
928
|
+
module: '@platformatic/service',
|
|
907
929
|
})
|
|
908
930
|
|
|
909
931
|
bg.setConfig({
|
|
@@ -912,21 +934,21 @@ describe('runtime context', () => {
|
|
|
912
934
|
envPrefix: 'ANOTHER_PREFIX',
|
|
913
935
|
env: {
|
|
914
936
|
FOO: 'bar',
|
|
915
|
-
BAZ: 'baz'
|
|
916
|
-
}
|
|
937
|
+
BAZ: 'baz',
|
|
938
|
+
},
|
|
917
939
|
})
|
|
918
940
|
|
|
919
941
|
const meta = await bg.prepare()
|
|
920
942
|
|
|
921
943
|
assert.deepEqual(meta.env, {
|
|
922
944
|
PLT_ANOTHER_PREFIX_FOO: 'bar',
|
|
923
|
-
PLT_ANOTHER_PREFIX_BAZ: 'baz'
|
|
945
|
+
PLT_ANOTHER_PREFIX_BAZ: 'baz',
|
|
924
946
|
})
|
|
925
947
|
})
|
|
926
948
|
|
|
927
|
-
test('should return service metadata', async
|
|
949
|
+
test('should return service metadata', async t => {
|
|
928
950
|
const bg = new BaseGenerator({
|
|
929
|
-
module: '@platformatic/service'
|
|
951
|
+
module: '@platformatic/service',
|
|
930
952
|
})
|
|
931
953
|
// partial config with defaults
|
|
932
954
|
bg.setConfig({
|
|
@@ -934,29 +956,29 @@ describe('runtime context', () => {
|
|
|
934
956
|
isRuntimeContext: true,
|
|
935
957
|
serviceName: 'my-service',
|
|
936
958
|
env: {
|
|
937
|
-
FOO: 'bar'
|
|
938
|
-
}
|
|
959
|
+
FOO: 'bar',
|
|
960
|
+
},
|
|
939
961
|
})
|
|
940
962
|
|
|
941
963
|
const metadata = await bg.prepare()
|
|
942
964
|
assert.deepEqual(metadata, {
|
|
943
965
|
targetDirectory: '/foo/bar',
|
|
944
966
|
env: {
|
|
945
|
-
PLT_MY_SERVICE_FOO: 'bar'
|
|
946
|
-
}
|
|
967
|
+
PLT_MY_SERVICE_FOO: 'bar',
|
|
968
|
+
},
|
|
947
969
|
})
|
|
948
970
|
})
|
|
949
971
|
|
|
950
972
|
test('should generate service name if not provided', async () => {
|
|
951
973
|
const bg = new BaseGenerator({
|
|
952
|
-
module: '@platformatic/service'
|
|
974
|
+
module: '@platformatic/service',
|
|
953
975
|
})
|
|
954
976
|
bg.setConfig({
|
|
955
977
|
targetDirectory: '/foo/bar',
|
|
956
978
|
isRuntimeContext: true,
|
|
957
979
|
env: {
|
|
958
|
-
FOO: 'bar'
|
|
959
|
-
}
|
|
980
|
+
FOO: 'bar',
|
|
981
|
+
},
|
|
960
982
|
})
|
|
961
983
|
|
|
962
984
|
const metadata = await bg.prepare()
|
|
@@ -966,8 +988,8 @@ describe('runtime context', () => {
|
|
|
966
988
|
assert.deepEqual(metadata, {
|
|
967
989
|
targetDirectory: '/foo/bar',
|
|
968
990
|
env: {
|
|
969
|
-
[`PLT_${envPrefix}_FOO`]: 'bar'
|
|
970
|
-
}
|
|
991
|
+
[`PLT_${envPrefix}_FOO`]: 'bar',
|
|
992
|
+
},
|
|
971
993
|
})
|
|
972
994
|
})
|
|
973
995
|
})
|