@@ -78,7 +78,12 @@ test('should ignore stdio when quiet', async ({ runInlineTest }) => {
78
78
expect ( result . output ) . not . toContain ( '%%' ) ;
79
79
} ) ;
80
80
81
- test ( 'should support console colors' , async ( { runInlineTest } ) => {
81
+ test ( 'should support console colors but not tty' , {
82
+ annotation : [
83
+ { type : 'issue' , description : 'https://github.com/microsoft/playwright/issues/15366' } ,
84
+ { type : 'issue' , description : 'https://github.com/microsoft/playwright/issues/29839' } ,
85
+ ] ,
86
+ } , async ( { runInlineTest } ) => {
82
87
const result = await runInlineTest ( {
83
88
'a.spec.js' : `
84
89
import { test, expect } from '@playwright/test';
@@ -90,31 +95,13 @@ test('should support console colors', async ({ runInlineTest }) => {
90
95
});
91
96
`
92
97
} ) ;
93
- expect ( result . output ) . toContain ( `process.stdout.isTTY = true ` ) ;
94
- expect ( result . output ) . toContain ( `process.stderr.isTTY = true ` ) ;
98
+ expect ( result . output ) . toContain ( `process.stdout.isTTY = undefined ` ) ;
99
+ expect ( result . output ) . toContain ( `process.stderr.isTTY = undefined ` ) ;
95
100
// The output should have colors.
96
101
expect ( result . rawOutput ) . toContain ( `{ b: \x1b[33mtrue\x1b[39m, n: \x1b[33m123\x1b[39m, s: \x1b[32m'abc'\x1b[39m }` ) ;
97
102
expect ( result . rawOutput ) . toContain ( `{ b: \x1b[33mfalse\x1b[39m, n: \x1b[33m123\x1b[39m, s: \x1b[32m'abc'\x1b[39m }` ) ;
98
103
} ) ;
99
104
100
- test ( 'should override hasColors and getColorDepth' , async ( { runInlineTest } ) => {
101
- const result = await runInlineTest ( {
102
- 'a.spec.js' : `
103
- import { test, expect } from '@playwright/test';
104
- test('console log', () => {
105
- console.log('process.stdout.hasColors(1) = ' + process.stdout.hasColors(1));
106
- console.log('process.stderr.hasColors(1) = ' + process.stderr.hasColors(1));
107
- console.log('process.stdout.getColorDepth() > 0 = ' + (process.stdout.getColorDepth() > 0));
108
- console.log('process.stderr.getColorDepth() > 0 = ' + (process.stderr.getColorDepth() > 0));
109
- });
110
- `
111
- } ) ;
112
- expect ( result . output ) . toContain ( `process.stdout.hasColors(1) = true` ) ;
113
- expect ( result . output ) . toContain ( `process.stderr.hasColors(1) = true` ) ;
114
- expect ( result . output ) . toContain ( `process.stdout.getColorDepth() > 0 = true` ) ;
115
- expect ( result . output ) . toContain ( `process.stderr.getColorDepth() > 0 = true` ) ;
116
- } ) ;
117
-
118
105
test ( 'should not throw type error when using assert' , async ( { runInlineTest } ) => {
119
106
const result = await runInlineTest ( {
120
107
'a.spec.js' : `
@@ -128,30 +115,3 @@ test('should not throw type error when using assert', async ({ runInlineTest })
128
115
expect ( result . output ) . not . toContain ( `TypeError: process.stderr.hasColors is not a function` ) ;
129
116
expect ( result . output ) . toContain ( `AssertionError` ) ;
130
117
} ) ;
131
-
132
- test ( 'should provide stubs for tty.WriteStream methods on process.stdout/stderr' , async ( { runInlineTest } ) => {
133
- test . info ( ) . annotations . push ( { type : 'issue' , description : 'https://github.com/microsoft/playwright/issues/29839' } ) ;
134
- const result = await runInlineTest ( {
135
- 'a.spec.ts' : `
136
- import { test, expect } from '@playwright/test';
137
- import type * as tty from 'tty';
138
- async function checkMethods(stream: tty.WriteStream) {
139
- expect(stream.isTTY).toBe(true);
140
- await new Promise<void>(r => stream.clearLine(-1, r));;
141
- await new Promise<void>(r => stream.clearScreenDown(r));;
142
- await new Promise<void>(r => stream.cursorTo(0, 0, r));;
143
- await new Promise<void>(r => stream.cursorTo(0, r));;
144
- await new Promise<void>(r => stream.moveCursor(1, 1, r));;
145
- expect(stream.getWindowSize()).toEqual([stream.columns, stream.rows]);
146
- // getColorDepth() and hasColors() are covered in other tests.
147
- }
148
- test('process.stdout implementd tty.WriteStream methods', () => {
149
- checkMethods(process.stdout);
150
- });
151
- test('process.stderr implementd tty.WriteStream methods', () => {
152
- checkMethods(process.stderr);
153
- });
154
- `
155
- } ) ;
156
- expect ( result . exitCode ) . toBe ( 0 ) ;
157
- } ) ;
0 commit comments