Skip to content

Commit 6f5206e

Browse files
committed
fix: updated and removed dependencies @W-18342938@
1 parent 2c30260 commit 6f5206e

File tree

5 files changed

+130
-67
lines changed

5 files changed

+130
-67
lines changed

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Apache License Version 2.0
22

3-
Copyright (c) 2025 Salesforce, Inc.
3+
Copyright (c) 2026 Salesforce, Inc.
44
All rights reserved.
55

66
Apache License

SAMPLES.md

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ describe('execCmd', () => {
102102

103103
```typescript
104104
import { execCmd } from '@salesforce/cli-plugins-testkit';
105+
/*
106+
* Copyright (c) 2023, salesforce.com, inc.
107+
* All rights reserved.
108+
* Licensed under the BSD 3-Clause license.
109+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
110+
*/
105111

106112
describe('execCmd', () => {
107113
// This would actually be set in the shell or CI environment.
@@ -168,6 +174,12 @@ A TestSession provides conveniences to testing plugin commands with options to a
168174

169175
```typescript
170176
import { execCmd, TestSession, TestProject } from '@salesforce/cli-plugins-testkit';
177+
/*
178+
* Copyright (c) 2023, salesforce.com, inc.
179+
* All rights reserved.
180+
* Licensed under the BSD 3-Clause license.
181+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
182+
*/
171183

172184
describe('TestSession', () => {
173185
let testSession: TestSession;
@@ -196,6 +208,12 @@ describe('TestSession', () => {
196208

197209
```typescript
198210
import { execCmd, TestSession, TestProject } from '@salesforce/cli-plugins-testkit';
211+
/*
212+
* Copyright (c) 2023, salesforce.com, inc.
213+
* All rights reserved.
214+
* Licensed under the BSD 3-Clause license.
215+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
216+
*/
199217

200218
describe('TestSession', () => {
201219
let testSession: TestSession;
@@ -282,6 +300,12 @@ describe('TestSession', () => {
282300

283301
```typescript
284302
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
303+
/*
304+
* Copyright (c) 2023, salesforce.com, inc.
305+
* All rights reserved.
306+
* Licensed under the BSD 3-Clause license.
307+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
308+
*/
285309

286310
describe('TestSession', () => {
287311
let testSession: TestSession;
@@ -306,7 +330,12 @@ describe('TestSession', () => {
306330

307331
```typescript
308332
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
309-
333+
/*
334+
* Copyright (c) 2023, salesforce.com, inc.
335+
* All rights reserved.
336+
* Licensed under the BSD 3-Clause license.
337+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
338+
*/
310339
import { tmpdir } from 'os';
311340
import { expect } from 'chai';
312341

@@ -388,6 +417,12 @@ describe('TestSession', () => {
388417

389418
```typescript
390419
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
420+
/*
421+
* Copyright (c) 2023, salesforce.com, inc.
422+
* All rights reserved.
423+
* Licensed under the BSD 3-Clause license.
424+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
425+
*/
391426

392427
describe('TestSession', () => {
393428
let testSession: TestSession;
@@ -418,6 +453,12 @@ describe('TestSession', () => {
418453

419454
```typescript
420455
import { execCmd, TestSession, TestProject } from '@salesforce/cli-plugins-testkit';
456+
/*
457+
* Copyright (c) 2023, salesforce.com, inc.
458+
* All rights reserved.
459+
* Licensed under the BSD 3-Clause license.
460+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
461+
*/
421462

422463
describe('TestSession', () => {
423464
let testSession: TestSession;
@@ -450,6 +491,12 @@ describe('TestSession', () => {
450491

451492
```typescript
452493
import { execCmd, TestSession, TestProject } from '@salesforce/cli-plugins-testkit';
494+
/*
495+
* Copyright (c) 2023, salesforce.com, inc.
496+
* All rights reserved.
497+
* Licensed under the BSD 3-Clause license.
498+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
499+
*/
453500

454501
describe('TestSession', () => {
455502
let testSession: TestSession;
@@ -480,7 +527,12 @@ describe('TestSession', () => {
480527

481528
```typescript
482529
import { execCmd, TestSession, TestProject } from '@salesforce/cli-plugins-testkit';
483-
530+
/*
531+
* Copyright (c) 2023, salesforce.com, inc.
532+
* All rights reserved.
533+
* Licensed under the BSD 3-Clause license.
534+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
535+
*/
484536
import * as path from 'path';
485537

486538
describe('TestSession', () => {
@@ -521,7 +573,12 @@ describe('TestSession', () => {
521573

522574
```typescript
523575
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
524-
576+
/*
577+
* Copyright (c) 2023, salesforce.com, inc.
578+
* All rights reserved.
579+
* Licensed under the BSD 3-Clause license.
580+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
581+
*/
525582
import * as shelljs from 'shelljs';
526583

527584
/*

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
"debug": "^4.4.0",
5353
"jszip": "^3.10.1",
5454
"shelljs": "^0.8.4",
55-
"sinon": "^17.0.2",
56-
"strip-ansi": "6.0.1",
55+
"sinon": "^21.0.1",
5756
"ts-retry-promise": "^0.8.1"
5857
},
5958
"devDependencies": {

src/testSession.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
*/
77
import * as fs from 'node:fs';
88
import * as path from 'node:path';
9+
import util from 'node:util';
910
import { RetryConfig } from 'ts-retry-promise';
1011
import { debug, Debugger } from 'debug';
1112
import { AsyncOptionalCreatable, Duration, env, parseJson, sleep } from '@salesforce/kit';
1213
import { Optional } from '@salesforce/ts-types';
1314
import { createSandbox, SinonStub } from 'sinon';
1415
import * as shell from 'shelljs';
15-
import stripAnsi = require('strip-ansi');
1616
import { AuthFields, OrgAuthorization } from '@salesforce/core';
1717
import { genUniqueString } from './genUniqueString';
1818
import { zipDir } from './zip';
@@ -72,7 +72,7 @@ export type TestSessionOptions = {
7272
* The number of times to retry the scratch org create after the initial attempt if it fails. Will be overridden by TESTKIT_SETUP_RETRIES environment variable.
7373
*/
7474
retries?: number;
75-
}
75+
};
7676

7777
// exported for test assertions
7878
export const rmOptions = { recursive: true, force: true };
@@ -187,7 +187,7 @@ export class TestSession<T extends TestSessionOptions = TestSessionOptions> exte
187187

188188
if (authStrategy !== 'NONE') {
189189
const config = shell.exec('sf config get target-dev-hub --json', this.shelljsExecOptions) as shell.ShellString;
190-
const configResults = JSON.parse(stripAnsi(config.stdout)) as unknown as JsonOutput<
190+
const configResults = JSON.parse(util.stripVTControlCharacters(config.stdout)) as unknown as JsonOutput<
191191
Array<{ name: string; value: string }>
192192
>;
193193
const usernameOrAlias = configResults.result.find((org) => org.name === 'target-dev-hub')?.value;
@@ -196,7 +196,9 @@ export class TestSession<T extends TestSessionOptions = TestSessionOptions> exte
196196
`sf org:display -o ${usernameOrAlias} --json`,
197197
this.shelljsExecOptions
198198
) as shell.ShellString;
199-
const displayEnvResults = JSON.parse(stripAnsi(displayEnv.stdout)) as unknown as JsonOutput<OrgAuthorization>;
199+
const displayEnvResults = JSON.parse(
200+
util.stripVTControlCharacters(displayEnv.stdout)
201+
) as unknown as JsonOutput<OrgAuthorization>;
200202
this.hubOrg = displayEnvResults.result;
201203
}
202204
}
@@ -362,8 +364,8 @@ export class TestSession<T extends TestSessionOptions = TestSessionOptions> exte
362364
}
363365

364366
const rv = shell.exec(baseCmd, this.shelljsExecOptions) as shell.ShellString;
365-
rv.stdout = stripAnsi(rv.stdout);
366-
rv.stderr = stripAnsi(rv.stderr);
367+
rv.stdout = rv.stdout ? util.stripVTControlCharacters(rv.stdout) : rv.stdout;
368+
rv.stderr = rv.stderr ? util.stripVTControlCharacters(rv.stderr) : rv.stderr;
367369
if (rv.code !== 0) {
368370
throw Error(`${baseCmd} failed due to: ${rv.stdout}`);
369371
}

0 commit comments

Comments
 (0)