UNPKG

karma-story-reporter

Version:

A Karma plugin. Report results in BDD-style story format.

26 lines (22 loc) 829 B
/* global jasmine */ // Data provider code function using(name, values, func) { 'use strict'; for (var i = 0, count = values.length; i < count; i++) { if (Object.prototype.toString.call(values[i]) !== '[object Array]') { values[i] = [values[i]]; } func.apply(this, values[i]); var valuesDescription = JSON.stringify(values[i]); if (!(typeof process !== "undefined" && process.ENV && process.ENV.TERM)) { var maxDescriptionLength = 35; if (valuesDescription.length > maxDescriptionLength) { valuesDescription = valuesDescription.substr(0, maxDescriptionLength) + '...'; } } var currentSpec; if (currentSpec = jasmine.getEnv().currentSpec) { currentSpec.description += ' ("' + name + '": ' + valuesDescription + ')'; } } }