Ts-jest: Class extends value undefined is not a constructor or null

Created on 16 Apr 2019  ยท  6Comments  ยท  Source: kulshekhar/ts-jest

Issue :

When I run my project using node ts-node/register I don't get any errors,
however with ts-jest I receive the following:

 โ— Test suite failed to run

    TypeError: Class extends value undefined is not a constructor or null

      at Object.<anonymous> (../node_modules/google-gax/src/grpc.ts:110:43)
      at Object.<anonymous> (../node_modules/google-gax/src/index.ts:32:1)

The file grpc.ts doesn't actually exist, it's a JS file really.
I wonder why it's trying to include grpc.ts when only a js file exists.

Expected behavior :

ts-jest should be able to run file like ts-node without the above error.

Most helpful comment

i also go through thr same problem as a begginer.my fault is that i just use c instead of C in component.i know that is very silly mistake.

All 6 comments

Apparently I had the wrong path in the package.json jest config as seen below.

"moduleDirectories": [
      "src",

Thought I could use relative path src, but I needed to change it to <rootDir> for it to work.

i also go through thr same problem as a begginer.my fault is that i just use c instead of C in component.i know that is very silly mistake.

guys, exist any way to ignore this kind of errors? I'm getting this issue from React Native project

i also go through thr same problem as a begginer.my fault is that i just use c instead of C in component.i know that is very silly mistake.

thanks mahn!

I was getting the same error since it was my first time with component.
The error was instead of writing Component ,i wrote component.
so check whether it is C or c .

@shivanshutiari319, @aditisaran26, what component are you guys trying to talk about?

I've run into this error when attempting to import from a CommonJS module without named exports. I used this workaround:

import * as MFoo from 'foo'; const Foo = MFoo.default || MFoo;

Then class MyFoo extend Foo { ... }.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

artola picture artola  ยท  3Comments

masters3d picture masters3d  ยท  4Comments

ozum picture ozum  ยท  4Comments

japhar81 picture japhar81  ยท  3Comments

jbreckmckye picture jbreckmckye  ยท  3Comments