Page MenuHomePhabricator

Don't define abstract methods but instead leave them defined as null
Closed, DuplicatePublic

Description

In VE we fake abstract methods using

MyClass.prototype.myMethod = function() {
    throw new Error( 'Sub-class must implement myMethod' );
}

But these count as uncovered code in the Istanbul report. I don't think it makes sense to test these as they provide no functionality, so to count them as covered would be wrong too. They should just be ignored.
We could ignore them with /* istanbul ignore next */ but there may be a cleaner way that uses our existing comment blocks?

Event Timeline

Esanders created this task.Apr 8 2015, 11:20 AM
Esanders raised the priority of this task from to Needs Triage.
Esanders updated the task description. (Show Details)
Esanders added a project: VisualEditor.
Esanders added subscribers: Esanders, Krinkle.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 8 2015, 11:20 AM
Jdforrester-WMF triaged this task as Normal priority.Apr 8 2015, 11:22 AM
Jdforrester-WMF set Security to None.
Jdforrester-WMF moved this task from To Triage to Freezer on the VisualEditor board.
Jdforrester-WMF renamed this task from Ignore abstract methods in code coverage reports to Don't define abstract methods but instead leave them defined as null.Apr 9 2015, 2:47 PM
Jdforrester-WMF claimed this task.