Skip to content

Appears to not work with jest@27.0.6: ReferenceError: nameof is not defined #119

@andrewkolos

Description

@andrewkolos

Demo Repo

There are two modules, older-dependencies and up-to-date-dependencies. Both are identical except for the versions of certain dependencies including jest, ts-jest, and ts-nameof. However, running npm t in up-to-date-dependencies fails:

> jest

 FAIL  test/foo.test.ts
  ● Test suite failed to run

    ReferenceError: nameof is not defined

      1 | import foo from '../../foo';
      2 |
    > 3 | describe(nameof(foo), () => {
        | ^
      4 |   it('passes', () => {
      5 |     expect(true).toBe(true)
      6 |   })

      at Object.<anonymous> (test/foo.test.ts:3:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        3.652 s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

However, tests work perfectly when ran in older-dependencies. Both use the setup mentioned here..

Node v: v14.15.1.
OS: Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions