jest-preset-angular: TypeError: test.each is not a function

Trying to use Jest 23 “test.each” error results in a TypeError.

Test

  test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
    '.add(%i, %i)',
    (a, b, expected) => {
      expect(a + b).toBe(expected);
    },
  );

Error Message

 FAIL  src/app/wte/components/my-component.component.spec.ts (204 MB heap size)
  MyComponent
    ✓ should create (743ms)
    ✕ encountered a declaration exception (625ms)

  ● MyComponent › encountered a declaration exception

    TypeError: test.each is not a function

      27 |   });
      28 |
    > 29 |   test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
         |        ^
      30 |     '.add(%i, %i)',
      31 |     (a, b, expected) => {
      32 |       expect(a + b).toBe(expected);

      at src/app/wte/components/my-component.component.spec.ts:29:8
      at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:388:26)
      at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/dist/zone.js:138:43)
      at Suite.<anonymous> (node_modules/jest-zone-patch/index.js:39:25)
      at env.(anonymous function) (node_modules/jest-zone-patch/index.js:57:27)
      at Object.<anonymous> (src/app/wte/components/my-component.component.spec.ts:8:1)

Any suggestions what am I missing ?

regards

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 14
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Waiting for a fix too…

@thymikee Works like a charm 🎉 Thanks!