@unito/integration-cli 0.60.0 → 0.60.1

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.
@@ -111,11 +111,13 @@ class Dev extends baseCommand_1.BaseCommand {
111
111
  // Load environment variables.
112
112
  const { successful: environmentVariables, failed: failedEnvironmentVariables } = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, configuration.environmentVariables ?? {});
113
113
  for (const environmentVariable of failedEnvironmentVariables) {
114
- core_1.ux.log();
115
- core_1.ux.log(`Could not decrypt the environment variable ${chalk_1.default.yellowBright(environmentVariable)}.`);
116
- core_1.ux.log('It may be a normal behavior locally as some environment variables are sensitive secrets.');
117
- core_1.ux.log(`You can still pass ${chalk_1.default.yellowBright(`${environmentVariable}=<value>`)} to the CLI command to provide a value for this environment variable.`);
118
- core_1.ux.log(`Example: ${chalk_1.default.yellowBright(`${environmentVariable}=foo ${this.config.bin} ${this.id}`)}`);
114
+ if (!process.env[environmentVariable]) {
115
+ core_1.ux.log();
116
+ core_1.ux.log(`Could not decrypt the environment variable ${chalk_1.default.yellowBright(environmentVariable)}.`);
117
+ core_1.ux.log('It may be a normal behavior locally as some environment variables are sensitive secrets.');
118
+ core_1.ux.log(`You can still pass ${chalk_1.default.yellowBright(`${environmentVariable}=<value>`)} to the CLI command to provide a value for this environment variable.`);
119
+ core_1.ux.log(`Example: ${chalk_1.default.yellowBright(`${environmentVariable}=foo ${this.config.bin} ${this.id}`)}`);
120
+ }
119
121
  }
120
122
  // Launch the debugger.
121
123
  const commandArguments = [
@@ -129,11 +129,13 @@ class Test extends baseCommand_1.BaseCommand {
129
129
  // Load environment variables.
130
130
  const { successful: environmentVariables, failed: failedEnvironmentVariables } = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, configuration.environmentVariables ?? {});
131
131
  for (const environmentVariable of failedEnvironmentVariables) {
132
- core_1.ux.log();
133
- core_1.ux.log(`Could not decrypt the environment variable ${chalk_1.default.yellowBright(environmentVariable)}.`);
134
- core_1.ux.log('It may be a normal behavior locally as some environment variables are sensitive secrets.');
135
- core_1.ux.log(`You can still pass ${chalk_1.default.yellowBright(`${environmentVariable}=<value>`)} to the CLI command to provide a value for this environment variable.`);
136
- core_1.ux.log(`Example: ${chalk_1.default.yellowBright(`${environmentVariable}=foo ${this.config.bin} ${this.id}`)}`);
132
+ if (!process.env[environmentVariable]) {
133
+ core_1.ux.log();
134
+ core_1.ux.log(`Could not decrypt the environment variable ${chalk_1.default.yellowBright(environmentVariable)}.`);
135
+ core_1.ux.log('It may be a normal behavior locally as some environment variables are sensitive secrets.');
136
+ core_1.ux.log(`You can still pass ${chalk_1.default.yellowBright(`${environmentVariable}=<value>`)} to the CLI command to provide a value for this environment variable.`);
137
+ core_1.ux.log(`Example: ${chalk_1.default.yellowBright(`${environmentVariable}=foo ${this.config.bin} ${this.id}`)}`);
138
+ }
137
139
  }
138
140
  // Launch the tests.
139
141
  const commandArguments = [
@@ -205,4 +205,23 @@ describe('Dev', () => {
205
205
  (0, test_1.expect)(spawnStub.getCall(0).args.at(2).env.success).to.equal('a');
206
206
  (0, test_1.expect)(spawnStub.getCall(0).args.at(2).env.failure).to.be.undefined;
207
207
  });
208
+ test_1.test
209
+ .stdout()
210
+ .stub(ConfigurationResource, 'getConfiguration', stub => stub.resolves(cliConfiguration))
211
+ .stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
212
+ .stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' } }))
213
+ .stub(DecryptionResource, 'decryptEntries', stub => stub
214
+ .onFirstCall()
215
+ .resolves({ successful: {}, failed: [] })
216
+ .onSecondCall()
217
+ .resolves({ successful: {}, failed: [] })
218
+ .onThirdCall()
219
+ .resolves({ successful: { success: 'a' }, failed: ['failure'] }))
220
+ .env({ failure: 'b' })
221
+ .command(['dev'])
222
+ .it('override environment variables', ctx => {
223
+ (0, test_1.expect)(ctx.stdout).to.not.contain((0, styles_1.uncolorize)('Could not decrypt the environment variable failure.'));
224
+ (0, test_1.expect)(spawnStub.getCall(0).args.at(2).env.success).to.equal('a');
225
+ (0, test_1.expect)(spawnStub.getCall(0).args.at(2).env.failure).to.equal('b');
226
+ });
208
227
  });
@@ -233,4 +233,23 @@ describe('Test', () => {
233
233
  (0, test_1.expect)(spawnStub.getCall(0).args.at(2).env.success).to.equal('a');
234
234
  (0, test_1.expect)(spawnStub.getCall(0).args.at(2).env.failure).to.be.undefined;
235
235
  });
236
+ test_1.test
237
+ .stdout()
238
+ .stub(ConfigurationResource, 'getConfiguration', stub => stub.resolves(cliConfiguration))
239
+ .stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
240
+ .stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' } }))
241
+ .stub(DecryptionResource, 'decryptEntries', stub => stub
242
+ .onFirstCall()
243
+ .resolves({ successful: {}, failed: [] })
244
+ .onSecondCall()
245
+ .resolves({ successful: {}, failed: [] })
246
+ .onThirdCall()
247
+ .resolves({ successful: { success: 'a' }, failed: ['failure'] }))
248
+ .env({ failure: 'b' })
249
+ .command(['test'])
250
+ .it('override environment variables', ctx => {
251
+ (0, test_1.expect)(ctx.stdout).to.not.contain((0, styles_1.uncolorize)('Could not decrypt the environment variable failure.'));
252
+ (0, test_1.expect)(spawnStub.getCall(0).args.at(2).env.success).to.equal('a');
253
+ (0, test_1.expect)(spawnStub.getCall(0).args.at(2).env.failure).to.equal('b');
254
+ });
236
255
  });
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.60.0",
2
+ "version": "0.60.1",
3
3
  "commands": {
4
4
  "activity": {
5
5
  "id": "activity",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-cli",
3
- "version": "0.60.0",
3
+ "version": "0.60.1",
4
4
  "description": "Integration CLI",
5
5
  "bin": {
6
6
  "integration-cli": "./bin/run"