question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Coverage functions with TypeORM entity is always 0

See original GitHub issue

🐛 Bug Report

Coverage functions with TypeORM entity is always 0. Please see attached screenshot. I have relations decorator

@ManyToMany(type => Group, { cascade: true })

and coverage for type => Group arrow function is 0

To Reproduce

Create an entity with relations decorator

import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  ManyToMany,
  JoinTable,
} from 'typeorm';
import { Group } from '../group/group.entity';

@Entity()
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ length: 32, unique: true, readonly: true })
  uid: string;

  @ManyToMany(type => Group, { cascade: true })
  @JoinTable()
  groups: Group[];
}

Expected behavior

Function coverage should be 100%

Link to repl or repo (highly encouraged)

Please see the attached screenshot. screen shot 2018-09-26 at 2 59 31 pm

Run npx envinfo --preset jest

Paste the results here:

npx: installed 1 in 1.542s

  System:
    OS: macOS 10.14
    CPU: x64 Intel(R) Xeon(R) CPU E5-1680 v2 @ 3.00GHz
  Binaries:
    Node: 10.10.0 - /usr/local/bin/node
    npm: 6.4.1 - /usr/local/bin/npm
  npmPackages:
    @types/jest: ^23.3.1 => 23.3.2
    jest: ^23.6.0 => 23.6.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
SimenBcommented, Sep 30, 2018

When ManyToMany decorator is meant to trigger?

I have no idea, that has nothing to do with Jest though.

Ignoring it unless you actually execute some stuff seems like a good compromise.

0reactions
github-actions[bot]commented, May 12, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

typeorm/typeorm - Gitter
I'm having a hard time setting the current timestamp to a column on an MySQL database. My entity is the following: @Column({ nullable:...
Read more >
TypeORM- findOne returns unexpected value - Stack Overflow
I have a User Entity with an Email Column. When I use TypeORM's findOne function to search for a Email which doesn't exist...
Read more >
TypeORM Tips (Part 1: Don't use save()) - DEV Community ‍ ‍
First, it uses a SELECT query to search for an existing entity. If step 1 returns a record, it uses UPDATE to update...
Read more >
Complete guide to using TypeORM and TypeScript for data ...
In this article we'll learn about using TypeORM to set up Entity ... The CustomRepository class will provide high level functions for the ......
Read more >
TypeORM Relations Tutorial - FULL details! - YouTube
We're going to cover all the typical table relationships you might ... them to each other 36:00 - Querying entities with their relations ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found