From da5b4933641afc4162e3528c54846d9711a9b40f Mon Sep 17 00:00:00 2001 From: Vadim Demedes Date: Wed, 3 May 2023 23:56:56 +0300 Subject: [PATCH] Try to fix tests on CI --- test/fixtures/erase-once-with-static.tsx | 2 -- test/fixtures/erase-once.tsx | 2 -- test/render.tsx | 11 ++++++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/test/fixtures/erase-once-with-static.tsx b/test/fixtures/erase-once-with-static.tsx index 9dfac4d72..b8669fa34 100644 --- a/test/fixtures/erase-once-with-static.tsx +++ b/test/fixtures/erase-once-with-static.tsx @@ -1,4 +1,3 @@ -import process from 'node:process'; import React, {useState} from 'react'; import {Box, Static, Text, render, useInput} from '../../src/index.js'; @@ -29,5 +28,4 @@ function Test() { ); } -process.stdout.rows = Number(process.argv[2]); render(); diff --git a/test/fixtures/erase-once.tsx b/test/fixtures/erase-once.tsx index 267702c0e..ee37d3d55 100644 --- a/test/fixtures/erase-once.tsx +++ b/test/fixtures/erase-once.tsx @@ -1,4 +1,3 @@ -import process from 'node:process'; import React, {useState} from 'react'; import {Box, Text, render, useInput} from '../../src/index.js'; @@ -23,5 +22,4 @@ function Test() { ); } -process.stdout.rows = Number(process.argv[2]); render(); diff --git a/test/render.tsx b/test/render.tsx index c89ea3f33..d983ab448 100644 --- a/test/render.tsx +++ b/test/render.tsx @@ -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; @@ -43,6 +47,7 @@ const term = (fixture: string, args: string[] = []) => { { name: 'xterm-color', cols: 100, + rows, cwd: __dirname, env } @@ -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)); @@ -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 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));