Skip to content

Strange tests titles on Node.js v12 #8443

@litichevskiydv

Description

@litichevskiydv

🐛 Bug Report

test.each doesn't use test case toString for tests titles generation on Node.js v12 and produces titles like this:

{ toString: [Function: toString] }

To Reproduce

Situation can be reproduced via executing such test on Node.js v12.

describe("Should not use toString", () => {
  const testCases = [
    {
      toString: () => "Clear test title"
    }
  ];

  test.each(testCases)("%s", testCase => {});
});

Expected behavior

Test title ought to be "Clear test title" as it is on Node.js v8 and v10.

Link to repl or repo (highly encouraged)

Test cases for which strange titles are generated:
https://github.com/litichevskiydv/JsUsefulPrimitives/blob/master/tests/manipulation/manipula.test.js

Build log for Node.js v10:
https://travis-ci.org/litichevskiydv/JsUsefulPrimitives/jobs/529938904
Build log for Node.js v12:
https://travis-ci.org/litichevskiydv/JsUsefulPrimitives/jobs/529938905

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: Linux 4.15 Ubuntu 16.04.6 LTS (Xenial Xerus)
    CPU: (2) x64 Intel(R) Xeon(R) CPU @ 2.30GHz
  Binaries:
    Node: 12.2.0 - ~/.nvm/versions/node/v12.2.0/bin/node
    Yarn: 1.15.2 - /usr/local/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v12.2.0/bin/npm
  npmPackages:
    jest: 24.8.0 => 24.8.0 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions