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

coverage-all option triggers TypeError: Cannot set property 'source' of undefined #945

Closed
federicojasson opened this issue Sep 25, 2019 · 0 comments
Assignees
Labels
bug
Milestone

Comments

@federicojasson
Copy link

@federicojasson federicojasson commented Sep 25, 2019

Error description

When the option coverage-all is enabled, an error is triggered if tests don't include any of the source files. This doesn't happen when coverage-all is set to false.

Versions

  • node: 10.15.3.
  • npm: 6.4.1.
  • @hapi/lab: 20.3.2.

Reproduce the error

Folder structure:

├── .labrc.js
├── package.json
├── src
│   └── empty.js
└── test
    └── empty.test.js

.labrc.js:

module.exports = {
  "coverage": true,
  "coverage-all": true
};

package.json:

{
  "scripts": {
    "test": "lab test"
  },
  "devDependencies": {
    "@hapi/lab": "^20.3.2"
  }
}

src/empty.js:

// Empty file

test/empty.test.js:

// No src includes
const { describe, it } = exports.lab = require('@hapi/lab').script();

describe('some description', () => {
  it('some test', () => {
    console.log('noop');
  })
});

Execution:

npm install
npm test

Output:

TypeError: Cannot set property 'source' of undefined
@federicojasson federicojasson changed the title `coverage-all` option triggers a `TypeError: Cannot set property 'source' of undefined` error coverage-all option triggers TypeError: Cannot set property 'source' of undefined Sep 25, 2019
@hueniverse hueniverse self-assigned this Sep 27, 2019
@hueniverse hueniverse added the bug label Oct 4, 2019
@hueniverse hueniverse added this to the 20.3.3 milestone Oct 4, 2019
@hueniverse hueniverse closed this in ba096b5 Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.