Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: tty.getWindowSize is not a function #247

Closed
AntaninaKaltsova opened this issue Jun 10, 2019 · 7 comments
Closed

TypeError: tty.getWindowSize is not a function #247

AntaninaKaltsova opened this issue Jun 10, 2019 · 7 comments

Comments

@AntaninaKaltsova
Copy link

Hi! I started to get the following error:
(node:53208) UnhandledPromiseRejectionWarning: TypeError: tty.getWindowSize is not a function at Object.<anonymous> at the line tty.getWindowSize()[1]; in *\node_modules\mocha\lib\reporters\base.js line

Сan еhis be related to the new version 2.2.0?
Node version: v12.4.0

My mocha-runner.ts

`require("dotenv").config();

import fs from "fs";
import Mocha from 'mocha-parallel-tests';
import path from "path";

const mocha = new Mocha({
reporter: "mocha-multi-reporters",
reporterOptions: {
configFile: "./mocha-multi-reporters.config.json",
},
timeout: 120000,
ui: "bdd",
});

const testDir = "./build/tests";

/**

  • Gets the test .js file paths recursively from a given directory.

  • @param {String} dir - path to directory containing test files.

  • @returns {Array} Filepaths to each test .js file.
    */
    function getTestPaths(dir, fileList) {
    const files = fs.readdirSync(dir);
    fileList = fileList || [];

    files.forEach(function (file) {
    if (fs.statSync(path.join(dir, file)).isDirectory()) {
    fileList = getTestPaths(path.join(dir, file), fileList);
    } else {
    fileList.push(path.join(dir, file));
    }
    });

    return fileList.filter(function (file) {
    return path.extname(file) === ".js";
    });
    }

// Get all .js paths and add each file to the mocha instance.
getTestPaths(testDir).forEach(function (file) {
mocha.addFile(path.join(file));
});

// Run the tests.
mocha.run(function (failures) {
process.exitCode = failures ? 1 : 0; // exit with non-zero status if there were failures
});
`

@1999
Copy link
Collaborator

1999 commented Jun 10, 2019

Hey @AntaninaKaltsova, thanks for checking the new version :)
What's your operating system?

@emmakun
Copy link

emmakun commented Jun 11, 2019

Same issue here, using macOS Mojave 10.14.5.

Also checked with version 2.1.0 and the same thing is happening.

@1999
Copy link
Collaborator

1999 commented Jun 11, 2019

@alvaroemmanuel do you also run mocha-parallel-tests programmatically (not via its CLI)?

@emmakun
Copy link

emmakun commented Jun 19, 2019

@1999 no, I'm running it through CLI, from npm test, I just replaced "mocha" with "mocha-parallel-tests" in my package.json scripts.test.

@1999
Copy link
Collaborator

1999 commented Jun 19, 2019

Gotcha. I could reproduce this issue but unfortunately, it doesn't fail in the CI: #250. I will try to fix this in the next few days.

@1999
Copy link
Collaborator

1999 commented Jun 22, 2019

@alvaroemmanuel @AntaninaKaltsova this issue should be resolved in mocha-parallel-tests=2.2.1. Please re-open this issue if you still see the error.

@1999 1999 closed this as completed Jun 22, 2019
@emmakun
Copy link

emmakun commented Jun 24, 2019

It's working now, thanks @1999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants