From b828719494c775c6156b651721f350f965d278a4 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sun, 22 Apr 2018 18:54:21 +0300 Subject: [PATCH] doc, lib, test, tools: eliminate quote escaping Refs: https://eslint.org/docs/rules/quotes --- .eslintrc.js | 5 +- doc/api/assert.md | 2 +- doc/api/console.md | 2 +- doc/api/fs.md | 2 +- doc/api/util.md | 2 +- doc/guides/using-internal-errors.md | 2 +- lib/_http_server.js | 2 +- lib/events.js | 2 +- lib/internal/errors.js | 2 +- lib/internal/modules/cjs/loader.js | 2 +- lib/repl.js | 2 +- test/addons-napi/test_promise/test.js | 2 +- test/addons-napi/test_string/test.js | 2 +- test/addons/load-long-path/test.js | 2 +- test/addons/node-module-version/test.js | 2 +- test/addons/repl-domain-abort/test.js | 2 +- test/common/index.js | 2 +- test/fixtures/url-searchparams.js | 2 +- test/parallel/test-assert-deep.js | 4 +- test/parallel/test-assert-fail-deprecation.js | 4 +- test/parallel/test-assert.js | 6 +- test/parallel/test-cli-eval.js | 4 +- .../test-cluster-net-listen-relative-path.js | 2 +- test/parallel/test-crypto-binary-default.js | 4 +- test/parallel/test-crypto-hash.js | 4 +- ...n-throw-from-uncaught-exception-handler.js | 4 +- test/parallel/test-errors-systemerror.js | 2 +- test/parallel/test-eslint-inspector-check.js | 2 +- ...est-eslint-lowercase-name-for-primitive.js | 20 ++- .../test-eslint-prefer-util-format-errors.js | 10 +- test/parallel/test-eslint-require-buffer.js | 6 +- .../test-eval-strict-referenceerror.js | 4 +- test/parallel/test-fs-error-messages.js | 4 +- test/parallel/test-fs-whatwg-url.js | 8 +- test/parallel/test-fs-write-stream.js | 2 +- test/parallel/test-http-date-header.js | 2 +- .../parallel/test-http-invalidheaderfield2.js | 2 +- test/parallel/test-http-set-trailers.js | 2 +- test/parallel/test-http-upgrade-client2.js | 2 +- test/parallel/test-http-upgrade-server2.js | 2 +- ....parse-only-support-http-https-protocol.js | 2 +- test/parallel/test-internal-errors.js | 8 +- .../test-loaders-hidden-from-users.js | 4 +- .../parallel/test-module-circular-symlinks.js | 6 +- test/parallel/test-module-loading-error.js | 4 +- .../test-module-symlinked-peer-modules.js | 4 +- .../test-promises-unhandled-rejections.js | 4 +- test/parallel/test-querystring.js | 8 +- test/parallel/test-repl-colors.js | 1 - test/parallel/test-repl-persistent-history.js | 6 +- .../parallel/test-repl-pretty-custom-stack.js | 4 +- test/parallel/test-repl-pretty-stack.js | 4 +- test/parallel/test-repl-require.js | 2 +- test/parallel/test-repl-tab-complete.js | 10 +- test/parallel/test-repl-use-global.js | 2 +- test/parallel/test-repl.js | 71 +++++----- test/parallel/test-stdout-close-catch.js | 2 +- test/parallel/test-stream-pipe-await-drain.js | 4 +- test/parallel/test-timers-refresh.js | 2 +- .../test-tls-check-server-identity.js | 54 ++++---- test/parallel/test-url-parse-format.js | 14 +- test/parallel/test-util-format.js | 40 +++--- test/parallel/test-util-inspect.js | 124 +++++++++--------- test/parallel/test-vm-context.js | 2 +- .../test-vm-new-script-new-context.js | 8 +- .../test-vm-new-script-this-context.js | 4 +- test/parallel/test-vm-run-in-new-context.js | 6 +- test/parallel/test-vm-static-this.js | 8 +- test/parallel/test-vm-syntax-error-message.js | 2 +- test/parallel/test-vm-timeout.js | 2 +- .../test-zlib-unzip-one-byte-chunks.js | 2 +- test/pseudo-tty/test-tty-isatty.js | 2 +- test/pummel/test-crypto-dh.js | 6 +- test/pummel/test-exec.js | 2 +- test/sequential/test-inspector-debug-end.js | 6 +- test/sequential/test-module-loading.js | 6 +- tools/doc/json.js | 4 +- tools/eslint-rules/inspector-check.js | 2 +- tools/eslint-rules/non-ascii-character.js | 6 +- tools/eslint-rules/require-buffer.js | 2 +- 80 files changed, 288 insertions(+), 301 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 53d0b39d0aea44..3affe10c0d69d9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -214,7 +214,10 @@ module.exports = { 'one-var-declaration-per-line': 'error', 'operator-linebreak': ['error', 'after'], 'prefer-const': ['error', { ignoreReadBeforeAssign: true }], - 'quotes': ['error', 'single', { avoidEscape: true }], + 'quotes': ['error', 'single', { + avoidEscape: true, + allowTemplateLiterals: true + }], 'quote-props': ['error', 'consistent'], 'rest-spread-spacing': 'error', 'semi': 'error', diff --git a/doc/api/assert.md b/doc/api/assert.md index 62c96801d34ffd..4899658997c121 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -883,7 +883,7 @@ assert.ok(); // throws: // "AssertionError: No value argument passed to `assert.ok`. -assert.ok(false, 'it\'s false'); +assert.ok(false, "it's false"); // throws "AssertionError: it's false" // In the repl: diff --git a/doc/api/console.md b/doc/api/console.md index 28dd0b854b2bd0..4ef07169905b99 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -144,7 +144,7 @@ used as the error message. ```js console.assert(true, 'does nothing'); // OK -console.assert(false, 'Whoops %s work', 'didn\'t'); +console.assert(false, 'Whoops %s work', "didn't"); // Assertion failed: Whoops didn't work ``` diff --git a/doc/api/fs.md b/doc/api/fs.md index a80a5efcb42f87..df37479bfa1259 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1419,7 +1419,7 @@ Then call the `callback` argument with either true or false. Example: ```js fs.exists('/etc/passwd', (exists) => { - console.log(exists ? 'it\'s there' : 'no passwd!'); + console.log(exists ? "it's there" : 'no passwd!'); }); ``` diff --git a/doc/api/util.md b/doc/api/util.md index e8f97397d30b27..30a98a4889b9f1 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -104,7 +104,7 @@ The `section` supports wildcard also: const util = require('util'); const debuglog = util.debuglog('foo-bar'); -debuglog('hi there, it\'s foo-bar [%d]', 2333); +debuglog("hi there, it's foo-bar [%d]", 2333); ``` if it is run with `NODE_DEBUG=foo*` in the environment, then it will output diff --git a/doc/guides/using-internal-errors.md b/doc/guides/using-internal-errors.md index d22fc68e0f34c4..11a4fcfa77d895 100644 --- a/doc/guides/using-internal-errors.md +++ b/doc/guides/using-internal-errors.md @@ -107,7 +107,7 @@ message string. A simple example is: // Test ERR_TLS_CERT_ALTNAME_INVALID assert.strictEqual( errors.message('ERR_TLS_CERT_ALTNAME_INVALID', ['altname']), - 'Hostname/IP does not match certificate\'s altnames: altname'); + "Hostname/IP does not match certificate's altnames: altname"); ``` In addition, there should also be tests which validate the use of the diff --git a/lib/_http_server.js b/lib/_http_server.js index c3abfd37bb5887..9abcc327805d56 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -93,7 +93,7 @@ const STATUS_CODES = { 415: 'Unsupported Media Type', 416: 'Range Not Satisfiable', 417: 'Expectation Failed', - 418: 'I\'m a teapot', // RFC 2324 + 418: "I'm a teapot", // RFC 2324 421: 'Misdirected Request', 422: 'Unprocessable Entity', // RFC 4918 423: 'Locked', // RFC 4918 diff --git a/lib/events.js b/lib/events.js index 46d1223e69a4bf..f26ba6c3849b14 100644 --- a/lib/events.js +++ b/lib/events.js @@ -123,7 +123,7 @@ function longestSeqContainedIn(a, b) { } function enhanceStackTrace(err, own) { - const sep = '\nEmitted \'error\' event at:\n'; + const sep = "\nEmitted 'error' event at:\n"; const errStack = err.stack.split('\n').slice(1); const ownStack = own.stack.split('\n').slice(1); diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 09f58506c44ea0..a731e543f86aea 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -982,7 +982,7 @@ E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode', Error); E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error); E('ERR_SYSTEM_ERROR', 'A system error occurred', SystemError); E('ERR_TLS_CERT_ALTNAME_INVALID', - 'Hostname/IP does not match certificate\'s altnames: %s', Error); + "Hostname/IP does not match certificate's altnames: %s", Error); E('ERR_TLS_DH_PARAM_SIZE', 'DH parameter size %s is less than 2048', Error); E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout', Error); E('ERR_TLS_RENEGOTIATION_DISABLED', diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 652378ad5782fb..1ddd485fb95a70 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -271,7 +271,7 @@ Module._findPath = function(request, paths, isMain) { if (!warned) { warned = true; process.emitWarning( - 'warning: require(\'.\') resolved outside the package ' + + "warning: require('.') resolved outside the package " + 'directory. This functionality is deprecated and will be removed ' + 'soon.', 'DeprecationWarning', 'DEP0019'); diff --git a/lib/repl.js b/lib/repl.js index a7977dc72fb781..6b63cde50aa7d7 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -1539,7 +1539,7 @@ function isCodeRecoverable(code) { } } else { if (current.trim()) prevTokenChar = current; - if (current === '\'' || current === '"') { + if (current === "'" || current === '"') { stringLiteral = current; } } diff --git a/test/addons-napi/test_promise/test.js b/test/addons-napi/test_promise/test.js index 477ceb75969d51..845decb964c32a 100644 --- a/test/addons-napi/test_promise/test.js +++ b/test/addons-napi/test_promise/test.js @@ -23,7 +23,7 @@ common.crashOnUnhandledRejection(); // A rejection { - const expected_result = 'It\'s not you, it\'s me.'; + const expected_result = "It's not you, it's me."; const promise = test_promise.createPromise(); promise.then( common.mustNotCall(), diff --git a/test/addons-napi/test_string/test.js b/test/addons-napi/test_string/test.js index 5ce3d739c7a941..3d7ede4f89da83 100644 --- a/test/addons-napi/test_string/test.js +++ b/test/addons-napi/test_string/test.js @@ -32,7 +32,7 @@ assert.strictEqual(test_string.TestUtf16Insufficient(str2), str2.slice(0, 3)); assert.strictEqual(test_string.Utf16Length(str2), 62); assert.strictEqual(test_string.Utf8Length(str2), 62); -const str3 = '?!@#$%^&*()_+-=[]{}/.,<>\'"\\'; +const str3 = `?!@#$%^&*()_+-=[]{}/.,<>'"\\`; assert.strictEqual(test_string.TestLatin1(str3), str3); assert.strictEqual(test_string.TestUtf8(str3), str3); assert.strictEqual(test_string.TestUtf16(str3), str3); diff --git a/test/addons/load-long-path/test.js b/test/addons/load-long-path/test.js index ee09230676b5e8..212365f76507f8 100644 --- a/test/addons/load-long-path/test.js +++ b/test/addons/load-long-path/test.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../../common'); if (common.isWOW64) - common.skip('doesn\'t work on WOW64'); + common.skip("doesn't work on WOW64"); const fs = require('fs'); const path = require('path'); diff --git a/test/addons/node-module-version/test.js b/test/addons/node-module-version/test.js index 002e38134d76b6..e6a51c32389f9f 100644 --- a/test/addons/node-module-version/test.js +++ b/test/addons/node-module-version/test.js @@ -4,7 +4,7 @@ const common = require('../../common'); const assert = require('assert'); const re = new RegExp( - '^Error: The module \'.+\'\n' + + "^Error: The module '.+'\n" + 'was compiled against a different Node\\.js version using\n' + 'NODE_MODULE_VERSION 42\\. This version of Node\\.js requires\n' + `NODE_MODULE_VERSION ${process.versions.modules}\\. ` + diff --git a/test/addons/repl-domain-abort/test.js b/test/addons/repl-domain-abort/test.js index 2049fe6e6a23f5..c51be62b9202cc 100644 --- a/test/addons/repl-domain-abort/test.js +++ b/test/addons/repl-domain-abort/test.js @@ -41,7 +41,7 @@ const lines = [ `require('${buildPath}')` + // Log output to double check callback ran. '.method(function(v1, v2) {' + - 'console.log(\'cb_ran\'); return v1 === true && v2 === false; });', + "console.log('cb_ran'); return v1 === true && v2 === false; });", ]; const dInput = new stream.Readable(); diff --git a/test/common/index.js b/test/common/index.js index 7df3907f0e7174..d4fd0550e97279 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -162,7 +162,7 @@ Object.defineProperty(exports, 'localhostIPv4', { if (process.env.LOCALHOST) { localhostIPv4 = process.env.LOCALHOST; } else { - console.error('Looks like we\'re in a FreeBSD Jail. ' + + console.error("Looks like we're in a FreeBSD Jail. " + 'Please provide your default interface address ' + 'as LOCALHOST or expect some tests to fail.'); } diff --git a/test/fixtures/url-searchparams.js b/test/fixtures/url-searchparams.js index 918af678bc563e..c5001915e870a8 100644 --- a/test/fixtures/url-searchparams.js +++ b/test/fixtures/url-searchparams.js @@ -11,7 +11,7 @@ module.exports = [ [ "my%20weird%20field=q1!2%22'w%245%267%2Fz8)%3F", 'my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F', - [['my weird field', 'q1!2"\'w$5&7/z8)?']] + [['my weird field', `q1!2"'w$5&7/z8)?`]] ], ['foo%3Dbaz=bar', 'foo%3Dbaz=bar', [['foo=baz', 'bar']]], ['foo=baz=bar', 'foo=baz%3Dbar', [['foo', 'baz=bar']]], diff --git a/test/parallel/test-assert-deep.js b/test/parallel/test-assert-deep.js index 4fa091ef2af96c..0ddf2d48542720 100644 --- a/test/parallel/test-assert-deep.js +++ b/test/parallel/test-assert-deep.js @@ -666,7 +666,7 @@ assert.deepEqual(4, '4'); assert.deepEqual(true, 1); assert.throws(() => assert.deepEqual(4, '5'), AssertionError, - 'deepEqual( 4, \'5\')'); + "deepEqual( 4, '5')"); // Having the same number of owned properties && the same set of keys. assert.deepEqual({ a: 4 }, { a: 4 }); @@ -901,7 +901,7 @@ assert.throws(() => assert.deepStrictEqual(new Boolean(true), {}), () => assert.deepStrictEqual(a, b), { message: `${defaultMsgStart}\n\n` + - ' [TypeError: foo] {\n- foo: \'bar\'\n+ foo: \'baz\'\n }' + " [TypeError: foo] {\n- foo: 'bar'\n+ foo: 'baz'\n }" } ); } diff --git a/test/parallel/test-assert-fail-deprecation.js b/test/parallel/test-assert-fail-deprecation.js index 68ebcd612d31df..419f4fe3f5abf2 100644 --- a/test/parallel/test-assert-fail-deprecation.js +++ b/test/parallel/test-assert-fail-deprecation.js @@ -16,7 +16,7 @@ assert.throws(() => { }, { code: 'ERR_ASSERTION', name: 'AssertionError [ERR_ASSERTION]', - message: '\'first\' != \'second\'', + message: "'first' != 'second'", operator: '!=', actual: 'first', expected: 'second' @@ -48,7 +48,7 @@ assert.throws(() => { }, { code: 'ERR_ASSERTION', name: 'AssertionError [ERR_ASSERTION]', - message: '\'first\' operator \'second\'', + message: "'first' operator 'second'", operator: 'operator', actual: 'first', expected: 'second' diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index b871cd7265d288..8f4d2f434a0b02 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -44,7 +44,7 @@ assert.throws(() => a(false), a.AssertionError, 'ok(false)'); assert.throws(() => a.ok(false), a.AssertionError, 'ok(false)'); a(true); -a('test', 'ok(\'test\')'); +a('test', "ok('test')"); a.ok(true); a.ok('test'); @@ -62,7 +62,7 @@ assert.throws(() => a.notEqual(true, true), a.AssertionError, 'notEqual(true, true)'); assert.throws(() => a.strictEqual(2, '2'), - a.AssertionError, 'strictEqual(2, \'2\')'); + a.AssertionError, "strictEqual(2, '2')"); assert.throws(() => a.strictEqual(null, undefined), a.AssertionError, 'strictEqual(null, undefined)'); @@ -277,7 +277,7 @@ testAssertionMessage(NaN, 'NaN'); testAssertionMessage(Infinity, 'Infinity'); testAssertionMessage(-Infinity, '-Infinity'); testAssertionMessage('', '""'); -testAssertionMessage('foo', '\'foo\''); +testAssertionMessage('foo', "'foo'"); testAssertionMessage([], '[]'); testAssertionMessage([1, 2, 3], '[\n- 1,\n- 2,\n- 3\n- ]'); testAssertionMessage(/a/, '/a/'); diff --git a/test/parallel/test-cli-eval.js b/test/parallel/test-cli-eval.js index 201d5a6a49739b..b6a00a4fccd17e 100644 --- a/test/parallel/test-cli-eval.js +++ b/test/parallel/test-cli-eval.js @@ -204,7 +204,7 @@ child.exec(`${nodejs} --use-strict -p process.execArgv`, ].forEach(function(args) { // Ensure that arguments are successfully passed to eval. - const opt = ' --eval "console.log(process.argv.slice(1).join(\' \'))"'; + const opt = ` --eval "console.log(process.argv.slice(1).join(' '))"`; const cmd = `${nodejs}${opt} -- ${args}`; child.exec(cmd, common.mustCall(function(err, stdout, stderr) { assert.strictEqual(stdout, `${args}\n`); @@ -213,7 +213,7 @@ child.exec(`${nodejs} --use-strict -p process.execArgv`, })); // Ensure that arguments are successfully passed to print. - const popt = ' --print "process.argv.slice(1).join(\' \')"'; + const popt = ` --print "process.argv.slice(1).join(' ')"`; const pcmd = `${nodejs}${popt} -- ${args}`; child.exec(pcmd, common.mustCall(function(err, stdout, stderr) { assert.strictEqual(stdout, `${args}\n`); diff --git a/test/parallel/test-cluster-net-listen-relative-path.js b/test/parallel/test-cluster-net-listen-relative-path.js index ce9ead9e2eb958..bc231f6a88f0ff 100644 --- a/test/parallel/test-cluster-net-listen-relative-path.js +++ b/test/parallel/test-cluster-net-listen-relative-path.js @@ -10,7 +10,7 @@ const tmpdir = require('../common/tmpdir'); if (common.isWindows) common.skip('On Windows named pipes live in their own ' + - 'filesystem and don\'t have a ~100 byte limit'); + "filesystem and don't have a ~100 byte limit"); // Choose a socket name such that the absolute path would exceed 100 bytes. const socketDir = './unix-socket-dir'; diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js index 6cdc894753c3ac..d4eec30443046f 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.js @@ -384,11 +384,11 @@ assert.throws(function() { // Test SHA512 as assumed latin1 assert.strictEqual( a3, - '\u00c1(4\u00f1\u0003\u001fd\u0097!O\'\u00d4C/&Qz\u00d4' + + "\u00c1(4\u00f1\u0003\u001fd\u0097!O'\u00d4C/&Qz\u00d4" + '\u0094\u0015l\u00b8\u008dQ+\u00db\u001d\u00c4\u00b5}\u00b2' + '\u00d6\u0092\u00a3\u00df\u00a2i\u00a1\u009b\n\n*\u000f' + '\u00d7\u00d6\u00a2\u00a8\u0085\u00e3<\u0083\u009c\u0093' + - '\u00c2\u0006\u00da0\u00a1\u00879(G\u00ed\'' + "\u00c2\u0006\u00da0\u00a1\u00879(G\u00ed'" ); assert.deepStrictEqual( diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index f4f7b0dfe55e24..ce2ed776fb990c 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -66,11 +66,11 @@ digest = 'latin1'; assert.deepStrictEqual( a3, Buffer.from( - '\u00c1(4\u00f1\u0003\u001fd\u0097!O\'\u00d4C/&Qz\u00d4' + + "\u00c1(4\u00f1\u0003\u001fd\u0097!O'\u00d4C/&Qz\u00d4" + '\u0094\u0015l\u00b8\u008dQ+\u00db\u001d\u00c4\u00b5}\u00b2' + '\u00d6\u0092\u00a3\u00df\u00a2i\u00a1\u009b\n\n*\u000f' + '\u00d7\u00d6\u00a2\u00a8\u0085\u00e3<\u0083\u009c\u0093' + - '\u00c2\u0006\u00da0\u00a1\u00879(G\u00ed\'', + "\u00c2\u0006\u00da0\u00a1\u00879(G\u00ed'", 'latin1'), `${cryptoType} with ${digest} digest failed to evaluate to expected hash`); cryptoType = 'sha1'; diff --git a/test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js b/test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js index a2afebd838f410..4be7c0e31c0088 100644 --- a/test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js +++ b/test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js @@ -58,9 +58,9 @@ function runTestWithoutAbortOnUncaughtException() { // process' uncaughtException handler. assert(stderr.includes(uncaughtExceptionHandlerErrMsg), 'stderr output must include proper uncaughtException ' + - 'handler\'s error\'s message'); + "handler's error's message"); assert(!stderr.includes(domainErrMsg), - 'stderr output must not include domain\'s error\'s message'); + "stderr output must not include domain's error's message"); assert.notStrictEqual(err.code, 0, 'child process should have exited with a ' + diff --git a/test/parallel/test-errors-systemerror.js b/test/parallel/test-errors-systemerror.js index a74d7b3846f59d..dba8f886218e0d 100644 --- a/test/parallel/test-errors-systemerror.js +++ b/test/parallel/test-errors-systemerror.js @@ -11,7 +11,7 @@ assert.throws( () => { throw new errors.SystemError(); }, { name: 'TypeError', - message: 'Cannot read property \'match\' of undefined' + message: "Cannot read property 'match' of undefined" } ); diff --git a/test/parallel/test-eslint-inspector-check.js b/test/parallel/test-eslint-inspector-check.js index bdec596f8d128e..0c968ed5c70104 100644 --- a/test/parallel/test-eslint-inspector-check.js +++ b/test/parallel/test-eslint-inspector-check.js @@ -7,7 +7,7 @@ const rule = require('../../tools/eslint-rules/inspector-check'); const message = 'Please add a skipIfInspectorDisabled() call to allow this ' + 'test to be skippped when Node is built ' + - '\'--without-inspector\'.'; + "'--without-inspector'."; new RuleTester().run('inspector-check', rule, { valid: [ diff --git a/test/parallel/test-eslint-lowercase-name-for-primitive.js b/test/parallel/test-eslint-lowercase-name-for-primitive.js index 929ff03c656cd6..970bad8565c907 100644 --- a/test/parallel/test-eslint-lowercase-name-for-primitive.js +++ b/test/parallel/test-eslint-lowercase-name-for-primitive.js @@ -24,28 +24,24 @@ new RuleTester().run('lowercase-name-for-primitive', rule, { ], invalid: [ { - code: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' + - '\'Number\')', + code: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'Number')", errors: [{ message: 'primitive should use lowercase: Number' }], - output: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' + - '\'number\')' + output: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'number')" }, { - code: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' + - '\'STRING\')', + code: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'STRING')", errors: [{ message: 'primitive should use lowercase: STRING' }], - output: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' + - '\'string\')' + output: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'string')" }, { - code: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' + - '[\'String\', \'Number\']) ', + code: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', " + + "['String', 'Number']) ", errors: [ { message: 'primitive should use lowercase: String' }, { message: 'primitive should use lowercase: Number' } ], - output: 'new errors.TypeError(\'ERR_INVALID_ARG_TYPE\', \'a\', ' + - '[\'string\', \'number\']) ' + output: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', " + + "['string', 'number']) " } ] }); diff --git a/test/parallel/test-eslint-prefer-util-format-errors.js b/test/parallel/test-eslint-prefer-util-format-errors.js index 560222438b9aee..bac31ada1623ac 100644 --- a/test/parallel/test-eslint-prefer-util-format-errors.js +++ b/test/parallel/test-eslint-prefer-util-format-errors.js @@ -12,14 +12,14 @@ const rule = require('../../tools/eslint-rules/prefer-util-format-errors'); new RuleTester({ parserOptions: { ecmaVersion: 6 } }) .run('prefer-util-format-errors', rule, { valid: [ - 'E(\'ABC\', \'abc\');', - 'E(\'ABC\', (arg1, arg2) => `${arg2}${arg1}`);', - 'E(\'ABC\', (arg1, arg2) => `${arg1}{arg2.something}`);', - 'E(\'ABC\', (arg1, arg2) => fn(arg1, arg2));' + "E('ABC', 'abc');", + "E('ABC', (arg1, arg2) => `${arg2}${arg1}`);", + "E('ABC', (arg1, arg2) => `${arg1}{arg2.something}`);", + "E('ABC', (arg1, arg2) => fn(arg1, arg2));" ], invalid: [ { - code: 'E(\'ABC\', (arg1, arg2) => `${arg1}${arg2}`);', + code: "E('ABC', (arg1, arg2) => `${arg1}${arg2}`);", errors: [{ message: 'Please use a printf-like formatted string that ' + 'util.format can consume.' diff --git a/test/parallel/test-eslint-require-buffer.js b/test/parallel/test-eslint-require-buffer.js index bdc794dd594240..b67f17425731b5 100644 --- a/test/parallel/test-eslint-require-buffer.js +++ b/test/parallel/test-eslint-require-buffer.js @@ -14,15 +14,15 @@ const ruleTester = new RuleTester({ const message = "Use const Buffer = require('buffer').Buffer; " + 'at the beginning of this file'; -const useStrict = '\'use strict\';\n\n'; -const bufferModule = 'const { Buffer } = require(\'buffer\');\n'; +const useStrict = "'use strict';\n\n"; +const bufferModule = "const { Buffer } = require('buffer');\n"; const mockComment = '// Some Comment\n//\n// Another Comment\n\n'; const useBuffer = 'Buffer;'; ruleTester.run('require-buffer', rule, { valid: [ 'foo', 'const Buffer = require("Buffer"); Buffer;', - 'const { Buffer } = require(\'buffer\'); Buffer;', + "const { Buffer } = require('buffer'); Buffer;", ], invalid: [ { diff --git a/test/parallel/test-eval-strict-referenceerror.js b/test/parallel/test-eval-strict-referenceerror.js index a96478a1bedaae..81fdf63678cb82 100644 --- a/test/parallel/test-eval-strict-referenceerror.js +++ b/test/parallel/test-eval-strict-referenceerror.js @@ -13,8 +13,8 @@ function test() { 'var foo = {m: 1};', '', 'function bar() {', - '\'use strict\';', - 'return foo; // foo isn\'t captured in 0.10', + "'use strict';", + "return foo; // foo isn't captured in 0.10", '};' ].join('\n'); diff --git a/test/parallel/test-fs-error-messages.js b/test/parallel/test-fs-error-messages.js index 61e51585a028c2..4926db57f906ff 100644 --- a/test/parallel/test-fs-error-messages.js +++ b/test/parallel/test-fs-error-messages.js @@ -177,7 +177,7 @@ function re(literals, ...values) { assert.ok(err.dest.endsWith('foo'), `expect ${err.dest} to end with 'foo'`); const regexp = new RegExp('^ENOENT: no such file or directory, link ' + - re`'${nonexistentFile}' -> ` + '\'.*foo\''); + re`'${nonexistentFile}' -> ` + "'.*foo'"); assert.ok(regexp.test(err.message), `Expect ${err.message} to match ${regexp}`); assert.strictEqual(err.errno, uv.UV_ENOENT); @@ -269,7 +269,7 @@ function re(literals, ...values) { assert.ok(err.dest.endsWith('foo'), `expect ${err.dest} to end with 'foo'`); const regexp = new RegExp('ENOENT: no such file or directory, rename ' + - re`'${nonexistentFile}' -> ` + '\'.*foo\''); + re`'${nonexistentFile}' -> ` + "'.*foo'"); assert.ok(regexp.test(err.message), `Expect ${err.message} to match ${regexp}`); assert.strictEqual(err.errno, uv.UV_ENOENT); diff --git a/test/parallel/test-fs-whatwg-url.js b/test/parallel/test-fs-whatwg-url.js index 159fc0cc1b31ea..72c740acbb8a6f 100644 --- a/test/parallel/test-fs-whatwg-url.js +++ b/test/parallel/test-fs-whatwg-url.js @@ -62,8 +62,8 @@ if (common.isWindows) { { code: 'ERR_INVALID_ARG_VALUE', type: TypeError, - message: 'The argument \'path\' must be a string or Uint8Array without ' + - 'null bytes. Received \'c:/tmp/\\u0000test\'' + message: "The argument 'path' must be a string or Uint8Array without " + + "null bytes. Received 'c:/tmp/\\u0000test'" } ); } else { @@ -96,8 +96,8 @@ if (common.isWindows) { { code: 'ERR_INVALID_ARG_VALUE', type: TypeError, - message: 'The argument \'path\' must be a string or Uint8Array without ' + - 'null bytes. Received \'/tmp/\\u0000test\'' + message: "The argument 'path' must be a string or Uint8Array without " + + "null bytes. Received '/tmp/\\u0000test'" } ); } diff --git a/test/parallel/test-fs-write-stream.js b/test/parallel/test-fs-write-stream.js index e93f65e604c20b..4664a81a5ceef3 100644 --- a/test/parallel/test-fs-write-stream.js +++ b/test/parallel/test-fs-write-stream.js @@ -46,7 +46,7 @@ tmpdir.refresh(); const stream = fs.createWriteStream(file); stream.on('drain', function() { - assert.fail('\'drain\' event must not be emitted before ' + + assert.fail("'drain' event must not be emitted before " + 'stream.write() has been called at least once.'); }); stream.destroy(); diff --git a/test/parallel/test-http-date-header.js b/test/parallel/test-http-date-header.js index b389e33664738c..6f02e60ea0c7d4 100644 --- a/test/parallel/test-http-date-header.js +++ b/test/parallel/test-http-date-header.js @@ -45,7 +45,7 @@ server.addListener('listening', () => { }; const req = http.request(options, (res) => { assert.ok('date' in res.headers, - 'Response headers didn\'t contain a Date.'); + "Response headers didn't contain a Date."); res.addListener('end', () => { server.close(); process.exit(); diff --git a/test/parallel/test-http-invalidheaderfield2.js b/test/parallel/test-http-invalidheaderfield2.js index 40415d9c368891..c10bb4a2f31dca 100644 --- a/test/parallel/test-http-invalidheaderfield2.js +++ b/test/parallel/test-http-invalidheaderfield2.js @@ -22,7 +22,7 @@ const { _checkIsHttpToken, _checkInvalidHeaderChar } = require('_http_common'); '$et-Cookie', '%%Test%%', 'Test&123', - 'It\'s_fun', + "It's_fun", '2*3', '4+2', '3.14159265359' diff --git a/test/parallel/test-http-set-trailers.js b/test/parallel/test-http-set-trailers.js index 21c5d604363a36..9b73f569823384 100644 --- a/test/parallel/test-http-set-trailers.js +++ b/test/parallel/test-http-set-trailers.js @@ -74,7 +74,7 @@ server.on('listening', function() { c.on('connect', function() { outstanding_reqs++; c.write('GET / HTTP/1.1\r\n\r\n'); - tid = setTimeout(common.mustNotCall(), 2000, 'Couldn\'t find last chunk.'); + tid = setTimeout(common.mustNotCall(), 2000, "Couldn't find last chunk."); }); c.on('data', function(chunk) { diff --git a/test/parallel/test-http-upgrade-client2.js b/test/parallel/test-http-upgrade-client2.js index 8883faa9e05067..d4033da45cdf98 100644 --- a/test/parallel/test-http-upgrade-client2.js +++ b/test/parallel/test-http-upgrade-client2.js @@ -60,7 +60,7 @@ server.listen(0, common.mustCall(function() { console.log('client end'); request.removeListener('end', onEnd); if (!wasUpgrade) { - throw new Error('hasn\'t received upgrade event'); + throw new Error("hasn't received upgrade event"); } else { fn && process.nextTick(fn); } diff --git a/test/parallel/test-http-upgrade-server2.js b/test/parallel/test-http-upgrade-server2.js index 209ea1f4bc7c6e..15fba31b14d2da 100644 --- a/test/parallel/test-http-upgrade-server2.js +++ b/test/parallel/test-http-upgrade-server2.js @@ -26,7 +26,7 @@ const http = require('http'); const net = require('net'); const server = http.createServer(function(req, res) { - throw new Error('This shouldn\'t happen.'); + throw new Error("This shouldn't happen."); }); server.on('upgrade', function(req, socket, upgradeHead) { diff --git a/test/parallel/test-http-url.parse-only-support-http-https-protocol.js b/test/parallel/test-http-url.parse-only-support-http-https-protocol.js index 5df547594b8450..cd52a8affe82e6 100644 --- a/test/parallel/test-http-url.parse-only-support-http-https-protocol.js +++ b/test/parallel/test-http-url.parse-only-support-http-https-protocol.js @@ -28,7 +28,7 @@ const invalidUrls = [ 'file:///whatever', 'mailto:asdf@asdf.com', 'ftp://www.example.com', - 'javascript:alert(\'hello\');', + "javascript:alert('hello');", 'xmpp:foo@bar.com', 'f://some.host/path' ]; diff --git a/test/parallel/test-internal-errors.js b/test/parallel/test-internal-errors.js index a161a1db69e66d..a9ff5eae80ae14 100644 --- a/test/parallel/test-internal-errors.js +++ b/test/parallel/test-internal-errors.js @@ -136,7 +136,7 @@ assert.strictEqual( // Test ERR_TLS_CERT_ALTNAME_INVALID assert.strictEqual( errors.message('ERR_TLS_CERT_ALTNAME_INVALID', ['altname']), - 'Hostname/IP does not match certificate\'s altnames: altname'); + "Hostname/IP does not match certificate's altnames: altname"); assert.strictEqual( errors.message('ERR_INVALID_PROTOCOL', ['bad protocol', 'http']), @@ -202,17 +202,17 @@ assert.strictEqual( const error = new errors.codes.ERR_INVALID_ARG_VALUE('foo', '\u0000bar'); assert.strictEqual( error.message, - 'The argument \'foo\' is invalid. Received \'\\u0000bar\'' + "The argument 'foo' is invalid. Received '\\u0000bar'" ); } { const error = new errors.codes.ERR_INVALID_ARG_VALUE( - 'foo', { a: 1 }, 'must have property \'b\'' + 'foo', { a: 1 }, "must have property 'b'" ); assert.strictEqual( error.message, - 'The argument \'foo\' must have property \'b\'. Received { a: 1 }' + "The argument 'foo' must have property 'b'. Received { a: 1 }" ); } diff --git a/test/parallel/test-loaders-hidden-from-users.js b/test/parallel/test-loaders-hidden-from-users.js index 0d752f5718b729..2c4ee68792faba 100644 --- a/test/parallel/test-loaders-hidden-from-users.js +++ b/test/parallel/test-loaders-hidden-from-users.js @@ -9,7 +9,7 @@ common.expectsError( require('internal/bootstrap/loaders'); }, { code: 'MODULE_NOT_FOUND', - message: 'Cannot find module \'internal/bootstrap/loaders\'' + message: "Cannot find module 'internal/bootstrap/loaders'" } ); @@ -20,6 +20,6 @@ common.expectsError( require('owo'); }, { code: 'MODULE_NOT_FOUND', - message: 'Cannot find module \'owo\'' + message: "Cannot find module 'owo'" } ); diff --git a/test/parallel/test-module-circular-symlinks.js b/test/parallel/test-module-circular-symlinks.js index e8d80640df0b17..e06ab727284dff 100644 --- a/test/parallel/test-module-circular-symlinks.js +++ b/test/parallel/test-module-circular-symlinks.js @@ -54,11 +54,11 @@ try { } fs.writeFileSync(path.join(tmpDir, 'index.js'), - 'module.exports = require(\'moduleA\');', 'utf8'); + "module.exports = require('moduleA');", 'utf8'); fs.writeFileSync(path.join(moduleA, 'index.js'), - 'module.exports = {b: require(\'moduleB\')};', 'utf8'); + "module.exports = {b: require('moduleB')};", 'utf8'); fs.writeFileSync(path.join(moduleB, 'index.js'), - 'module.exports = {a: require(\'moduleA\')};', 'utf8'); + "module.exports = {a: require('moduleA')};", 'utf8'); // Ensure that the symlinks are not followed forever... const obj = require(path.join(tmpDir, 'index')); diff --git a/test/parallel/test-module-loading-error.js b/test/parallel/test-module-loading-error.js index 86932bd759d20c..21ea8f698aadf8 100644 --- a/test/parallel/test-module-loading-error.js +++ b/test/parallel/test-module-loading-error.js @@ -76,12 +76,12 @@ common.expectsError( { type: TypeError, code: 'ERR_INVALID_ARG_VALUE', - message: 'The argument \'id\' must be a non-empty string. Received \'\'' + message: "The argument 'id' must be a non-empty string. Received ''" }); common.expectsError( () => { require('../fixtures/packages/is-dir'); }, { code: 'MODULE_NOT_FOUND', - message: 'Cannot find module \'../fixtures/packages/is-dir\'' + message: "Cannot find module '../fixtures/packages/is-dir'" }); diff --git a/test/parallel/test-module-symlinked-peer-modules.js b/test/parallel/test-module-symlinked-peer-modules.js index fb02a8a94d5d66..0b52dd21d5e41b 100644 --- a/test/parallel/test-module-symlinked-peer-modules.js +++ b/test/parallel/test-module-symlinked-peer-modules.js @@ -51,9 +51,9 @@ try { fs.writeFileSync(path.join(moduleA, 'package.json'), JSON.stringify({ name: 'moduleA', main: 'index.js' }), 'utf8'); fs.writeFileSync(path.join(moduleA, 'index.js'), - 'module.exports = require(\'moduleB\');', 'utf8'); + "module.exports = require('moduleB');", 'utf8'); fs.writeFileSync(path.join(app, 'index.js'), - '\'use strict\'; require(\'moduleA\');', 'utf8'); + "'use strict'; require('moduleA');", 'utf8'); fs.writeFileSync(path.join(moduleB, 'package.json'), JSON.stringify({ name: 'moduleB', main: 'index.js' }), 'utf8'); fs.writeFileSync(path.join(moduleB, 'index.js'), diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js index 1ade061994c3bb..7e9bdf3e540c66 100644 --- a/test/parallel/test-promises-unhandled-rejections.js +++ b/test/parallel/test-promises-unhandled-rejections.js @@ -236,7 +236,7 @@ asyncTest('When re-throwing new errors in a promise catch, only the re-thrown' + asyncTest( 'unhandledRejection should not be triggered if a promise catch is' + - ' attached synchronously upon the promise\'s creation', + " attached synchronously upon the promise's creation", function(done) { const e = new Error(); onUnhandledFail(done); @@ -246,7 +246,7 @@ asyncTest( asyncTest( 'unhandledRejection should not be triggered if a promise catch is' + - ' attached synchronously upon the promise\'s creation', + " attached synchronously upon the promise's creation", function(done) { const e = new Error(); onUnhandledFail(done); diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js index 7b77a42a167525..5cbf574a346c60 100644 --- a/test/parallel/test-querystring.js +++ b/test/parallel/test-querystring.js @@ -51,8 +51,8 @@ const qsTestCases = [ ['foo=bar&foo=quux', 'foo=bar&foo=quux', { 'foo': ['bar', 'quux'] }], ['foo=1&bar=2', 'foo=1&bar=2', { 'foo': '1', 'bar': '2' }], ['my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F', - 'my%20weird%20field=q1!2%22\'w%245%267%2Fz8)%3F', - { 'my weird field': 'q1!2"\'w$5&7/z8)?' }], + `my%20weird%20field=q1!2%22'w%245%267%2Fz8)%3F`, + { 'my weird field': `q1!2"'w$5&7/z8)?` }], ['foo%3Dbaz=bar', 'foo%3Dbaz=bar', { 'foo=baz': 'bar' }], ['foo=baz=bar', 'foo=baz%3Dbar', { 'foo': 'baz=bar' }], ['str=foo&arr=1&arr=2&arr=3&somenull=&undef=', @@ -156,7 +156,7 @@ const qsNoMungeTestCases = [ ['foo=bar&foo=baz', { 'foo': ['bar', 'baz'] }], ['foo=bar&foo=baz', foreignObject], ['blah=burp', { 'blah': 'burp' }], - ['a=!-._~\'()*', { 'a': '!-._~\'()*' }], + ["a=!-._~'()*", { 'a': "!-._~'()*" }], ['a=abcdefghijklmnopqrstuvwxyz', { 'a': 'abcdefghijklmnopqrstuvwxyz' }], ['a=ABCDEFGHIJKLMNOPQRSTUVWXYZ', { 'a': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' }], ['a=0123456789', { 'a': '0123456789' }], @@ -174,7 +174,7 @@ const qsUnescapeTestCases = [ ['there%2Qare%0-fake%escaped values in%%%%this%9Hstring', 'there%2Qare%0-fake%escaped values in%%%%this%9Hstring'], ['%20%21%22%23%24%25%26%27%28%29%2A%2B%2C%2D%2E%2F%30%31%32%33%34%35%36%37', - ' !"#$%&\'()*+,-./01234567'] + ` !"#$%&'()*+,-./01234567`] ]; assert.strictEqual('918854443121279438895193', diff --git a/test/parallel/test-repl-colors.js b/test/parallel/test-repl-colors.js index dfcc020d899ee6..d43ef0859afa1c 100644 --- a/test/parallel/test-repl-colors.js +++ b/test/parallel/test-repl-colors.js @@ -1,4 +1,3 @@ -/* eslint-disable quotes */ 'use strict'; require('../common'); const { Duplex } = require('stream'); diff --git a/test/parallel/test-repl-persistent-history.js b/test/parallel/test-repl-persistent-history.js index 4d0330272ab3c6..e59a269334e58b 100644 --- a/test/parallel/test-repl-persistent-history.js +++ b/test/parallel/test-repl-persistent-history.js @@ -90,14 +90,14 @@ const tests = [ }, { env: {}, - test: [UP, '\'42\'', ENTER], - expected: [prompt, '\'', '4', '2', '\'', '\'42\'\n', prompt, prompt], + test: [UP, "'42'", ENTER], + expected: [prompt, "'", '4', '2', "'", "'42'\n", prompt, prompt], clean: false }, { // Requires the above test case env: {}, test: [UP, UP, ENTER], - expected: [prompt, `${prompt}'42'`, '\'42\'\n', prompt] + expected: [prompt, `${prompt}'42'`, "'42'\n", prompt] }, { env: { NODE_REPL_HISTORY: historyPath, diff --git a/test/parallel/test-repl-pretty-custom-stack.js b/test/parallel/test-repl-pretty-custom-stack.js index be102c1d677a9c..be81e2df2c3fbe 100644 --- a/test/parallel/test-repl-pretty-custom-stack.js +++ b/test/parallel/test-repl-pretty-custom-stack.js @@ -53,7 +53,7 @@ const tests = [ expected: 'let x y;\n ^\n\nSyntaxError: Unexpected identifier\n' }, { - command: 'throw new Error(\'Whoops!\')', + command: "throw new Error('Whoops!')", expected: 'Error: Whoops!\n' }, { @@ -62,7 +62,7 @@ const tests = [ }, // test anonymous IIFE { - command: '(function() { throw new Error(\'Whoops!\'); })()', + command: "(function() { throw new Error('Whoops!'); })()", expected: 'Error: Whoops!--->\nrepl:1:21\n' } ]; diff --git a/test/parallel/test-repl-pretty-stack.js b/test/parallel/test-repl-pretty-stack.js index 0fc6b3ada04c79..c457e31f415fc2 100644 --- a/test/parallel/test-repl-pretty-stack.js +++ b/test/parallel/test-repl-pretty-stack.js @@ -38,7 +38,7 @@ const tests = [ expected: 'let x y;\n ^\n\nSyntaxError: Unexpected identifier\n\n' }, { - command: 'throw new Error(\'Whoops!\')', + command: "throw new Error('Whoops!')", expected: 'Error: Whoops!\n' }, { @@ -47,7 +47,7 @@ const tests = [ }, // test anonymous IIFE { - command: '(function() { throw new Error(\'Whoops!\'); })()', + command: "(function() { throw new Error('Whoops!'); })()", expected: 'Error: Whoops!\n at repl:1:21\n' } ]; diff --git a/test/parallel/test-repl-require.js b/test/parallel/test-repl-require.js index 3d1af7f2f8c15e..692c1d4f1fc396 100644 --- a/test/parallel/test-repl-require.js +++ b/test/parallel/test-repl-require.js @@ -31,5 +31,5 @@ server.listen(options, function() { process.on('exit', function() { assert.strictEqual(false, /Cannot find module/.test(answer)); assert.strictEqual(false, /Error/.test(answer)); - assert.strictEqual(answer, '\'eye catcher\'\n\'perhaps I work\'\n'); + assert.strictEqual(answer, "'eye catcher'\n'perhaps I work'\n"); }); diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js index 6485f8bd17f58b..d03cc1be644ab3 100644 --- a/test/parallel/test-repl-tab-complete.js +++ b/test/parallel/test-repl-tab-complete.js @@ -206,14 +206,14 @@ testMe.complete('toSt', common.mustCall(function(error, data) { // Tab complete provides built in libs for require() putIn.run(['.clear']); -testMe.complete('require(\'', common.mustCall(function(error, data) { +testMe.complete("require('", common.mustCall(function(error, data) { assert.strictEqual(error, null); repl._builtinLibs.forEach(function(lib) { assert(data[0].includes(lib), `${lib} not found`); }); })); -testMe.complete('require(\'n', common.mustCall(function(error, data) { +testMe.complete("require('n", common.mustCall(function(error, data) { assert.strictEqual(error, null); assert.strictEqual(data.length, 2); assert.strictEqual(data[1], 'n'); @@ -228,7 +228,7 @@ testMe.complete('require(\'n', common.mustCall(function(error, data) { { const expected = ['@nodejsscope', '@nodejsscope/']; putIn.run(['.clear']); - testMe.complete('require(\'@nodejs', common.mustCall((err, data) => { + testMe.complete("require('@nodejs", common.mustCall((err, data) => { assert.strictEqual(err, null); assert.deepStrictEqual(data, [expected, '@nodejs']); })); @@ -241,7 +241,7 @@ testMe.complete('require(\'n', common.mustCall(function(error, data) { const cwd = process.cwd(); process.chdir(__dirname); - ['require(\'.', 'require(".'].forEach((input) => { + ["require('.", 'require(".'].forEach((input) => { testMe.complete(input, common.mustCall((err, data) => { assert.strictEqual(err, null); assert.strictEqual(data.length, 2); @@ -252,7 +252,7 @@ testMe.complete('require(\'n', common.mustCall(function(error, data) { })); }); - ['require(\'..', 'require("..'].forEach((input) => { + ["require('..", 'require("..'].forEach((input) => { testMe.complete(input, common.mustCall((err, data) => { assert.strictEqual(err, null); assert.deepStrictEqual(data, [['../'], '..']); diff --git a/test/parallel/test-repl-use-global.js b/test/parallel/test-repl-use-global.js index c76505272b2682..f13f6097abea8a 100644 --- a/test/parallel/test-repl-use-global.js +++ b/test/parallel/test-repl-use-global.js @@ -10,7 +10,7 @@ const assert = require('assert'); // Array of [useGlobal, expectedResult] pairs const globalTestCases = [ [false, 'undefined'], - [true, '\'tacos\''], + [true, "'tacos'"], [undefined, 'undefined'] ]; diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index e14398541dd8de..3103837d3f7180 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -113,7 +113,7 @@ const unixTests = [ }, { send: 'invoke_me(987)', - expect: '\'invoked 987\'' + expect: "'invoked 987'" }, { send: 'a = 12345', @@ -135,7 +135,7 @@ const strictModeTests = [ const errorTests = [ // Uncaught error throws and prints out { - send: 'throw new Error(\'test error\');', + send: "throw new Error('test error');", expect: /^Error: test error/ }, // Common syntax error is treated as multiline command @@ -180,7 +180,7 @@ const errorTests = [ }, { send: '"1.0" + ".2"}`', - expect: '\'io.js 1.0.2\'' + expect: "'io.js 1.0.2'" }, // Dot prefix in multiline commands aren't treated as commands { @@ -189,7 +189,7 @@ const errorTests = [ }, { send: '.charAt(0))', - expect: '\'a\'' + expect: "'a'" }, // Floating point numbers are not interpreted as REPL commands. { @@ -203,24 +203,24 @@ const errorTests = [ }, // Can parse valid JSON { - send: 'JSON.parse(\'{"valid": "json"}\');', - expect: '{ valid: \'json\' }' + send: `JSON.parse('{"valid": "json"}');`, + expect: "{ valid: 'json' }" }, // invalid input to JSON.parse error is special case of syntax error, // should throw { - send: 'JSON.parse(\'{invalid: \\\'json\\\'}\');', + send: "JSON.parse('{invalid: \\'json\\'}');", expect: [/^SyntaxError: /, ''] }, // end of input to JSON.parse error is special case of syntax error, // should throw { - send: 'JSON.parse(\'066\');', + send: "JSON.parse('066');", expect: [/^SyntaxError: /, ''] }, // should throw { - send: 'JSON.parse(\'{\');', + send: "JSON.parse('{');", expect: [/^SyntaxError: /, ''] }, // invalid RegExps are a special case of syntax error, @@ -367,7 +367,7 @@ const errorTests = [ }, { send: 'url.format("http://google.com")', - expect: '\'http://google.com/\'' + expect: "'http://google.com/'" }, { send: 'var path = 42; path', @@ -398,8 +398,8 @@ const errorTests = [ }, // do not fail when a String is created with line continuation { - send: '\'the\\\nfourth\\\neye\'', - expect: ['... ... \'thefourtheye\''] + send: "'the\\\nfourth\\\neye'", + expect: ["... ... 'thefourtheye'"] }, // Don't fail when a partial String is created and line continuation is used // with whitespace characters at the end of the string. We are to ignore it. @@ -411,22 +411,22 @@ const errorTests = [ }, // multiline strings preserve whitespace characters in them { - send: '\'the \\\n fourth\t\t\\\n eye \'', - expect: '... ... \'the fourth\\t\\t eye \'' + send: "'the \\\n fourth\t\t\\\n eye '", + expect: "... ... 'the fourth\\t\\t eye '" }, // more than one multiline strings also should preserve whitespace chars { - send: '\'the \\\n fourth\' + \'\t\t\\\n eye \'', - expect: '... ... \'the fourth\\t\\t eye \'' + send: "'the \\\n fourth' + '\t\t\\\n eye '", + expect: "... ... 'the fourth\\t\\t eye '" }, // using REPL commands within a string literal should still work { - send: '\'\\\n.break', + send: "'\\\n.break", expect: '... ' + prompt_unix }, // using REPL command "help" within a string literal should still work { - send: '\'thefourth\\\n.help\neye\'', + send: "'thefourth\\\n.help\neye'", expect: [ /\.break/, /\.clear/, @@ -445,33 +445,32 @@ const errorTests = [ }, // empty lines in the string literals should not affect the string { - send: '\'the\\\n\\\nfourtheye\'\n', - expect: '... ... \'thefourtheye\'' + send: "'the\\\n\\\nfourtheye'\n", + expect: "... ... 'thefourtheye'" }, // Regression test for https://github.com/nodejs/node/issues/597 { - send: '/(.)(.)(.)(.)(.)(.)(.)(.)(.)/.test(\'123456789\')\n', + send: "/(.)(.)(.)(.)(.)(.)(.)(.)(.)/.test('123456789')\n", expect: 'true' }, // the following test's result depends on the RegExp's match from the above { send: 'RegExp.$1\nRegExp.$2\nRegExp.$3\nRegExp.$4\nRegExp.$5\n' + 'RegExp.$6\nRegExp.$7\nRegExp.$8\nRegExp.$9\n', - expect: ['\'1\'', '\'2\'', '\'3\'', '\'4\'', '\'5\'', '\'6\'', - '\'7\'', '\'8\'', '\'9\''] + expect: ["'1'", "'2'", "'3'", "'4'", "'5'", "'6'", "'7'", "'8'", "'9'"] }, // regression tests for https://github.com/nodejs/node/issues/2749 { - send: 'function x() {\nreturn \'\\n\';\n }', + send: "function x() {\nreturn '\\n';\n }", expect: '... ... undefined' }, { - send: 'function x() {\nreturn \'\\\\\';\n }', + send: "function x() {\nreturn '\\\\';\n }", expect: '... ... undefined' }, // regression tests for https://github.com/nodejs/node/issues/3421 { - send: 'function x() {\n//\'\n }', + send: "function x() {\n//'\n }", expect: '... ... undefined' }, { @@ -479,7 +478,7 @@ const errorTests = [ expect: '... ... undefined' }, { - send: 'function x() {//\'\n }', + send: "function x() {//'\n }", expect: '... undefined' }, { @@ -487,7 +486,7 @@ const errorTests = [ expect: '... undefined' }, { - send: 'function x() {\nvar i = "\'";\n }', + send: `function x() {\nvar i = "'";\n }`, expect: '... ... undefined' }, { @@ -504,18 +503,18 @@ const errorTests = [ }, { send: '"//"', - expect: '\'//\'' + expect: "'//'" }, { send: '"data /*with*/ comment"', - expect: '\'data /*with*/ comment\'' + expect: "'data /*with*/ comment'" }, { - send: 'function x(/*fn\'s optional params*/) {}', + send: "function x(/*fn's optional params*/) {}", expect: 'undefined' }, { - send: '/* \'\n"\n\'"\'\n*/', + send: `/* '\n"\n'"'\n*/`, expect: '... ... ... undefined' }, // REPL should get a normal require() function, not one that allows @@ -566,11 +565,11 @@ const errorTests = [ // Mitigate https://github.com/nodejs/node/issues/548 { send: 'function name(){ return "node"; };name()', - expect: '\'node\'' + expect: "'node'" }, { send: 'function name(){ return "nodejs"; };name()', - expect: '\'nodejs\'' + expect: "'nodejs'" }, // Avoid emitting repl:line-number for SyntaxError { @@ -645,7 +644,7 @@ const errorTests = [ // Newline within template string maintains whitespace. { send: '`foo \n`', - expect: '... \'foo \\n\'' + expect: "... 'foo \\n'" }, // Whitespace is not evaluated. { @@ -725,7 +724,7 @@ const tcpTests = [ }, { send: 'invoke_me(333)', - expect: '\'invoked 333\'' + expect: "'invoked 333'" }, { send: 'a += 1', diff --git a/test/parallel/test-stdout-close-catch.js b/test/parallel/test-stdout-close-catch.js index e9b559c9f24cd0..c4c518edc6d01b 100644 --- a/test/parallel/test-stdout-close-catch.js +++ b/test/parallel/test-stdout-close-catch.js @@ -9,7 +9,7 @@ const testScript = fixtures.path('catch-stdout-error.js'); const cmd = `${JSON.stringify(process.execPath)} ` + `${JSON.stringify(testScript)} | ` + `${JSON.stringify(process.execPath)} ` + - '-pe "process.stdin.on(\'data\' , () => process.exit(1))"'; + `-pe "process.stdin.on('data' , () => process.exit(1))"`; const child = child_process.exec(cmd); let output = ''; diff --git a/test/parallel/test-stream-pipe-await-drain.js b/test/parallel/test-stream-pipe-await-drain.js index 5bdf48008479e7..c1afe8dc64cd03 100644 --- a/test/parallel/test-stream-pipe-await-drain.js +++ b/test/parallel/test-stream-pipe-await-drain.js @@ -36,7 +36,7 @@ writer1.once('chunk-received', function() { writer2._write = common.mustCall(function(chunk, encoding, cb) { assert.strictEqual( reader._readableState.awaitDrain, 1, - 'awaitDrain isn\'t 1 after first push' + "awaitDrain isn't 1 after first push" ); // Not calling cb here to "simulate" slow stream. // This should be called exactly once, since the first .write() call @@ -46,7 +46,7 @@ writer2._write = common.mustCall(function(chunk, encoding, cb) { writer3._write = common.mustCall(function(chunk, encoding, cb) { assert.strictEqual( reader._readableState.awaitDrain, 2, - 'awaitDrain isn\'t 2 after second push' + "awaitDrain isn't 2 after second push" ); // Not calling cb here to "simulate" slow stream. // This should be called exactly once, since the first .write() call diff --git a/test/parallel/test-timers-refresh.js b/test/parallel/test-timers-refresh.js index 25a22329c01ee9..e8bb352c019448 100644 --- a/test/parallel/test-timers-refresh.js +++ b/test/parallel/test-timers-refresh.js @@ -24,7 +24,7 @@ const { setUnrefTimeout, refreshFnSymbol } = require('internal/timers'); // This relies on implicit timers handle sorting withing libuv. setTimeout(common.mustCall(() => { - strictEqual(called, false, 'unref()\'d timer returned before check'); + strictEqual(called, false, "unref()'d timer returned before check"); }), 1); timer[refreshFnSymbol](); diff --git a/test/parallel/test-tls-check-server-identity.js b/test/parallel/test-tls-check-server-identity.js index 1623e70a2af2ec..9ce4ab90a2c2d5 100644 --- a/test/parallel/test-tls-check-server-identity.js +++ b/test/parallel/test-tls-check-server-identity.js @@ -35,17 +35,17 @@ const tests = [ { host: false, cert: { subject: { CN: 'a.com' } }, - error: 'Host: false. is not cert\'s CN: a.com' + error: "Host: false. is not cert's CN: a.com" }, { host: null, cert: { subject: { CN: 'a.com' } }, - error: 'Host: null. is not cert\'s CN: a.com' + error: "Host: null. is not cert's CN: a.com" }, { host: undefined, cert: { subject: { CN: 'a.com' } }, - error: 'Host: undefined. is not cert\'s CN: a.com' + error: "Host: undefined. is not cert's CN: a.com" }, // Basic CN handling @@ -54,13 +54,13 @@ const tests = [ { host: 'a.com', cert: { subject: { CN: 'b.com' } }, - error: 'Host: a.com. is not cert\'s CN: b.com' + error: "Host: a.com. is not cert's CN: b.com" }, { host: 'a.com', cert: { subject: { CN: 'a.com.' } } }, { host: 'a.com', cert: { subject: { CN: '.a.com' } }, - error: 'Host: a.com. is not cert\'s CN: .a.com' + error: "Host: a.com. is not cert's CN: .a.com" }, // Wildcards in CN @@ -68,23 +68,22 @@ const tests = [ { host: 'ba.com', cert: { subject: { CN: '*.a.com' } }, - error: 'Host: ba.com. is not cert\'s CN: *.a.com' + error: "Host: ba.com. is not cert's CN: *.a.com" }, { host: '\n.b.com', cert: { subject: { CN: '*n.b.com' } }, - error: 'Host: \n.b.com. is not cert\'s CN: *n.b.com' + error: "Host: \n.b.com. is not cert's CN: *n.b.com" }, { host: 'b.a.com', cert: { subjectaltname: 'DNS:omg.com', subject: { CN: '*.a.com' } }, - error: 'Host: b.a.com. is not in the cert\'s altnames: ' + - 'DNS:omg.com' + error: "Host: b.a.com. is not in the cert's altnames: DNS:omg.com" }, { host: 'b.a.com', cert: { subject: { CN: 'b*b.a.com' } }, - error: 'Host: b.a.com. is not cert\'s CN: b*b.a.com' + error: "Host: b.a.com. is not cert's CN: b*b.a.com" }, // Empty Cert @@ -107,16 +106,14 @@ const tests = [ subjectaltname: 'DNS:*', subject: { CN: 'b.com' } }, - error: 'Host: a.com. is not in the cert\'s altnames: ' + - 'DNS:*' + error: "Host: a.com. is not in the cert's altnames: DNS:*" }, { host: 'a.com', cert: { subjectaltname: 'DNS:*.com', subject: { CN: 'b.com' } }, - error: 'Host: a.com. is not in the cert\'s altnames: ' + - 'DNS:*.com' + error: "Host: a.com. is not in the cert's altnames: DNS:*.com" }, { host: 'a.co.uk', cert: { @@ -129,16 +126,14 @@ const tests = [ subjectaltname: 'DNS:*.a.com', subject: { CN: 'a.com' } }, - error: 'Host: a.com. is not in the cert\'s altnames: ' + - 'DNS:*.a.com' + error: "Host: a.com. is not in the cert's altnames: DNS:*.a.com" }, { host: 'a.com', cert: { subjectaltname: 'DNS:*.a.com', subject: { CN: 'b.com' } }, - error: 'Host: a.com. is not in the cert\'s altnames: ' + - 'DNS:*.a.com' + error: "Host: a.com. is not in the cert's altnames: DNS:*.a.com" }, { host: 'a.com', cert: { @@ -159,8 +154,7 @@ const tests = [ subjectaltname: 'DNS:*.a.com', subject: {} }, - error: 'Host: a.com. is not in the cert\'s altnames: ' + - 'DNS:*.a.com' + error: "Host: a.com. is not in the cert's altnames: DNS:*.a.com" }, { host: 'b.a.com', cert: { @@ -173,8 +167,7 @@ const tests = [ subjectaltname: 'DNS:*.a.com', subject: {} }, - error: 'Host: c.b.a.com. is not in the cert\'s altnames: ' + - 'DNS:*.a.com' + error: "Host: c.b.a.com. is not in the cert's altnames: DNS:*.a.com" }, { host: 'b.a.com', cert: { @@ -193,8 +186,7 @@ const tests = [ subjectaltname: 'DNS:*b.a.com', subject: {} }, - error: 'Host: a.b.a.com. is not in the cert\'s altnames: ' + - 'DNS:*b.a.com' + error: "Host: a.b.a.com. is not in the cert's altnames: DNS:*b.a.com" }, // Multiple DNS names { @@ -215,7 +207,7 @@ const tests = [ subjectaltname: 'URI:http://*.b.a.com/', subject: {} }, - error: 'Host: a.b.a.com. is not in the cert\'s altnames: ' + + error: "Host: a.b.a.com. is not in the cert's altnames: " + 'URI:http://*.b.a.com/' }, // IP addresses @@ -224,7 +216,7 @@ const tests = [ subjectaltname: 'IP Address:127.0.0.1', subject: {} }, - error: 'Host: a.b.a.com. is not in the cert\'s altnames: ' + + error: "Host: a.b.a.com. is not in the cert's altnames: " + 'IP Address:127.0.0.1' }, { @@ -238,23 +230,21 @@ const tests = [ subjectaltname: 'IP Address:127.0.0.1', subject: {} }, - error: 'IP: 127.0.0.2 is not in the cert\'s list: ' + - '127.0.0.1' + error: "IP: 127.0.0.2 is not in the cert's list: 127.0.0.1" }, { host: '127.0.0.1', cert: { subjectaltname: 'DNS:a.com', subject: {} }, - error: 'IP: 127.0.0.1 is not in the cert\'s list: ' + error: "IP: 127.0.0.1 is not in the cert's list: " }, { host: 'localhost', cert: { subjectaltname: 'DNS:a.com', subject: { CN: 'localhost' } }, - error: 'Host: localhost. is not in the cert\'s altnames: ' + - 'DNS:a.com' + error: "Host: localhost. is not in the cert's altnames: DNS:a.com" }, // IDNA { @@ -267,7 +257,7 @@ const tests = [ { host: 'xn--bcher-kva.example.com', cert: { subject: { CN: 'xn--*.example.com' } }, - error: 'Host: xn--bcher-kva.example.com. is not cert\'s CN: ' + + error: "Host: xn--bcher-kva.example.com. is not cert's CN: " + 'xn--*.example.com', }, ]; diff --git a/test/parallel/test-url-parse-format.js b/test/parallel/test-url-parse-format.js index f4e72ee5ef4896..d83076f7a36dab 100644 --- a/test/parallel/test-url-parse-format.js +++ b/test/parallel/test-url-parse-format.js @@ -134,7 +134,7 @@ const parseTests = { path: '/' }, - 'http://x.com/path?that\'s#all, folks': { + "http://x.com/path?that's#all, folks": { href: 'http://x.com/path?that%27s#all,%20folks', protocol: 'http:', slashes: true, @@ -409,11 +409,11 @@ const parseTests = { path: '?subject=hello' }, - 'javascript:alert(\'hello\');': { - href: 'javascript:alert(\'hello\');', + "javascript:alert('hello');": { + href: "javascript:alert('hello');", protocol: 'javascript:', - pathname: 'alert(\'hello\');', - path: 'alert(\'hello\');' + pathname: "alert('hello');", + path: "alert('hello');" }, 'xmpp:isaacschlueter@jabber.org': { @@ -849,7 +849,7 @@ const parseTests = { 'http://a\r" \t\n<\'b:b@c\r\nd/e?f': { protocol: 'http:', slashes: true, - auth: 'a\r" \t\n<\'b:b', + auth: `a\r" \t\n<'b:b`, host: 'c', port: null, hostname: 'c', @@ -858,7 +858,7 @@ const parseTests = { query: 'f', pathname: '%0D%0Ad/e', path: '%0D%0Ad/e?f', - href: 'http://a%0D%22%20%09%0A%3C\'b:b@c/%0D%0Ad/e?f' + href: "http://a%0D%22%20%09%0A%3C'b:b@c/%0D%0Ad/e?f" }, // git urls used by npm diff --git a/test/parallel/test-util-format.js b/test/parallel/test-util-format.js index fd686cb6d355ad..c3aad9b94124ea 100644 --- a/test/parallel/test-util-format.js +++ b/test/parallel/test-util-format.js @@ -121,79 +121,79 @@ const nestedObj2 = { }; assert.strictEqual(util.format('%o'), '%o'); assert.strictEqual(util.format('%o', 42), '42'); -assert.strictEqual(util.format('%o', 'foo'), '\'foo\''); +assert.strictEqual(util.format('%o', 'foo'), "'foo'"); assert.strictEqual( util.format('%o', obj), - '{ foo: \'bar\',\n' + + "{ foo: 'bar',\n" + ' foobar: 1,\n' + ' func: \n' + ' { [Function: func]\n' + ' [length]: 0,\n' + - ' [name]: \'func\',\n' + + " [name]: 'func',\n" + ' [prototype]: func { [constructor]: [Circular] } } }'); assert.strictEqual( util.format('%o', nestedObj2), - '{ foo: \'bar\',\n' + + "{ foo: 'bar',\n" + ' foobar: 1,\n' + ' func: \n' + ' [ { a: \n' + ' { [Function: a]\n' + ' [length]: 0,\n' + - ' [name]: \'a\',\n' + + " [name]: 'a',\n" + ' [prototype]: a { [constructor]: [Circular] } } },\n' + ' [length]: 1 ] }'); assert.strictEqual( util.format('%o', nestedObj), - '{ foo: \'bar\',\n' + + "{ foo: 'bar',\n" + ' foobar: \n' + - ' { foo: \'bar\',\n' + + " { foo: 'bar',\n" + ' func: \n' + ' { [Function: func]\n' + ' [length]: 0,\n' + - ' [name]: \'func\',\n' + + " [name]: 'func',\n" + ' [prototype]: func { [constructor]: [Circular] } } } }'); assert.strictEqual( util.format('%o %o', obj, obj), - '{ foo: \'bar\',\n' + + "{ foo: 'bar',\n" + ' foobar: 1,\n' + ' func: \n' + ' { [Function: func]\n' + ' [length]: 0,\n' + - ' [name]: \'func\',\n' + + " [name]: 'func',\n" + ' [prototype]: func { [constructor]: [Circular] } } }' + - ' { foo: \'bar\',\n' + + " { foo: 'bar',\n" + ' foobar: 1,\n' + ' func: \n' + ' { [Function: func]\n' + ' [length]: 0,\n' + - ' [name]: \'func\',\n' + + " [name]: 'func',\n" + ' [prototype]: func { [constructor]: [Circular] } } }'); assert.strictEqual( util.format('%o %o', obj), - '{ foo: \'bar\',\n' + + "{ foo: 'bar',\n" + ' foobar: 1,\n' + ' func: \n' + ' { [Function: func]\n' + ' [length]: 0,\n' + - ' [name]: \'func\',\n' + + " [name]: 'func',\n" + ' [prototype]: func { [constructor]: [Circular] } } } %o'); assert.strictEqual(util.format('%O'), '%O'); assert.strictEqual(util.format('%O', 42), '42'); -assert.strictEqual(util.format('%O', 'foo'), '\'foo\''); +assert.strictEqual(util.format('%O', 'foo'), "'foo'"); assert.strictEqual( util.format('%O', obj), - '{ foo: \'bar\', foobar: 1, func: [Function: func] }'); + "{ foo: 'bar', foobar: 1, func: [Function: func] }"); assert.strictEqual( util.format('%O', nestedObj), - '{ foo: \'bar\', foobar: { foo: \'bar\', func: [Function: func] } }'); + "{ foo: 'bar', foobar: { foo: 'bar', func: [Function: func] } }"); assert.strictEqual( util.format('%O %O', obj, obj), - '{ foo: \'bar\', foobar: 1, func: [Function: func] } ' + - '{ foo: \'bar\', foobar: 1, func: [Function: func] }'); + "{ foo: 'bar', foobar: 1, func: [Function: func] } " + + "{ foo: 'bar', foobar: 1, func: [Function: func] }"); assert.strictEqual( util.format('%O %O', obj), - '{ foo: \'bar\', foobar: 1, func: [Function: func] } %O'); + "{ foo: 'bar', foobar: 1, func: [Function: func] } %O"); // Various format specifiers assert.strictEqual(util.format('%%s%s', 'foo'), '%sfoo'); diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index b5ef8dca083b10..22a017c460dcb3 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -94,7 +94,7 @@ assert.strictEqual( Object.assign(new String('hello'), { [Symbol('foo')]: 123 }), { showHidden: true } ), - '{ [String: \'hello\'] [length]: 5, [Symbol(foo)]: 123 }' + "{ [String: 'hello'] [length]: 5, [Symbol(foo)]: 123 }" ); assert.strictEqual(util.inspect((new JSStream())._externalStream), @@ -266,7 +266,7 @@ assert.strictEqual( name: { value: 'Tim', enumerable: true }, hidden: { value: 'secret' } })), - '{ name: \'Tim\' }' + "{ name: 'Tim' }" ); // Dynamic properties. @@ -309,7 +309,7 @@ assert.strictEqual( } ); assert.strictEqual(util.inspect(value), - '[ 1, 2, 3, growingLength: [Getter], \'-1\': -1 ]'); + "[ 1, 2, 3, growingLength: [Getter], '-1': -1 ]"); } // Array with inherited number properties. @@ -423,24 +423,24 @@ assert.strictEqual(util.inspect(-5e-324), '-5e-324'); // Test for sparse array. { const a = ['foo', 'bar', 'baz']; - assert.strictEqual(util.inspect(a), '[ \'foo\', \'bar\', \'baz\' ]'); + assert.strictEqual(util.inspect(a), "[ 'foo', 'bar', 'baz' ]"); delete a[1]; - assert.strictEqual(util.inspect(a), '[ \'foo\', <1 empty item>, \'baz\' ]'); + assert.strictEqual(util.inspect(a), "[ 'foo', <1 empty item>, 'baz' ]"); assert.strictEqual( util.inspect(a, true), - '[ \'foo\', <1 empty item>, \'baz\', [length]: 3 ]' + "[ 'foo', <1 empty item>, 'baz', [length]: 3 ]" ); assert.strictEqual(util.inspect(new Array(5)), '[ <5 empty items> ]'); a[3] = 'bar'; a[100] = 'qux'; assert.strictEqual( util.inspect(a, { breakLength: Infinity }), - '[ \'foo\', <1 empty item>, \'baz\', \'bar\', <96 empty items>, \'qux\' ]' + "[ 'foo', <1 empty item>, 'baz', 'bar', <96 empty items>, 'qux' ]" ); delete a[3]; assert.strictEqual( util.inspect(a, { maxArrayLength: 4 }), - '[ \'foo\', <1 empty item>, \'baz\', <97 empty items>, ... 1 more item ]' + "[ 'foo', <1 empty item>, 'baz', <97 empty items>, ... 1 more item ]" ); } @@ -581,13 +581,13 @@ util.inspect([{ inspect: () => 123 }]); assert.strictEqual( util.inspect(w), - '{ \'\\\\\': 1, \'\\\\\\\\\': 2, \'\\\\\\\\\\\\\': 3, ' + - '\'\\\\\\\\\\\\\\\\\': 4, \'\\n\': 5, \'\\r\': 6 }' + "{ '\\\\': 1, '\\\\\\\\': 2, '\\\\\\\\\\\\': 3, " + + "'\\\\\\\\\\\\\\\\': 4, '\\n': 5, '\\r': 6 }" ); assert.strictEqual( util.inspect(y), - '[ \'a\', \'b\', \'c\', \'\\\\\\\\\': \'d\', ' + - '\'\\n\': \'e\', \'\\r\': \'f\' ]' + "[ 'a', 'b', 'c', '\\\\\\\\': 'd', " + + "'\\n': 'e', '\\r': 'f' ]" ); } @@ -684,7 +684,7 @@ util.inspect({ hasOwnProperty: null }); // Custom inspect() functions should be able to return other Objects. subject.inspect = () => ({ foo: 'bar' }); - assert.strictEqual(util.inspect(subject), '{ foo: \'bar\' }'); + assert.strictEqual(util.inspect(subject), "{ foo: 'bar' }"); subject.inspect = (depth, opts) => { assert.strictEqual(opts.customInspectOptions, true); @@ -709,7 +709,7 @@ util.inspect({ hasOwnProperty: null }); // A custom [util.inspect.custom]() should be able to return other Objects. subject[util.inspect.custom] = () => ({ foo: 'bar' }); - assert.strictEqual(util.inspect(subject), '{ foo: \'bar\' }'); + assert.strictEqual(util.inspect(subject), "{ foo: 'bar' }"); subject[util.inspect.custom] = (depth, opts) => { assert.strictEqual(opts.customInspectOptions, true); @@ -779,7 +779,7 @@ util.inspect({ hasOwnProperty: null }); } // Test boxed primitives output the correct values. -assert.strictEqual(util.inspect(new String('test')), '[String: \'test\']'); +assert.strictEqual(util.inspect(new String('test')), "[String: 'test']"); assert.strictEqual( util.inspect(Object(Symbol('test'))), '[Symbol: Symbol(test)]' @@ -795,15 +795,15 @@ assert.strictEqual(util.inspect(new Number(13.37)), '[Number: 13.37]'); { const str = new String('baz'); str.foo = 'bar'; - assert.strictEqual(util.inspect(str), '{ [String: \'baz\'] foo: \'bar\' }'); + assert.strictEqual(util.inspect(str), "{ [String: 'baz'] foo: 'bar' }"); const bool = new Boolean(true); bool.foo = 'bar'; - assert.strictEqual(util.inspect(bool), '{ [Boolean: true] foo: \'bar\' }'); + assert.strictEqual(util.inspect(bool), "{ [Boolean: true] foo: 'bar' }"); const num = new Number(13.37); num.foo = 'bar'; - assert.strictEqual(util.inspect(num), '{ [Number: 13.37] foo: \'bar\' }'); + assert.strictEqual(util.inspect(num), "{ [Number: 13.37] foo: 'bar' }"); } // Test es6 Symbol. @@ -832,7 +832,7 @@ if (typeof Symbol !== 'undefined') { assert.strictEqual(util.inspect(subject), '{ [Symbol(symbol)]: 42 }'); assert.strictEqual( util.inspect(subject, options), - '{ [Symbol(symbol)]: 42, [Symbol()]: \'non-enum\' }' + "{ [Symbol(symbol)]: 42, [Symbol()]: 'non-enum' }" ); subject = [1, 2, 3]; @@ -850,7 +850,7 @@ if (typeof Symbol !== 'undefined') { set.bar = 42; assert.strictEqual( util.inspect(set, true), - 'Set { \'foo\', [size]: 1, bar: 42 }' + "Set { 'foo', [size]: 1, bar: 42 }" ); } @@ -865,11 +865,11 @@ if (typeof Symbol !== 'undefined') { { assert.strictEqual(util.inspect(new Map()), 'Map {}'); assert.strictEqual(util.inspect(new Map([[1, 'a'], [2, 'b'], [3, 'c']])), - 'Map { 1 => \'a\', 2 => \'b\', 3 => \'c\' }'); + "Map { 1 => 'a', 2 => 'b', 3 => 'c' }"); const map = new Map([['foo', null]]); map.bar = 42; assert.strictEqual(util.inspect(map, true), - 'Map { \'foo\' => null, [size]: 1, bar: 42 }'); + "Map { 'foo' => null, [size]: 1, bar: 42 }"); } // Test circular Map. @@ -900,7 +900,7 @@ if (typeof Symbol !== 'undefined') { const promiseWithProperty = Promise.resolve('foo'); promiseWithProperty.bar = 42; assert.strictEqual(util.inspect(promiseWithProperty), - 'Promise { \'foo\', bar: 42 }'); + "Promise { 'foo', bar: 42 }"); } // Make sure it doesn't choke on polyfills. Unlike Set/Map, there is no standard @@ -916,14 +916,14 @@ if (typeof Symbol !== 'undefined') { // Test Map iterators. { const map = new Map([['foo', 'bar']]); - assert.strictEqual(util.inspect(map.keys()), '[Map Iterator] { \'foo\' }'); - assert.strictEqual(util.inspect(map.values()), '[Map Iterator] { \'bar\' }'); + assert.strictEqual(util.inspect(map.keys()), "[Map Iterator] { 'foo' }"); + assert.strictEqual(util.inspect(map.values()), "[Map Iterator] { 'bar' }"); assert.strictEqual(util.inspect(map.entries()), - '[Map Iterator] { [ \'foo\', \'bar\' ] }'); + "[Map Iterator] { [ 'foo', 'bar' ] }"); // Make sure the iterator doesn't get consumed. const keys = map.keys(); - assert.strictEqual(util.inspect(keys), '[Map Iterator] { \'foo\' }'); - assert.strictEqual(util.inspect(keys), '[Map Iterator] { \'foo\' }'); + assert.strictEqual(util.inspect(keys), "[Map Iterator] { 'foo' }"); + assert.strictEqual(util.inspect(keys), "[Map Iterator] { 'foo' }"); keys.extra = true; assert.strictEqual( util.inspect(keys, { maxArrayLength: 0 }), @@ -999,7 +999,7 @@ if (typeof Symbol !== 'undefined') { assert.strictEqual(util.inspect(new SetSubclass([1, 2, 3])), 'SetSubclass [Set] { 1, 2, 3 }'); assert.strictEqual(util.inspect(new MapSubclass([['foo', 42]])), - 'MapSubclass [Map] { \'foo\' => 42 }'); + "MapSubclass [Map] { 'foo' => 42 }"); assert.strictEqual(util.inspect(new PromiseSubclass(() => {})), 'PromiseSubclass [Promise] { }'); assert.strictEqual( @@ -1052,7 +1052,7 @@ if (typeof Symbol !== 'undefined') { { const x = []; x[''] = 1; - assert.strictEqual(util.inspect(x), '[ \'\': 1 ]'); + assert.strictEqual(util.inspect(x), "[ '': 1 ]"); } // The following maxArrayLength tests were introduced after v6.0.0 was released. @@ -1098,10 +1098,10 @@ if (typeof Symbol !== 'undefined') { const breakpoint = oneLine.length - 5; const twoLines = util.inspect(obj, { breakLength: breakpoint }); - assert.strictEqual(oneLine, '{ foo: \'abc\', bar: \'xyz\' }'); + assert.strictEqual(oneLine, "{ foo: 'abc', bar: 'xyz' }"); assert.strictEqual(oneLine, util.inspect(obj, { breakLength: breakpoint + 1 })); - assert.strictEqual(twoLines, '{ foo: \'abc\',\n bar: \'xyz\' }'); + assert.strictEqual(twoLines, "{ foo: 'abc',\n bar: 'xyz' }"); } // util.inspect.defaultOptions tests. @@ -1169,7 +1169,7 @@ util.inspect(process); { // @@toStringTag assert.strictEqual(util.inspect({ [Symbol.toStringTag]: 'a' }), - 'Object [a] { [Symbol(Symbol.toStringTag)]: \'a\' }'); + "Object [a] { [Symbol(Symbol.toStringTag)]: 'a' }"); class Foo { constructor() { @@ -1185,17 +1185,17 @@ util.inspect(process); Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } })), '[foo] {}'); - assert.strictEqual(util.inspect(new Foo()), 'Foo [bar] { foo: \'bar\' }'); + assert.strictEqual(util.inspect(new Foo()), "Foo [bar] { foo: 'bar' }"); assert.strictEqual( util.inspect(new (class extends Foo {})()), - 'Foo [bar] { foo: \'bar\' }'); + "Foo [bar] { foo: 'bar' }"); assert.strictEqual( util.inspect(Object.create(Object.create(Foo.prototype), { foo: { value: 'bar', enumerable: true } })), - 'Foo [bar] { foo: \'bar\' }'); + "Foo [bar] { foo: 'bar' }"); class ThrowingClass { get [Symbol.toStringTag]() { @@ -1247,19 +1247,19 @@ util.inspect(process); ' 2,', ' [', ' [', - ' \'Lorem ipsum dolor\\nsit amet,\\tconsectetur \' +', - ' \'adipiscing elit, sed do eiusmod tempor \' +', - ' \'incididunt ut labore et dolore magna \' +', - ' \'aliqua.\',', - ' \'test\',', - ' \'foo\'', + " 'Lorem ipsum dolor\\nsit amet,\\tconsectetur ' +", + " 'adipiscing elit, sed do eiusmod tempor ' +", + " 'incididunt ut labore et dolore magna ' +", + " 'aliqua.',", + " 'test',", + " 'foo'", ' ]', ' ],', ' 4', ' ],', ' b: Map {', - ' \'za\' => 1,', - ' \'zb\' => \'test\'', + " 'za' => 1,", + " 'zb' => 'test'", ' }', '}' ].join('\n'); @@ -1267,28 +1267,28 @@ util.inspect(process); out = util.inspect(o.a[2][0][0], { compact: false, breakLength: 30 }); expect = [ - '\'Lorem ipsum dolor\\nsit \' +', - ' \'amet,\\tconsectetur \' +', - ' \'adipiscing elit, sed do \' +', - ' \'eiusmod tempor incididunt \' +', - ' \'ut labore et dolore magna \' +', - ' \'aliqua.\'' + "'Lorem ipsum dolor\\nsit ' +", + " 'amet,\\tconsectetur ' +", + " 'adipiscing elit, sed do ' +", + " 'eiusmod tempor incididunt ' +", + " 'ut labore et dolore magna ' +", + " 'aliqua.'" ].join('\n'); assert.strictEqual(out, expect); out = util.inspect( '12345678901234567890123456789012345678901234567890', { compact: false, breakLength: 3 }); - expect = '\'12345678901234567890123456789012345678901234567890\''; + expect = "'12345678901234567890123456789012345678901234567890'"; assert.strictEqual(out, expect); out = util.inspect( '12 45 78 01 34 67 90 23 56 89 123456789012345678901234567890', { compact: false, breakLength: 3 }); expect = [ - '\'12 45 78 01 34 \' +', - ' \'67 90 23 56 89 \' +', - ' \'123456789012345678901234567890\'' + "'12 45 78 01 34 ' +", + " '67 90 23 56 89 ' +", + " '123456789012345678901234567890'" ].join('\n'); assert.strictEqual(out, expect); @@ -1296,9 +1296,9 @@ util.inspect(process); '12 45 78 01 34 67 90 23 56 89 1234567890123 0', { compact: false, breakLength: 3 }); expect = [ - '\'12 45 78 01 34 \' +', - ' \'67 90 23 56 89 \' +', - ' \'1234567890123 0\'' + "'12 45 78 01 34 ' +", + " '67 90 23 56 89 ' +", + " '1234567890123 0'" ].join('\n'); assert.strictEqual(out, expect); @@ -1306,10 +1306,10 @@ util.inspect(process); '12 45 78 01 34 67 90 23 56 89 12345678901234567 0', { compact: false, breakLength: 3 }); expect = [ - '\'12 45 78 01 34 \' +', - ' \'67 90 23 56 89 \' +', - ' \'12345678901234567 \' +', - ' \'0\'' + "'12 45 78 01 34 ' +", + " '67 90 23 56 89 ' +", + " '12345678901234567 ' +", + " '0'" ].join('\n'); assert.strictEqual(out, expect); @@ -1348,7 +1348,7 @@ util.inspect(process); o[util.inspect.custom] = () => ({ a: '12 45 78 01 34 67 90 23' }); out = util.inspect(o, { compact: false, breakLength: 3 }); - expect = '{\n a: \'12 45 78 01 34 \' +\n \'67 90 23\'\n}'; + expect = "{\n a: '12 45 78 01 34 ' +\n '67 90 23'\n}"; assert.strictEqual(out, expect); } diff --git a/test/parallel/test-vm-context.js b/test/parallel/test-vm-context.js index 31ed69da93fabc..b1cf6a99e829b7 100644 --- a/test/parallel/test-vm-context.js +++ b/test/parallel/test-vm-context.js @@ -87,7 +87,7 @@ const contextifiedSandboxError = { // Issue GH-693: // Test RegExp as argument to assert.throws -script = vm.createScript('const assert = require(\'assert\'); assert.throws(' + +script = vm.createScript("const assert = require('assert'); assert.throws(" + 'function() { throw "hello world"; }, /hello/);', 'some.js'); script.runInNewContext({ require }); diff --git a/test/parallel/test-vm-new-script-new-context.js b/test/parallel/test-vm-new-script-new-context.js index b0ef06756bee6d..5407f78f02bfba 100644 --- a/test/parallel/test-vm-new-script-new-context.js +++ b/test/parallel/test-vm-new-script-new-context.js @@ -27,7 +27,7 @@ const assert = require('assert'); const Script = require('vm').Script; { - const script = new Script('\'passed\';'); + const script = new Script("'passed';"); const result1 = script.runInNewContext(); const result2 = script.runInNewContext(); assert.strictEqual('passed', result1); @@ -35,7 +35,7 @@ const Script = require('vm').Script; } { - const script = new Script('throw new Error(\'test\');'); + const script = new Script("throw new Error('test');"); assert.throws(() => { script.runInNewContext(); }, /^Error: test$/); @@ -61,7 +61,7 @@ const Script = require('vm').Script; { global.code = 'foo = 1;' + 'bar = 2;' + - 'if (baz !== 3) throw new Error(\'test fail\');'; + "if (baz !== 3) throw new Error('test fail');"; global.foo = 2; global.obj = { foo: 0, baz: 3 }; const script = new Script(global.code); @@ -102,6 +102,6 @@ const Script = require('vm').Script; { const script = new Script(''); assert.throws(() => { - script.runInNewContext.call('\'hello\';'); + script.runInNewContext.call("'hello';"); }, /^TypeError: this\.runInContext is not a function$/); } diff --git a/test/parallel/test-vm-new-script-this-context.js b/test/parallel/test-vm-new-script-this-context.js index 6da47e67249c2b..52928791e9eccb 100644 --- a/test/parallel/test-vm-new-script-this-context.js +++ b/test/parallel/test-vm-new-script-this-context.js @@ -27,12 +27,12 @@ const Script = require('vm').Script; common.globalCheck = false; // Run a string -let script = new Script('\'passed\';'); +let script = new Script("'passed';"); const result = script.runInThisContext(script); assert.strictEqual('passed', result); // Thrown error -script = new Script('throw new Error(\'test\');'); +script = new Script("throw new Error('test');"); assert.throws(() => { script.runInThisContext(script); }, /^Error: test$/); diff --git a/test/parallel/test-vm-run-in-new-context.js b/test/parallel/test-vm-run-in-new-context.js index 1edb061ea6a871..0e970b7d489c99 100644 --- a/test/parallel/test-vm-run-in-new-context.js +++ b/test/parallel/test-vm-run-in-new-context.js @@ -32,12 +32,12 @@ assert.strictEqual(typeof global.gc, 'function', common.globalCheck = false; // Run a string -const result = vm.runInNewContext('\'passed\';'); +const result = vm.runInNewContext("'passed';"); assert.strictEqual(result, 'passed'); // Thrown error assert.throws(() => { - vm.runInNewContext('throw new Error(\'test\');'); + vm.runInNewContext("throw new Error('test');"); }, /^Error: test$/); global.hello = 5; @@ -48,7 +48,7 @@ assert.strictEqual(global.hello, 5); // Pass values in and out global.code = 'foo = 1;' + 'bar = 2;' + - 'if (baz !== 3) throw new Error(\'test fail\');'; + "if (baz !== 3) throw new Error('test fail');"; global.foo = 2; global.obj = { foo: 0, baz: 3 }; /* eslint-disable no-unused-vars */ diff --git a/test/parallel/test-vm-static-this.js b/test/parallel/test-vm-static-this.js index 5306e31dc0e4a7..037deaa12f98fa 100644 --- a/test/parallel/test-vm-static-this.js +++ b/test/parallel/test-vm-static-this.js @@ -27,12 +27,12 @@ const vm = require('vm'); common.globalCheck = false; // Run a string -const result = vm.runInThisContext('\'passed\';'); +const result = vm.runInThisContext("'passed';"); assert.strictEqual('passed', result); // thrown error assert.throws(function() { - vm.runInThisContext('throw new Error(\'test\');'); + vm.runInThisContext("throw new Error('test');"); }, /test/); global.hello = 5; @@ -43,8 +43,8 @@ assert.strictEqual(2, global.hello); // pass values const code = 'foo = 1;' + 'bar = 2;' + - 'if (typeof baz !== \'undefined\')' + - 'throw new Error(\'test fail\');'; + "if (typeof baz !== 'undefined')" + + "throw new Error('test fail');"; global.foo = 2; global.obj = { foo: 0, baz: 3 }; /* eslint-disable no-unused-vars */ diff --git a/test/parallel/test-vm-syntax-error-message.js b/test/parallel/test-vm-syntax-error-message.js index 5a16239f5653e9..ac132401a8e693 100644 --- a/test/parallel/test-vm-syntax-error-message.js +++ b/test/parallel/test-vm-syntax-error-message.js @@ -7,7 +7,7 @@ const p = child_process.spawn(process.execPath, [ '-e', 'vm = require("vm");' + 'context = vm.createContext({});' + - 'try { vm.runInContext("throw new Error(\'boo\')", context); } ' + + `try { vm.runInContext("throw new Error('boo')", context); } ` + 'catch (e) { console.log(e.message); }' ]); diff --git a/test/parallel/test-vm-timeout.js b/test/parallel/test-vm-timeout.js index 859992e99ba36f..af9e35f9c22934 100644 --- a/test/parallel/test-vm-timeout.js +++ b/test/parallel/test-vm-timeout.js @@ -59,7 +59,7 @@ assert.throws(function() { assert.throws(function() { const context = { runInVM: function(timeout) { - vm.runInNewContext('throw new Error(\'foobar\')', context, { timeout }); + vm.runInNewContext("throw new Error('foobar')", context, { timeout }); } }; vm.runInNewContext('runInVM(10000)', context, { timeout: 100000 }); diff --git a/test/parallel/test-zlib-unzip-one-byte-chunks.js b/test/parallel/test-zlib-unzip-one-byte-chunks.js index be3b5dda818cf6..a4ed85acde0846 100644 --- a/test/parallel/test-zlib-unzip-one-byte-chunks.js +++ b/test/parallel/test-zlib-unzip-one-byte-chunks.js @@ -18,7 +18,7 @@ const unzip = zlib.createUnzip() .on('finish', common.mustCall(() => { assert.deepStrictEqual(Buffer.concat(resultBuffers).toString(), 'abcdef', `'${Buffer.concat(resultBuffers).toString()}' ` + - 'should match \'abcdef\' after ' + + "should match 'abcdef' after " + 'zipping and unzipping'); })); diff --git a/test/pseudo-tty/test-tty-isatty.js b/test/pseudo-tty/test-tty-isatty.js index 3a7b2940311221..3ffc8005e0374e 100644 --- a/test/pseudo-tty/test-tty-isatty.js +++ b/test/pseudo-tty/test-tty-isatty.js @@ -11,7 +11,7 @@ strictEqual(isatty(2), true, 'stderr reported to not be a tty, but it is'); strictEqual(isatty(-1), false, '-1 reported to be a tty, but it is not'); strictEqual(isatty(55555), false, '55555 reported to be a tty, but it is not'); strictEqual(isatty(1.1), false, '1.1 reported to be a tty, but it is not'); -strictEqual(isatty('1'), false, '\'1\' reported to be a tty, but it is not'); +strictEqual(isatty('1'), false, "'1' reported to be a tty, but it is not"); strictEqual(isatty({}), false, '{} reported to be a tty, but it is not'); strictEqual(isatty(() => {}), false, '() => {} reported to be a tty, but it is not'); diff --git a/test/pummel/test-crypto-dh.js b/test/pummel/test-crypto-dh.js index f64f982c0e1100..f92c3918cd786a 100644 --- a/test/pummel/test-crypto-dh.js +++ b/test/pummel/test-crypto-dh.js @@ -32,7 +32,7 @@ assert.throws( crypto.getDiffieHellman('unknown-group'); }, /^Error: Unknown group$/, - 'crypto.getDiffieHellman(\'unknown-group\') ' + + "crypto.getDiffieHellman('unknown-group') " + 'failed to throw the expected error.' ); assert.throws( @@ -41,7 +41,7 @@ assert.throws( }, new RegExp('^TypeError: crypto\\.getDiffieHellman\\(\\.\\.\\.\\)\\.' + 'setPrivateKey is not a function$'), - 'crypto.getDiffieHellman(\'modp1\').setPrivateKey(\'\') ' + + "crypto.getDiffieHellman('modp1').setPrivateKey('') " + 'failed to throw the expected error.' ); assert.throws( @@ -50,7 +50,7 @@ assert.throws( }, new RegExp('^TypeError: crypto\\.getDiffieHellman\\(\\.\\.\\.\\)\\.' + 'setPublicKey is not a function$'), - 'crypto.getDiffieHellman(\'modp1\').setPublicKey(\'\') ' + + "crypto.getDiffieHellman('modp1').setPublicKey('') " + 'failed to throw the expected error.' ); diff --git a/test/pummel/test-exec.js b/test/pummel/test-exec.js index 92b5cb64ec67e3..2ca2fac56f326e 100644 --- a/test/pummel/test-exec.js +++ b/test/pummel/test-exec.js @@ -118,7 +118,7 @@ function killMeTwiceCallback(err, stdout, stderr) { } -exec('python -c "print 200000*\'C\'"', { maxBuffer: 1000 }, +exec(`python -c "print 200000*'C'"`, { maxBuffer: 1000 }, function(err, stdout, stderr) { assert.ok(err); assert.ok(/maxBuffer/.test(err.message)); diff --git a/test/sequential/test-inspector-debug-end.js b/test/sequential/test-inspector-debug-end.js index dadee26258d346..50a4ce1a7be401 100644 --- a/test/sequential/test-inspector-debug-end.js +++ b/test/sequential/test-inspector-debug-end.js @@ -6,7 +6,7 @@ const { strictEqual } = require('assert'); const { NodeInstance } = require('../common/inspector-helper.js'); async function testNoServerNoCrash() { - console.log('Test there\'s no crash stopping server that was not started'); + console.log("Test there's no crash stopping server that was not started"); const instance = new NodeInstance([], `process._debugEnd(); process.exit(42);`); @@ -14,14 +14,14 @@ async function testNoServerNoCrash() { } async function testNoSessionNoCrash() { - console.log('Test there\'s no crash stopping server without connecting'); + console.log("Test there's no crash stopping server without connecting"); const instance = new NodeInstance('--inspect=0', 'process._debugEnd();process.exit(42);'); strictEqual(42, (await instance.expectShutdown()).exitCode); } async function testSessionNoCrash() { - console.log('Test there\'s no crash stopping server after connecting'); + console.log("Test there's no crash stopping server after connecting"); const script = `process._debugEnd(); process._debugProcess(process.pid); setTimeout(() => { diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js index 7bc8428fac5939..44979acdafced2 100644 --- a/test/sequential/test-module-loading.js +++ b/test/sequential/test-module-loading.js @@ -30,7 +30,7 @@ const backslash = /\\/g; console.error('load test-module-loading.js'); // assert that this is the main module. -assert.strictEqual(require.main.id, '.', 'main module should have id of \'.\''); +assert.strictEqual(require.main.id, '.', "main module should have id of '.'"); assert.strictEqual(require.main, module, 'require.main should === module'); assert.strictEqual(process.mainModule, module, 'process.mainModule should === module'); @@ -145,7 +145,7 @@ require.extensions['.test'] = function(module, filename) { let content = fs.readFileSync(filename).toString(); assert.strictEqual(content, 'this is custom source\n'); content = content.replace('this is custom source', - 'exports.test = \'passed\''); + "exports.test = 'passed'"); module._compile(content, filename); }; @@ -170,7 +170,7 @@ assert.strictEqual(require('../fixtures/foo').foo, 'ok', try { require('../fixtures/empty'); } catch (err) { - assert.strictEqual(err.message, 'Cannot find module \'../fixtures/empty\''); + assert.strictEqual(err.message, "Cannot find module '../fixtures/empty'"); } { diff --git a/tools/doc/json.js b/tools/doc/json.js index 44b67e3e284b17..e39155aef28f22 100644 --- a/tools/doc/json.js +++ b/tools/doc/json.js @@ -564,8 +564,8 @@ const ctorPrefix = '^(?:[Cc]onstructor: +)?new +'; const classMethodPrefix = '^Class Method: +'; const maybeClassPropertyPrefix = '(?:Class Property: +)?'; -const maybeQuote = '[\'"]?'; -const notQuotes = '[^\'"]+'; +const maybeQuote = `['"]?`; +const notQuotes = `[^'"]+`; // To include constructs like `readable\[Symbol.asyncIterator\]()` // or `readable.\_read(size)` (with Markdown escapes). diff --git a/tools/eslint-rules/inspector-check.js b/tools/eslint-rules/inspector-check.js index 00a2dd02963558..ae32cddf9ed5bd 100644 --- a/tools/eslint-rules/inspector-check.js +++ b/tools/eslint-rules/inspector-check.js @@ -11,7 +11,7 @@ const utils = require('./rules-utils.js'); // Rule Definition //------------------------------------------------------------------------------ const msg = 'Please add a skipIfInspectorDisabled() call to allow this ' + - 'test to be skippped when Node is built \'--without-inspector\'.'; + "test to be skippped when Node is built '--without-inspector'."; module.exports = function(context) { const missingCheckNodes = []; diff --git a/tools/eslint-rules/non-ascii-character.js b/tools/eslint-rules/non-ascii-character.js index e67aac7cd91e82..699f377de123bc 100644 --- a/tools/eslint-rules/non-ascii-character.js +++ b/tools/eslint-rules/non-ascii-character.js @@ -13,9 +13,9 @@ const nonAsciiRegexPattern = /[^\r\n\x20-\x7e]/; const suggestions = { - '’': '\'', - '‛': '\'', - '‘': '\'', + '’': "'", + '‛': "'", + '‘': "'", '“': '"', '‟': '"', '”': '"', diff --git a/tools/eslint-rules/require-buffer.js b/tools/eslint-rules/require-buffer.js index b12b9ce04e7cfc..7fd1b2d84538e0 100644 --- a/tools/eslint-rules/require-buffer.js +++ b/tools/eslint-rules/require-buffer.js @@ -1,5 +1,5 @@ 'use strict'; -const BUFFER_REQUIRE = 'const { Buffer } = require(\'buffer\');'; +const BUFFER_REQUIRE = "const { Buffer } = require('buffer');"; module.exports = function(context) {