blanket icon indicating copy to clipboard operation
blanket copied to clipboard

Help creating blanket adapter

Open taromero opened this issue 9 years ago • 0 comments

Hi, I'm developing a testing framework for MeteorJS and I would like to add an adapter for blanket.

I'm still failing to create the adapter, even after going through the docs about creating an adapter:

  • https://github.com/alex-seville/blanket/blob/master/docs/advanced_browser.md#adapters
  • https://raw.githubusercontent.com/alex-seville/blanket/master/src/adapters/mocha-blanket.js

I'm doing the following:

blanket = Npm.require('blanket')({
  "data-cover-flags":{
    "engineOnly":true
  }
})

blanket.beforeStartTestRunner({
  callback: function(){
    console.log('blankettt')
    T.run()
  }
})

T.run = function() {
  blanket.setupCoverage()
  blanket.onTestStart()
  // code to run tests
  blanket.onTestDone(1, true)
  blanket.onTestsDone()
}

I'm facing 2 different errors, depending on the presence of the blanket.beforeStartTestRunner call:

  1. If I call beforeStartTestRunner, I get TypeError: Object #<Object> has no method 'beforeStartTestRunner'.
  2. If I don't call it, I get TypeError: Cannot convert null to object, at blanket.js:319 Object.blanket._blanket.onTestsDone.

When I print the blanket object (to look for the beforeStartTestRunner), I get:

{ noConflict: [Function],
  _getCopyNumber: [Function],
  extend: [Function],
  _extend: [Function],
  getCovVar: [Function],
  options: [Function],
  instrument: [Function],
  _trackingArraySetup: [],
  _branchingArraySetup: [],
  _prepareSource: [Function],
  _trackingSetup: [Function],
  _blockifyIf: [Function],
  _trackBranch: [Function],
  _addTracking: [Function],
  _checkDefs: [Function],
  setupCoverage: [Function],
  _checkIfSetup: [Function],
  onTestStart: [Function],
  onTestDone: [Function],
  onModuleStart: [Function],
  onTestsDone: [Function],
  normalizeBackslashes: [Function],
  restoreNormalLoader: [Function],
  restoreBlanketLoader: [Function],
  matchPattern: [Function] }

I would appreciate any help on the subject, as we don't have code coverage tools currently available for the Meteor platform.

Thanks in advance!

taromero avatar Jul 26 '15 23:07 taromero