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

Fix test failures when running on older versions of mocha #159

Merged
merged 1 commit into from
Jan 12, 2022
Merged
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
7 changes: 5 additions & 2 deletions test/mocha-junit-reporter-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,16 @@ describe('mocha-junit-reporter', function() {
}));

runRunner(reporter.runner, function() {
reporter.runner.dispose();
if (reporter.runner.dispose) {
reporter.runner.dispose();
}

expect(reporter._testsuites).to.have.lengthOf(2);
expect(reporter._testsuites[1].testsuite[0]._attr.name).to.equal('failing with Chai');
expect(reporter._testsuites[1].testsuite[1].testcase).to.have.lengthOf(2);
expect(reporter._testsuites[1].testsuite[1].testcase[0]._attr.name).to.equal('failing with Chai test 1');
expect(reporter._testsuites[1].testsuite[1].testcase[1].failure._attr.message).to.equal('expected {} to deeply equal { missingProperty: true }');
expect(reporter._testsuites[1].testsuite[1].testcase[1].failure._cdata).to.match(/AssertionError: expected {} to deeply equal {\s*missingProperty:\s*true\s*}\n(?:\s* at .*? \(.*?\)\n)*\n\s*\+ expected - actual\n\s*-{}\n\s*\+{\n\s*\+\s*"missingProperty":\s*true\n\s*\+}[\s\S]*/);
expect(reporter._testsuites[1].testsuite[1].testcase[1].failure._cdata).to.match(/AssertionError: expected {} to deeply equal {\s*missingProperty:\s*true\s*}\n(?:\s* at .*?\n)*\n\s*\+ expected - actual\n+\s*-{}\n\s*\+{\n\s*\+\s*"missingProperty":\s*true\n\s*\+}[\s\S]*/);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping the requirement for enclosing parentheses in the stack frames since that's not consistent in all versions.

done();
});
});
Expand Down