@oclif/test 4.0.1-beta.0 → 4.0.1-beta.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.
Files changed (2) hide show
  1. package/lib/index.js +5 -2
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -14,6 +14,7 @@ const RECORD_OPTIONS = {
14
14
  stripAnsi: true,
15
15
  };
16
16
  const originals = {
17
+ NODE_ENV: process.env.NODE_ENV,
17
18
  stderr: process.stderr.write,
18
19
  stdout: process.stdout.write,
19
20
  };
@@ -42,6 +43,7 @@ function mockedStderr(str, encoding, cb) {
42
43
  const restore = () => {
43
44
  process.stderr.write = originals.stderr;
44
45
  process.stdout.write = originals.stdout;
46
+ process.env.NODE_ENV = originals.NODE_ENV;
45
47
  };
46
48
  const reset = () => {
47
49
  output.stderr = [];
@@ -73,6 +75,7 @@ async function captureOutput(fn, opts) {
73
75
  RECORD_OPTIONS.stripAnsi = opts?.stripAnsi ?? true;
74
76
  process.stderr.write = mockedStderr;
75
77
  process.stdout.write = mockedStdout;
78
+ process.env.NODE_ENV = 'test';
76
79
  try {
77
80
  const result = await fn();
78
81
  return {
@@ -100,14 +103,14 @@ async function runCommand(args, loadOpts, captureOpts) {
100
103
  const argsArray = (Array.isArray(args) ? args : [args]).join(' ').split(' ');
101
104
  const [id, ...rest] = argsArray;
102
105
  const finalArgs = id === '.' ? rest : argsArray;
103
- debug('loadOpts: %O', loadOpts);
106
+ debug('loadOpts: %O', loadOptions);
104
107
  debug('args: %O', finalArgs);
105
108
  return captureOutput(async () => (0, core_1.run)(finalArgs, loadOptions), captureOpts);
106
109
  }
107
110
  exports.runCommand = runCommand;
108
111
  async function runHook(hook, options, loadOpts, recordOpts) {
109
112
  const loadOptions = makeLoadOptions(loadOpts);
110
- debug('loadOpts: %O', loadOpts);
113
+ debug('loadOpts: %O', loadOptions);
111
114
  return captureOutput(async () => {
112
115
  const config = await core_1.Config.load(loadOptions);
113
116
  return config.runHook(hook, options);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/test",
3
3
  "description": "test helpers for oclif components",
4
- "version": "4.0.1-beta.0",
4
+ "version": "4.0.1-beta.1",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/test/issues",
7
7
  "dependencies": {