Socket
Socket
Sign inDemoInstall

karma-jasmine-diff-reporter

Package Overview
Dependencies
142
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 2.0.0

3

demo/setup/karma.conf.js

@@ -65,4 +65,3 @@ 'use strict';

pretty: true,
multiline: true,
legacy: true
multiline: true
}

@@ -69,0 +68,0 @@

@@ -50,19 +50,12 @@ 'use strict';

// Inject patch to bring back legacy diffs for objects,
// if respective option is turned on in settings.
// Inject patch to bring back legacy diffs for objects after Jasmine 2.6
var utilPatchPath = path.join(__dirname, 'src', 'karma-jasmine', 'util-patch.js');
var reporterConfig = defaults(config.jasmineDiffReporter || {}, {
legacy: false
config.files.splice(index + 3, 0, {
pattern: utilPatchPath,
included: true,
served: true,
watched: false
});
if (reporterConfig.legacy) {
config.files.splice(index + 3, 0, {
pattern: utilPatchPath,
included: true,
served: true,
watched: false
});
}
}

@@ -69,0 +62,0 @@

{
"name": "karma-jasmine-diff-reporter",
"version": "1.2.1",
"version": "2.0.0",
"description": "Diff and pretty print for failed tests",

@@ -20,9 +20,9 @@ "main": "index.js",

"dependencies": {
"diff": "^1.4.0",
"chalk": "^1.1.0",
"chalk": "^2.4.1",
"diff": "^3.5.0",
"karma": ">=0.9"
},
"devDependencies": {
"eslint": "^3.14.1",
"eslint-config-airbnb-es5": "^1.1.0",
"eslint": "^5.6.1",
"eslint-config-airbnb-es5": "^1.2.0",
"eslint-config-es5": "^0.5.0",

@@ -33,4 +33,4 @@ "jasmine-core": "*",

"karma-jasmine": "*",
"tap-min": "^1.1.0",
"tape": "^4.5.1"
"tap-min": "^1.2.2",
"tape": "^4.9.1"
},

@@ -37,0 +37,0 @@ "scripts": {

@@ -10,3 +10,3 @@ karma-jasmine-diff-reporter [![Build status](https://travis-ci.org/mradionov/karma-jasmine-diff-reporter.svg?branch=master)](https://travis-ci.org/mradionov/karma-jasmine-diff-reporter)

The goal of the reporter is to add user-friendly diff highlighting for complex nested structures. Jasmine 2.6 introduced it's own solution for such a case and now has it out-of-the-box. Reporter is relying on the actual console output and since it has changed, reporter can't work correctly any more. If you are fine with Jasmine 2.6+ output, then the reporter won't be very useful. If you want to use the reporter instead of built-in Jasmine solution, make sure to set an option `legacy: true` in reporter options ([docs](#legacy)), which will enforce the console output to Jasmine prior 2.6, so the reporter could work with it and highlight the results.
The goal of the reporter is to add user-friendly diff highlighting for complex nested structures. Jasmine 2.6 introduced it's own solution, which conflicts with the reporter original intent. When used, reporter will override Jasmine output in order to enchance it.

@@ -84,3 +84,2 @@ ## Install

verbose: true,
legacy: false,
matchers: {}

@@ -150,15 +149,3 @@ }

#### legacy
Jasmine 2.6 introduced built-in diffs for objects. Reporter can't work with those diffs at the moment, so they are simply displayed without any highlights.
Disabled by default, which means Jasmine built-in diffs are respected.
If you want to bring back old diffs and reporter highlighting as well, turn this option on.
```js
legacy: true
```
#### matchers

@@ -193,5 +180,6 @@

- jasmine 2.x
- karma 0.9+
- karma-jasmine 0.3+
- node.js >= 6
- jasmine >= 2
- karma >= 0.9
- karma-jasmine >= 0.3

@@ -198,0 +186,0 @@ ## Pitfalls

@@ -15,7 +15,2 @@ 'use strict';

) {
// Do not highlight Jasmine 2.6 diff unless legacy option is on
if (!options.legacy) {
return diff.passthru(expectedValue, actualValue, highlighter, options);
}
// Different types

@@ -22,0 +17,0 @@ if (expectedValue.type !== actualValue.type) {

@@ -7,3 +7,2 @@ (function (window) {

// as before.
// This patch is only applied if reporter "legacy" option is set to "true".

@@ -16,2 +15,7 @@ window.jasmine.matchersUtil = matchersUtilPatched(window.jasmine);

// Below Jasmine 2.6 there is no NullDiffBuilder class
if (typeof j$.NullDiffBuilder === 'undefined') {
return util;
}
var newEquals = function (a, b, customTesters, diffBuilder) {

@@ -18,0 +22,0 @@ return oldEquals(a, b, customTesters, j$.NullDiffBuilder());

@@ -155,3 +155,6 @@ 'use strict';

values.push(value.trim());
var trimmedLastValue = value.trim();
if (trimmedLastValue.length > 0) {
values.push(trimmedLastValue);
}

@@ -158,0 +161,0 @@ return values;

@@ -23,2 +23,8 @@ 'use strict';

if (value.children.length === 0) {
if (options.pretty) {
diff += '\n';
}
}
return diff;

@@ -25,0 +31,0 @@ },

@@ -48,2 +48,8 @@ 'use strict';

if (value.children.length === 0) {
if (options.pretty) {
diff += '\n';
}
}
return diff;

@@ -50,0 +56,0 @@ },

@@ -14,3 +14,2 @@ 'use strict';

options.format = options.format || {};
options.format.legacy = typeof options.format.legacy === 'undefined' ? true : false;
options.highlighter = options.highlighter || {};

@@ -17,0 +16,0 @@

@@ -104,3 +104,3 @@ 'use strict';

);
);

@@ -107,0 +107,0 @@ test('functions by ref',

@@ -66,1 +66,6 @@ 'use strict';

);
test('empty array',
'Expected [ ] to equal [ 1 ].',
'Expected [ ] to equal [ <e>1</e> ].'
);

@@ -81,1 +81,6 @@ 'use strict';

);
test('empty object',
'Expected Object({ }) to equal Object({ foo: 42 }).',
'Expected Object({ }) to equal Object({ <e>foo: 42</e> }).'
);

@@ -334,1 +334,27 @@ 'use strict';

);
test('empty object',
'Expected Object({ }) to equal Object({ foo: 42 }).',
'Expected Object({\n' +
'\n' +
'}) to equal Object({\n' +
' <e>foo: 42</e>\n' +
'}).',
{ format: { pretty: true } }
);
test('empty array',
'Expected [ ] to equal [ 1 ].',
'Expected [\n' +
'\n' +
'] to equal [\n' +
' <e>1</e>\n' +
'].',
{ format: { pretty: true } }
);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc