Skip to content

Commit 3f4357d

Browse files
committed
fix(cli-ansi-parser): remove reference of old test
1 parent cbe66e6 commit 3f4357d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

cli-examples/__tests__/prompts.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,12 @@ test('should block 12 year old', async () => {
1515
`? How old are you? ${FORWARD_ARROW} 12\n${FORWARD_ARROW} Nightclub is 18+ only`
1616
);
1717
});
18+
19+
test('should allow 20 year old', async () => {
20+
const commandInterface = createCommandInterface('node ./prompts.js', {
21+
cwd: path.join(__dirname, '..')
22+
});
23+
await commandInterface.type('20\n');
24+
const terminal = await commandInterface.getOutput();
25+
expect(terminal.stringOutput).toBe('✔ How old are you? … 20\n{ value: 20 }');
26+
});

lib/cli-ansi-parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
const AnsiTerminal = require('node-ansiterminal').AnsiTerminal;
22
const AnsiParser = require('node-ansiparser');
3-
const terminal = new AnsiTerminal(80, 25, 500);
4-
const terminalParser = new AnsiParser(terminal);
53

64
// types
75
/**
@@ -118,6 +116,8 @@ const parseOutput = (output) => {
118116
};
119117

120118
const finalString = () => {
119+
const terminal = new AnsiTerminal(80, 25, 500);
120+
const terminalParser = new AnsiParser(terminal);
121121
terminalParser.parse(output);
122122
const trimmedOutput = terminal
123123
.toString()

0 commit comments

Comments
 (0)