Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address deepEqual using compare by JSON strings. #724

Merged
merged 2 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions papaparse.js
Original file line number Diff line number Diff line change
Expand Up @@ -1358,12 +1358,15 @@ License: MIT

function addError(type, code, msg, row)
{
_results.errors.push({
var error = {
type: type,
code: code,
message: msg,
row: row
});
message: msg
};
if(row !== undefined) {
error.row = row;
}
_results.errors.push(error);
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/test-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ describe('Core Parser Tests', function() {
function generateTest(test) {
(test.disabled ? it.skip : it)(test.description, function() {
var actual = new Papa.Parser(test.config).parse(test.input);
assert.deepEqual(JSON.stringify(actual.errors), JSON.stringify(test.expected.errors));
assert.deepEqual(actual.errors, test.expected.errors);
assert.deepEqual(actual.data, test.expected.data);
});
}
Expand Down Expand Up @@ -1475,7 +1475,7 @@ describe('Parse Tests', function() {
if (test.expected.meta) {
assert.deepEqual(actual.meta, test.expected.meta);
}
assert.deepEqual(JSON.stringify(actual.errors), JSON.stringify(test.expected.errors));
assert.deepEqual(actual.errors, test.expected.errors);
assert.deepEqual(actual.data, test.expected.data);
});
}
Expand Down Expand Up @@ -1556,7 +1556,7 @@ describe('Parse Async Tests', function() {
var config = test.config;

config.complete = function(actual) {
assert.deepEqual(JSON.stringify(actual.errors), JSON.stringify(test.expected.errors));
assert.deepEqual(actual.errors, test.expected.errors);
assert.deepEqual(actual.data, test.expected.data);
done();
};
Expand Down Expand Up @@ -2384,7 +2384,7 @@ describe('Custom Tests', function() {
this.timeout(test.timeout);
}
test.run(function(actual) {
assert.deepEqual(JSON.stringify(actual), JSON.stringify(test.expected));
assert.deepEqual(actual, test.expected);
done();
});
});
Expand Down