Skip to content

Commit

Permalink
Fix tty issue
Browse files Browse the repository at this point in the history
  • Loading branch information
1999 committed Jun 22, 2019
1 parent 523fb01 commit 026ba8a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 0 additions & 5 deletions src/subprocess/thread/worker.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { register: registerTypescriptHandler } = require('ts-node');

// monkeypatch Node.JS native TTY function
// otherwise mocha native base reporter throws exception
// inside a worker environment
require('tty').getWindowSize = () => 75;

registerTypescriptHandler();
require(`${__dirname}/worker.ts`);
6 changes: 5 additions & 1 deletion src/subprocess/thread/worker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { workerData } from 'worker_threads';
// monkeypatch Node.JS native TTY function
// otherwise mocha native base reporter throws exception
// inside a worker environment
require('tty').getWindowSize = () => 75;

import { workerData } from 'worker_threads';
import { runMocha } from '../runner';
import { WorkerData } from '../../main/thread/worker';

Expand Down
1 change: 1 addition & 0 deletions test/run-programmatically/tty-worker/README
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Check that spec reporter can work in a non-TTY window
TODO: this test fails when you run index.js from the terminal but doesn't fail when it's executed from tests/index.sh

0 comments on commit 026ba8a

Please sign in to comment.