0.0.2 • Published 9 years ago

vui-karma-json-log-reporter v0.0.2

Weekly downloads
6
License
Apache-2.0
Repository
github
Last release
9 years ago

vui-karma-json-log-reporter

NPM version Build status

A simple Karma reporter for logging json messages from matchers and specs.

Installation

Install from NPM:

npm install vui-karma-json-log-reporter

Usage

Required Karma configuration includes typical wire-up via Karma plug-ins and reporters, and optionally specifying the destination path for JSON output:

{
	"jsonLogReporter": {
		"outputPath": "test/some/path/"
	},
	"plugins": [
		"vui-karma-json-log-reporter"
	],
	"reporters": ["json-log"]
}

JSON logged via console.log and window.dump is sent to the default JSON file 'logFile_timestamp.json'.

window.dump( JSON.stringify( obj ) );

console.log( JSON.stringify( obj ) );

Alternatively, if an object is provided with a name and object, the object is logged to a file according to the specified name, ex. 'myObjectName.json'.

var obj = {
	'name': 'myObjectName',
	'object': objectToLog
};

window.dump( JSON.stringify( obj ) );

Note: if the target file exists with an object, the new object is merged with the existing object and the existing file is updated.