Skip to content

Commit

Permalink
fix to work SpyOn in Jasmine (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
knight9999 authored and erisu committed Mar 19, 2019
1 parent a895e80 commit f626923
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@
const fs = require('fs');
const path = require('path');
const rewire = require('rewire');
/*
After Cordova-Common 3.1.0, logger[level] property becomes not writable.
Therefore we re-define addLevel function here to use SpyOn logger[level]
*/
const CordovaLogger = require('cordova-common').CordovaLogger;
CordovaLogger.prototype.addLevel = function (level, severity, color) {
this.levels[level] = severity;
if (color) {
this.colors[level] = color;
}
// Define own method with corresponding name
if (!this[level]) {
this[level] = this.log.bind(this, level);
}
return this;
};
const { events, cordova } = require('cordova-lib');
const logger = require('cordova-common').CordovaLogger.get();
const telemetry = require('../src/telemetry');
Expand Down

0 comments on commit f626923

Please sign in to comment.