mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
lib,test: use regular expression literals
Replace RegExp constructors with regular expression literals where possible. PR-URL: https://github.com/nodejs/node/pull/12807 Backport-PR-URL: https://github.com/nodejs/node/pull/13776 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
99da83b54d
commit
ef133b36c5
4 files changed
+8
-10
No files matched your search
@@ -984,8 +984,8 @@ Buffer.poolSize = ps;
|
||||
assert.throws(() => Buffer.allocUnsafe(10).copy(),
|
||||
/TypeError: argument should be a Buffer/);
|
||||
|
||||
const regErrorMsg = new RegExp('First argument must be a string, Buffer, ' +
|
||||
'ArrayBuffer, Array, or array-like object.');
|
||||
const regErrorMsg =
|
||||
/First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object\./;
|
||||
|
||||
assert.throws(() => Buffer.from(), regErrorMsg);
|
||||
assert.throws(() => Buffer.from(null), regErrorMsg);
|
||||
|
||||
@@ -33,10 +33,9 @@ fork(__filename, opts)
|
||||
assert.strictEqual(status, 0, 'client did not succeed in connecting');
|
||||
}))
|
||||
.on('close', common.mustCall(function() {
|
||||
assert(stderr.match(new RegExp(
|
||||
'Warning: Ignoring extra certs from.*no-such-file-exists' +
|
||||
'.* load failed:.*No such file or directory'
|
||||
)), stderr);
|
||||
assert(stderr.match(
|
||||
/Warning: Ignoring extra certs from.*no-such-file-exists.* load failed:.*No such file or directory/
|
||||
), stderr);
|
||||
}))
|
||||
.stderr.setEncoding('utf8').on('data', function(str) {
|
||||
stderr += str;
|
||||
|
||||
@@ -8,8 +8,8 @@ if (!common.hasCrypto) {
|
||||
const assert = require('assert');
|
||||
const tls = require('tls');
|
||||
const fs = require('fs');
|
||||
const errorMessageRegex = new RegExp('^Error: error:0B080074:x509 ' +
|
||||
'certificate routines:X509_check_private_key:key values mismatch$');
|
||||
const errorMessageRegex =
|
||||
/^Error: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch$/;
|
||||
|
||||
const options = {
|
||||
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
|
||||
|
||||
@@ -4,8 +4,7 @@ require('../common');
|
||||
const assert = require('assert');
|
||||
const inherits = require('util').inherits;
|
||||
const errCheck =
|
||||
new RegExp('^TypeError: The super constructor to "inherits" must not be ' +
|
||||
'null or undefined$');
|
||||
/^TypeError: The super constructor to "inherits" must not be null or undefined$/;
|
||||
|
||||
|
||||
// super constructor
|
||||
|
||||
Reference in new issue
Block a user