Skip to content

Commit

Permalink
test: run nuts on branches, partial nuts on windows (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc authored Sep 24, 2021
1 parent 5463ea2 commit 6044439
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ workflows:
sfdx_version: latest
requires:
- release-management/test-package
- release-management/test-nut:
name: nuts-on-windows
sfdx_version: latest
os: windows
requires:
- release-management/test-package
- release-management/release-package:
sign: true
github-release: true
Expand Down
43 changes: 25 additions & 18 deletions test/nuts/plugin-install.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import * as path from 'path';
import * as os from 'os';
import { expect } from 'chai';
import { TestSession, execCmd } from '@salesforce/cli-plugins-testkit';
import { fs } from '@salesforce/core';
Expand Down Expand Up @@ -33,27 +34,33 @@ describe('plugins:install commands', () => {
});

it('plugins:install prompts on unsigned plugin (denies)', () => {
process.env.TESTKIT_EXECUTABLE_PATH = 'sfdx';
const result = execCmd(`plugins:install ${UNSIGNED_MODULE_NAME}`, {
ensureExitCode: 2, // code 2 is the output code for the NO answer
answers: ['N'],
});
expect(result.shellOutput.stderr).to.contain(
'This plugin is not digitally signed and its authenticity cannot be verified. Continue installation y/n?:'
);
expect(result.shellOutput.stderr).to.contain('The user canceled the plugin installation');
// windows does not support answering the prompt
if (os.type() !== 'Windows_NT') {
process.env.TESTKIT_EXECUTABLE_PATH = 'sfdx';
const result = execCmd(`plugins:install ${UNSIGNED_MODULE_NAME}`, {
ensureExitCode: 2, // code 2 is the output code for the NO answer
answers: ['N'],
});
expect(result.shellOutput.stderr).to.contain(
'This plugin is not digitally signed and its authenticity cannot be verified. Continue installation y/n?:'
);
expect(result.shellOutput.stderr).to.contain('The user canceled the plugin installation');
}
});

it('plugins:install prompts on unsigned plugin (accepts)', () => {
process.env.TESTKIT_EXECUTABLE_PATH = 'sfdx';
const result = execCmd(`plugins:install ${UNSIGNED_MODULE_NAME}`, {
ensureExitCode: 0,
answers: ['Y'],
});
expect(result.shellOutput.stderr).to.contain(
'This plugin is not digitally signed and its authenticity cannot be verified. Continue installation y/n?:'
);
expect(result.shellOutput.stdout).to.contain('Finished digital signature check');
// windows does not support answering the prompt
if (os.type() !== 'Windows_NT') {
process.env.TESTKIT_EXECUTABLE_PATH = 'sfdx';
const result = execCmd(`plugins:install ${UNSIGNED_MODULE_NAME}`, {
ensureExitCode: 0,
answers: ['Y'],
});
expect(result.shellOutput.stderr).to.contain(
'This plugin is not digitally signed and its authenticity cannot be verified. Continue installation y/n?:'
);
expect(result.shellOutput.stdout).to.contain('Finished digital signature check');
}
});
});

Expand Down

0 comments on commit 6044439

Please sign in to comment.