Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
asthajn opened this issue Apr 4, 2019 · 0 comments

Comments

@asthajn
Copy link

asthajn commented Apr 4, 2019

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 (

); }
}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant