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

Improve test-tls-key-mismatch.js #12011

Closed
Closed
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
4 changes: 3 additions & 1 deletion test/parallel/test-tls-key-mismatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ if (!common.hasCrypto) {
const assert = require('assert');
const tls = require('tls');
const fs = require('fs');
const errorMessageRegex = new RegExp('^Error: error:0B080074:x509 ' +
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible write this in a way that involves less line-breaking? Its all unused whitespace ATM :-(. Maybe put the msg string as its own line, const msg = 'error:0B....';? Or wrapping the entire argument to RegExp() to the next line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sam-github The error message is too long to fit within 80 cols. I'll see if I can condense it to two lines instead of three & then update the PR accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sam-github FWIW, the 80 col rule came from eslint, not me.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks. if that is as good as it can be, so it goes, but thanks for trying

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sam-github I've condensed it to two lines & updated the PR.

'certificate routines:X509_check_private_key:key values mismatch$');

const options = {
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
Expand All @@ -37,4 +39,4 @@ const options = {

assert.throws(function() {
tls.createSecureContext(options);
});
}, errorMessageRegex);