@oclif/test 4.0.1-beta.3 → 4.0.1-beta.4

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.
Files changed (2) hide show
  1. package/lib/index.js +3 -25
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -1,33 +1,11 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  exports.runHook = exports.runCommand = exports.captureOutput = void 0;
30
7
  const core_1 = require("@oclif/core");
8
+ const ansis_1 = __importDefault(require("ansis"));
31
9
  const debug_1 = __importDefault(require("debug"));
32
10
  const node_path_1 = require("node:path");
33
11
  const debug = (0, debug_1.default)('oclif-test');
@@ -63,6 +41,7 @@ function makeLoadOptions(loadOpts) {
63
41
  */
64
42
  async function captureOutput(fn, opts) {
65
43
  const print = opts?.print ?? false;
44
+ const stripAnsi = opts?.stripAnsi ?? true;
66
45
  const originals = {
67
46
  NODE_ENV: process.env.NODE_ENV,
68
47
  stderr: process.stderr.write,
@@ -72,8 +51,7 @@ async function captureOutput(fn, opts) {
72
51
  stderr: [],
73
52
  stdout: [],
74
53
  };
75
- const { default: stripAnsi } = (opts?.stripAnsi ?? true) ? await Promise.resolve().then(() => __importStar(require('strip-ansi'))) : { default: (str) => str };
76
- const toString = (str) => stripAnsi(str.toString());
54
+ const toString = (str) => (stripAnsi ? ansis_1.default.strip(str.toString()) : str.toString());
77
55
  const getStderr = () => output.stderr.map((b) => toString(b)).join('');
78
56
  const getStdout = () => output.stdout.map((b) => toString(b)).join('');
79
57
  const mock = (std) => (str, encoding, cb) => {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@oclif/test",
3
3
  "description": "test helpers for oclif components",
4
- "version": "4.0.1-beta.3",
4
+ "version": "4.0.1-beta.4",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/test/issues",
7
7
  "dependencies": {
8
- "debug": "^4.3.4",
9
- "strip-ansi": "^7.1.0"
8
+ "ansis": "^3.2.0",
9
+ "debug": "^4.3.4"
10
10
  },
11
11
  "peerDependencies": {
12
12
  "@oclif/core": ">= 3.0.0"