Skip to content

Commit

Permalink
Try to fix tests on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimdemedes authored and matteodepalo committed Jul 17, 2023
1 parent c2cc085 commit da5b493
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 0 additions & 2 deletions test/fixtures/erase-once-with-static.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import process from 'node:process';
import React, {useState} from 'react';
import {Box, Static, Text, render, useInput} from '../../src/index.js';

Expand Down Expand Up @@ -29,5 +28,4 @@ function Test() {
);
}

process.stdout.rows = Number(process.argv[2]);
render(<Test />);
2 changes: 0 additions & 2 deletions test/fixtures/erase-once.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import process from 'node:process';
import React, {useState} from 'react';
import {Box, Text, render, useInput} from '../../src/index.js';

Expand All @@ -23,5 +22,4 @@ function Test() {
);
}

process.stdout.rows = Number(process.argv[2]);
render(<Test />);
11 changes: 8 additions & 3 deletions test/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ const {spawn} = require('node-pty') as typeof import('node-pty');

const __dirname = url.fileURLToPath(new URL('.', import.meta.url));

const term = (fixture: string, args: string[] = []) => {
const term = (
fixture: string,
args: string[] = [],
{rows}: {rows?: number} = {}
) => {
let resolve: (value?: unknown) => void;
let reject: (error: Error) => void;

Expand All @@ -43,6 +47,7 @@ const term = (fixture: string, args: string[] = []) => {
{
name: 'xterm-color',
cols: 100,
rows,
cwd: __dirname,
env
}
Expand Down Expand Up @@ -107,7 +112,7 @@ test.serial('erase screen', async t => {
});

test.serial('erase screen once then continue rendering as usual', async t => {
const ps = term('erase-once', ['3']);
const ps = term('erase-once', [], {rows: 3});
await delay(1000);

t.true(ps.output.includes(ansiEscapes.clearTerminal));
Expand All @@ -130,7 +135,7 @@ test.serial('erase screen once then continue rendering as usual', async t => {
test.serial(
'erase screen once then continue rendering as usual with <Static> present',
async t => {
const ps = term('erase-once-with-static', ['3']);
const ps = term('erase-once-with-static', [], {rows: 3});
await delay(1000);

t.true(ps.output.includes(ansiEscapes.clearTerminal));
Expand Down

0 comments on commit da5b493

Please sign in to comment.