Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit 82a45eb

Browse files
committed
fix: require flush to occur manually to fix tests
Fixes oclif/oclif#115
1 parent a4aad01 commit 82a45eb

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

bin/run

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
require('ts-node/register')
44
require('../src').run()
5+
.then(require('../src/flush'))
56
.catch(require('@oclif/errors/handle'))
67

78
// const {Command, flags, parse} = require('../src')

src/command.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,7 @@ export default abstract class Command {
5656
delete process.env[this.config.scopedEnvVarKey('REDIRECTED')]
5757

5858
await this.init()
59-
const retVal = await this.run()
60-
try {
61-
const {ux} = require('cli-ux')
62-
await ux.flush()
63-
} catch {}
64-
return retVal
59+
return await this.run()
6560
} catch (e) {
6661
err = e
6762
await this.catch(e)

src/flush.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export = async () => {
2+
try {
3+
const {ux} = require('cli-ux')
4+
await ux.flush()
5+
} catch {}
6+
}

yarn.lock

+8-8
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
glob-to-regexp "^0.3.0"
3636

3737
"@oclif/command@^1.4.20", "@oclif/command@^1.4.21":
38-
version "1.4.23"
39-
resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.4.23.tgz#527973ec1989f41a54661b8c889404ee33215436"
38+
version "1.4.25"
39+
resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.4.25.tgz#dea2e72cabdb42f2a15085e08cde80d033d2c36e"
4040
dependencies:
4141
"@oclif/errors" "^1.1.1"
42-
"@oclif/parser" "^3.3.3"
42+
"@oclif/parser" "^3.4.0"
4343
debug "^3.1.0"
4444
semver "^5.5.0"
4545

@@ -63,7 +63,7 @@
6363
version "1.0.0"
6464
resolved "https://registry.yarnpkg.com/@oclif/linewrap/-/linewrap-1.0.0.tgz#aedcb64b479d4db7be24196384897b5000901d91"
6565

66-
"@oclif/parser@^3.3.3", "@oclif/parser@^3.4.0":
66+
"@oclif/parser@^3.4.0":
6767
version "3.4.0"
6868
resolved "https://registry.yarnpkg.com/@oclif/parser/-/parser-3.4.0.tgz#bf61399c70f75a96070153df2fcbb7e7115c7fd9"
6969
dependencies:
@@ -329,8 +329,8 @@ clean-stack@^1.3.0:
329329
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-1.3.0.tgz#9e821501ae979986c46b1d66d2d432db2fd4ae31"
330330

331331
cli-ux@^4.2.1:
332-
version "4.2.3"
333-
resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-4.2.3.tgz#d2e45bd9248ed518847bc371f8cfcae45ec6a452"
332+
version "4.3.0"
333+
resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-4.3.0.tgz#048f6334ef50cc5ab7cc0d51725c3888c75cbc41"
334334
dependencies:
335335
"@oclif/linewrap" "^1.0.0"
336336
"@oclif/screen" "^1.0.2"
@@ -1223,8 +1223,8 @@ source-map-resolve@^0.5.0:
12231223
urix "^0.1.0"
12241224

12251225
source-map-support@^0.5.3:
1226-
version "0.5.5"
1227-
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.5.tgz#0d4af9e00493e855402e8ec36ebed2d266fceb90"
1226+
version "0.5.6"
1227+
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13"
12281228
dependencies:
12291229
buffer-from "^1.0.0"
12301230
source-map "^0.6.0"

0 commit comments

Comments
 (0)