Socket
Socket
Sign inDemoInstall

@salesforce/cli-plugins-testkit

Package Overview
Dependencies
8
Maintainers
64
Versions
281
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.1.2

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [1.1.2](https://github.com/salesforcecli/cli-plugins-testkit/compare/v1.1.1...v1.1.2) (2021-05-24)
### Bug Fixes
* revert access token support ([#94](https://github.com/salesforcecli/cli-plugins-testkit/issues/94)) ([186a94f](https://github.com/salesforcecli/cli-plugins-testkit/commit/186a94fc748b2a8c8a0dadfc894b1bbd4c2f0845)), closes [#91](https://github.com/salesforcecli/cli-plugins-testkit/issues/91) [#90](https://github.com/salesforcecli/cli-plugins-testkit/issues/90)
### [1.1.1](https://github.com/salesforcecli/cli-plugins-testkit/compare/v1.1.0...v1.1.1) (2021-05-13)

@@ -7,0 +14,0 @@

5

lib/hubAuth.d.ts
export declare enum AuthStrategy {
JWT = "JWT",
AUTH_URL = "AUTH_URL",
ACCESS_TOKEN = "ACCESS_TOKEN",
REUSE = "REUSE",

@@ -9,6 +8,5 @@ NONE = "NONE"

export declare const prepareForJwt: (homeDir: string) => string;
export declare const prepareForAccessToken: (homeDir: string) => string;
export declare const prepareForAuthUrl: (homeDir: string) => string;
/**
* Inspects the environment (via AuthStrategy) and authenticates to a devhub via JWT, AuthUrl or AccessToken
* Inspects the environment (via AuthStrategy) and authenticates to a devhub via JWT or AuthUrl
* Sets the hub as default for use in tests

@@ -23,3 +21,2 @@ *

* required for AuthUrl: TESTKIT_AUTH_URL
* required for AccessToken: TESTKIT_AUTH_ACCESS_TOKEN, TESTKIT_HUB_INSTANCE
*/

@@ -26,0 +23,0 @@ export declare const testkitHubAuth: (homeDir: string, authStrategy?: AuthStrategy) => void;

25

lib/hubAuth.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transferExistingAuthToEnv = exports.testkitHubAuth = exports.prepareForAuthUrl = exports.prepareForAccessToken = exports.prepareForJwt = exports.AuthStrategy = void 0;
exports.transferExistingAuthToEnv = exports.testkitHubAuth = exports.prepareForAuthUrl = exports.prepareForJwt = exports.AuthStrategy = void 0;
/*

@@ -22,3 +22,2 @@ * Copyright (c) 2020, salesforce.com, inc.

AuthStrategy["AUTH_URL"] = "AUTH_URL";
AuthStrategy["ACCESS_TOKEN"] = "ACCESS_TOKEN";
AuthStrategy["REUSE"] = "REUSE";

@@ -62,8 +61,2 @@ AuthStrategy["NONE"] = "NONE";

exports.prepareForJwt = prepareForJwt;
const prepareForAccessToken = (homeDir) => {
const accessTokenFile = path.join(homeDir, 'accessTokenFile');
core_1.fs.writeFileSync(accessTokenFile, kit_1.env.getString('TESTKIT_AUTH_ACCESS_TOKEN', ''));
return accessTokenFile;
};
exports.prepareForAccessToken = prepareForAccessToken;
const prepareForAuthUrl = (homeDir) => {

@@ -76,3 +69,3 @@ const tmpUrl = path.join(homeDir, 'tmpUrl');

/**
* Inspects the environment (via AuthStrategy) and authenticates to a devhub via JWT, AuthUrl or AccessToken
* Inspects the environment (via AuthStrategy) and authenticates to a devhub via JWT or AuthUrl
* Sets the hub as default for use in tests

@@ -87,3 +80,2 @@ *

* required for AuthUrl: TESTKIT_AUTH_URL
* required for AccessToken: TESTKIT_AUTH_ACCESS_TOKEN, TESTKIT_HUB_INSTANCE
*/

@@ -116,12 +108,2 @@ const testkitHubAuth = (homeDir, authStrategy = getAuthStrategy()) => {

}
if (authStrategy === AuthStrategy.ACCESS_TOKEN) {
logger('trying to authenticate with Access Token');
const accessTokenFile = exports.prepareForAccessToken(homeDir);
const shellOutput = shell.exec(`sfdx auth:accesstoken:store --noprompt -d -f ${accessTokenFile} -r ${kit_1.env.getString('TESTKIT_HUB_INSTANCE', DEFAULT_INSTANCE_URL)}`, execOpts);
logger(shellOutput);
if (shellOutput.code !== 0) {
throw new Error(`auth:sfdxurl for url ${accessTokenFile} failed with exit code: ${shellOutput.code}\n ${shellOutput.stdout + shellOutput.stderr}`);
}
return;
}
logger('no hub configured');

@@ -139,5 +121,2 @@ };

}
if (kit_1.env.getString('TESTKIT_AUTH_ACCESS_TOKEN') && kit_1.env.getString('TESTKIT_HUB_INSTANCE')) {
return AuthStrategy.ACCESS_TOKEN;
}
// none of the above are included, so we want to reuse an already authenticated hub

@@ -144,0 +123,0 @@ if (kit_1.env.getString('TESTKIT_HUB_USERNAME')) {

export * from './genUniqueString';
export * from './execCmd';
export { prepareForAuthUrl, prepareForJwt, prepareForAccessToken } from './hubAuth';
export { prepareForAuthUrl, prepareForJwt } from './hubAuth';
export * from './testProject';
export * from './testSession';
export { Duration } from '@salesforce/kit';

@@ -19,3 +19,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Duration = exports.prepareForAccessToken = exports.prepareForJwt = exports.prepareForAuthUrl = void 0;
exports.Duration = exports.prepareForJwt = exports.prepareForAuthUrl = void 0;
__exportStar(require("./genUniqueString"), exports);

@@ -26,3 +26,2 @@ __exportStar(require("./execCmd"), exports);

Object.defineProperty(exports, "prepareForJwt", { enumerable: true, get: function () { return hubAuth_1.prepareForJwt; } });
Object.defineProperty(exports, "prepareForAccessToken", { enumerable: true, get: function () { return hubAuth_1.prepareForAccessToken; } });
__exportStar(require("./testProject"), exports);

@@ -29,0 +28,0 @@ __exportStar(require("./testSession"), exports);

@@ -55,3 +55,2 @@ import { AsyncOptionalCreatable } from '@salesforce/kit';

* TESTKIT_AUTH_URL = auth url to be used with auth:sfdxurl:store
* TESTKIT_AUTH_ACCESS_TOKEN = access token to be used with auth:accesstoken:store
*/

@@ -58,0 +57,0 @@ export declare class TestSession extends AsyncOptionalCreatable<TestSessionOptions> {

@@ -47,3 +47,2 @@ "use strict";

* TESTKIT_AUTH_URL = auth url to be used with auth:sfdxurl:store
* TESTKIT_AUTH_ACCESS_TOKEN = access token to be used with auth:accesstoken:store
*/

@@ -50,0 +49,0 @@ class TestSession extends kit_1.AsyncOptionalCreatable {

{
"name": "@salesforce/cli-plugins-testkit",
"description": "Provides test utilities to assist Salesforce CLI plug-in authors with writing non-unit tests (NUT).",
"version": "1.1.1",
"version": "1.1.2",
"author": "Salesforce",

@@ -6,0 +6,0 @@ "license": "BSD-3-Clause",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc