Skip to content

meteor mocha test coverage not covering export class methods e.g. render() #82

Open
@asthajn

Description

@asthajn

I am using enzyme for testing. Mount/Shallow test cases are passing but coverage is not increasing.

Expected Behavior

When a test case passes, the coverage should increase.

Current Behavior

Instead only lines are increasing and coverage % is going down

Possible Solution

Is there a possible miss in the configuration file?

Steps to Reproduce (for bugs)

My project is very basic

  1. create meteor app, remove blaze templates, add static-html
  2. Add babel-instanbul to package.json
  3. SET Environment variables: BABEL_ENV=COVERAGE COVERAGE=1 COVERAGE_VERBOSE=1 COVERAGE_APP_FOLDER= TEST_WATCH=1
  4. meteor test --driver-package meteortesting:mocha

Context

Only the global variables and functions are affecting coverage percentage, nothing inside the class is changing coverage. Neither functions, nor statements

Your Environment

Node- v8.11.4
Meteor- 1.9.3
Meteortesting:mocha - 1.1.2
lmieulet:[email protected]

  • Operating System and version:
    windows server 2012 R2 standard

I cannot copy screenshot due to internet restriction - Here's the code snippet and test case snippets
Tests Passing
should call testFunc ‣
testFunc();

should render mount ‣
const wrapper = mount(React.createElement(AppView, null));
expect(wrapper.instance().testFunc2()).to.equal(36);


************** Code Snippet ************************
//Function out of the class - gloal context
export const testFunc = () => { const a = 2 const b = 34 const c = a+b console.log("c") }  

//class
export default class AppView extends Component {  
//function that passes test case
testFunc2() { const a = 2 const b = 34 const c = a+b console.log("c") return c }

//mount test cases pass
render() { return (

); }
}


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