summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVse Mozhet Byt <vsemozhetbyt@gmail.com>2017-04-28 04:06:42 +0300
committerVse Mozhet Byt <vsemozhetbyt@gmail.com>2017-05-05 17:39:05 +0300
commit8b76c3e60c7b5c274c757257580a2c0faae69097 (patch)
treea9f686995887dbeb0b5c5b23c5f3188987c99b2e
parent6bcf65d4a788a73b3c3f27d75796609f948f7885 (diff)
downloadnode-new-8b76c3e60c7b5c274c757257580a2c0faae69097.tar.gz
test: reduce string concatenations
PR-URL: https://github.com/nodejs/node/pull/12735 Refs: https://github.com/nodejs/node/pull/12455 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
-rw-r--r--test/addons/repl-domain-abort/test.js2
-rw-r--r--test/common/index.js20
-rw-r--r--test/debugger/helper-debugger-repl.js16
-rw-r--r--test/debugger/test-debugger-repl-utf8.js2
-rw-r--r--test/gc/test-http-client-connaborted.js2
-rw-r--r--test/gc/test-http-client-onerror.js2
-rw-r--r--test/gc/test-http-client-timeout.js2
-rw-r--r--test/gc/test-http-client.js2
-rw-r--r--test/gc/test-net-timeout.js2
-rw-r--r--test/inspector/inspector-helper.js22
-rw-r--r--test/inspector/test-inspector.js6
-rw-r--r--test/internet/test-dns-cares-domains.js2
-rw-r--r--test/internet/test-dns-ipv6.js2
-rw-r--r--test/internet/test-dns.js2
-rw-r--r--test/internet/test-tls-add-ca-cert.js2
-rw-r--r--test/known_issues/test-cwd-enoent-file.js2
-rw-r--r--test/parallel/test-assert.js2
-rw-r--r--test/parallel/test-async-wrap-check-providers.js4
-rw-r--r--test/parallel/test-buffer-badhex.js2
-rw-r--r--test/parallel/test-buffer-includes.js2
-rw-r--r--test/parallel/test-buffer-indexof.js2
-rw-r--r--test/parallel/test-child-process-buffering.js4
-rw-r--r--test/parallel/test-child-process-default-options.js2
-rw-r--r--test/parallel/test-child-process-double-pipe.js4
-rw-r--r--test/parallel/test-child-process-env.js2
-rw-r--r--test/parallel/test-child-process-exec-env.js6
-rw-r--r--test/parallel/test-child-process-fork-close.js2
-rw-r--r--test/parallel/test-child-process-fork.js2
-rw-r--r--test/parallel/test-child-process-fork3.js2
-rw-r--r--test/parallel/test-child-process-internal.js4
-rw-r--r--test/parallel/test-child-process-ipc.js4
-rw-r--r--test/parallel/test-child-process-set-blocking.js2
-rw-r--r--test/parallel/test-child-process-spawn-error.js2
-rw-r--r--test/parallel/test-child-process-spawn-typeerror.js2
-rw-r--r--test/parallel/test-child-process-spawnsync-input.js8
-rw-r--r--test/parallel/test-child-process-spawnsync-maxbuf.js2
-rw-r--r--test/parallel/test-child-process-stdin.js2
-rw-r--r--test/parallel/test-cli-eval.js6
-rw-r--r--test/parallel/test-cli-node-options.js7
-rw-r--r--test/parallel/test-cli-syntax.js12
-rw-r--r--test/parallel/test-cluster-bind-twice.js4
-rw-r--r--test/parallel/test-cluster-eaccess.js2
-rw-r--r--test/parallel/test-cluster-eaddrinuse.js4
-rw-r--r--test/parallel/test-cluster-message.js7
-rw-r--r--test/parallel/test-cluster-worker-exit.js7
-rw-r--r--test/parallel/test-cluster-worker-kill.js7
-rw-r--r--test/parallel/test-console.js8
-rw-r--r--test/parallel/test-crypto-authenticated.js2
-rw-r--r--test/parallel/test-crypto-binary-default.js27
-rw-r--r--test/parallel/test-crypto-certificate.js6
-rw-r--r--test/parallel/test-crypto-fips.js11
-rw-r--r--test/parallel/test-crypto-rsa-dsa.js28
-rw-r--r--test/parallel/test-crypto-sign-verify.js12
-rw-r--r--test/parallel/test-crypto-verify-failure.js6
-rw-r--r--test/parallel/test-crypto.js12
-rw-r--r--test/parallel/test-cwd-enoent-preload.js2
-rw-r--r--test/parallel/test-cwd-enoent-repl.js2
-rw-r--r--test/parallel/test-cwd-enoent.js2
-rw-r--r--test/parallel/test-dgram-bind-shared-ports.js4
-rw-r--r--test/parallel/test-dgram-error-message-address.js2
-rw-r--r--test/parallel/test-domain-enter-exit.js10
-rw-r--r--test/parallel/test-domain-uncaught-exception.js9
-rw-r--r--test/parallel/test-domain-with-abort-on-uncaught-exception.js10
-rw-r--r--test/parallel/test-domain.js4
-rw-r--r--test/parallel/test-dsa-fips-invalid-key.js4
-rw-r--r--test/parallel/test-error-reporting.js3
-rw-r--r--test/parallel/test-eval.js2
-rw-r--r--test/parallel/test-exception-handler2.js2
-rw-r--r--test/parallel/test-file-write-stream2.js8
-rw-r--r--test/parallel/test-file-write-stream3.js6
-rw-r--r--test/parallel/test-fs-append-file-sync.js2
-rw-r--r--test/parallel/test-fs-append-file.js2
-rw-r--r--test/parallel/test-fs-buffertype-writesync.js2
-rw-r--r--test/parallel/test-fs-error-messages.js7
-rw-r--r--test/parallel/test-fs-exists.js4
-rw-r--r--test/parallel/test-fs-mkdir.js6
-rw-r--r--test/parallel/test-fs-non-number-arguments-throw.js5
-rw-r--r--test/parallel/test-fs-readdir.js2
-rw-r--r--test/parallel/test-fs-readfile-error.js4
-rw-r--r--test/parallel/test-fs-realpath.js86
-rw-r--r--test/parallel/test-fs-sir-writes-alot.js2
-rw-r--r--test/parallel/test-fs-stat.js14
-rw-r--r--test/parallel/test-fs-stream-double-close.js6
-rw-r--r--test/parallel/test-fs-symlink-dir-junction-relative.js4
-rw-r--r--test/parallel/test-fs-symlink-dir-junction.js4
-rw-r--r--test/parallel/test-fs-timestamp-parsing-error.js2
-rw-r--r--test/parallel/test-fs-truncate-GH-6233.js2
-rw-r--r--test/parallel/test-fs-write-file.js2
-rw-r--r--test/parallel/test-fs-write-stream-err.js2
-rw-r--r--test/parallel/test-fs-write-string-coerce.js2
-rw-r--r--test/parallel/test-http-abort-client.js4
-rw-r--r--test/parallel/test-http-abort-queued.js4
-rw-r--r--test/parallel/test-http-after-connect.js4
-rw-r--r--test/parallel/test-http-agent-error-on-idle.js2
-rw-r--r--test/parallel/test-http-agent-getname.js2
-rw-r--r--test/parallel/test-http-agent-maxsockets.js2
-rw-r--r--test/parallel/test-http-buffer-sanity.js2
-rw-r--r--test/parallel/test-http-chunk-problem.js2
-rw-r--r--test/parallel/test-http-client-abort.js8
-rw-r--r--test/parallel/test-http-client-agent.js2
-rw-r--r--test/parallel/test-http-client-default-headers-exist.js6
-rw-r--r--test/parallel/test-http-client-timeout-agent.js12
-rw-r--r--test/parallel/test-http-client-timeout-with-data.js2
-rw-r--r--test/parallel/test-http-client-unescaped-path.js2
-rw-r--r--test/parallel/test-http-client-upload.js2
-rw-r--r--test/parallel/test-http-connect-req-res.js2
-rw-r--r--test/parallel/test-http-connect.js2
-rw-r--r--test/parallel/test-http-contentLength0.js2
-rw-r--r--test/parallel/test-http-default-port.js4
-rw-r--r--test/parallel/test-http-exceptions.js4
-rw-r--r--test/parallel/test-http-expect-continue.js4
-rw-r--r--test/parallel/test-http-expect-handling.js4
-rw-r--r--test/parallel/test-http-extra-response.js4
-rw-r--r--test/parallel/test-http-full-response.js2
-rw-r--r--test/parallel/test-http-get-pipeline-problem.js22
-rw-r--r--test/parallel/test-http-host-headers.js16
-rw-r--r--test/parallel/test-http-invalidheaderfield2.js32
-rw-r--r--test/parallel/test-http-keepalive-client.js4
-rw-r--r--test/parallel/test-http-keepalive-maxsockets.js4
-rw-r--r--test/parallel/test-http-keepalive-request.js4
-rw-r--r--test/parallel/test-http-localaddress-bind-error.js6
-rw-r--r--test/parallel/test-http-localaddress.js4
-rw-r--r--test/parallel/test-http-malformed-request.js2
-rw-r--r--test/parallel/test-http-max-headers-count.js2
-rw-r--r--test/parallel/test-http-outgoing-finish.js4
-rw-r--r--test/parallel/test-http-parser.js36
-rw-r--r--test/parallel/test-http-pipe-fs.js4
-rw-r--r--test/parallel/test-http-proxy.js4
-rw-r--r--test/parallel/test-http-request-methods.js2
-rw-r--r--test/parallel/test-http-response-no-headers.js3
-rw-r--r--test/parallel/test-http-response-status-message.js4
-rw-r--r--test/parallel/test-http-server-multiheaders2.js9
-rw-r--r--test/parallel/test-http-should-keep-alive.js8
-rw-r--r--test/parallel/test-http-status-code.js6
-rw-r--r--test/parallel/test-http-upgrade-agent.js2
-rw-r--r--test/parallel/test-http-url.parse-basic.js2
-rw-r--r--test/parallel/test-http-url.parse-https.request.js4
-rw-r--r--test/parallel/test-http-url.parse-post.js2
-rw-r--r--test/parallel/test-http-write-empty-string.js2
-rw-r--r--test/parallel/test-http.js2
-rw-r--r--test/parallel/test-https-agent-create-connection.js4
-rw-r--r--test/parallel/test-https-agent-disable-session-reuse.js4
-rw-r--r--test/parallel/test-https-agent-secure-protocol.js6
-rw-r--r--test/parallel/test-https-agent-servername.js6
-rw-r--r--test/parallel/test-https-agent-session-eviction.js4
-rw-r--r--test/parallel/test-https-agent-session-reuse.js6
-rw-r--r--test/parallel/test-https-agent-sni.js8
-rw-r--r--test/parallel/test-https-agent-sockets-leak.js6
-rw-r--r--test/parallel/test-https-agent.js4
-rw-r--r--test/parallel/test-https-byteswritten.js4
-rw-r--r--test/parallel/test-https-client-get-url.js4
-rw-r--r--test/parallel/test-https-client-resume.js4
-rw-r--r--test/parallel/test-https-close.js6
-rw-r--r--test/parallel/test-https-drain.js4
-rw-r--r--test/parallel/test-https-eof-for-eom.js4
-rw-r--r--test/parallel/test-https-foafssl.js4
-rw-r--r--test/parallel/test-https-host-headers.js26
-rw-r--r--test/parallel/test-https-localaddress-bind-error.js10
-rw-r--r--test/parallel/test-https-localaddress.js8
-rw-r--r--test/parallel/test-https-pfx.js2
-rw-r--r--test/parallel/test-https-req-split.js6
-rw-r--r--test/parallel/test-https-resume-after-renew.js6
-rw-r--r--test/parallel/test-https-simple.js4
-rw-r--r--test/parallel/test-https-socket-options.js4
-rw-r--r--test/parallel/test-https-strict.js2
-rw-r--r--test/parallel/test-https-timeout-server-2.js4
-rw-r--r--test/parallel/test-https-timeout-server.js4
-rw-r--r--test/parallel/test-https-timeout.js4
-rw-r--r--test/parallel/test-https-truncate.js4
-rw-r--r--test/parallel/test-intl.js10
-rw-r--r--test/parallel/test-module-globalpaths-nodepath.js4
-rw-r--r--test/parallel/test-module-loading-globalpaths.js6
-rw-r--r--test/parallel/test-module-nodemodulepaths.js5
-rw-r--r--test/parallel/test-module-require-depth.js4
-rw-r--r--test/parallel/test-net-better-error-messages-path.js2
-rw-r--r--test/parallel/test-net-bytes-stats.js6
-rw-r--r--test/parallel/test-net-connect-buffer.js4
-rw-r--r--test/parallel/test-net-connect-options-allowhalfopen.js2
-rw-r--r--test/parallel/test-net-connect-options-fd.js8
-rw-r--r--test/parallel/test-net-connect-options-port.js6
-rw-r--r--test/parallel/test-net-internal.js2
-rw-r--r--test/parallel/test-net-listen-shared-ports.js4
-rw-r--r--test/parallel/test-net-pipe-connect-errors.js2
-rw-r--r--test/parallel/test-net-reconnect-error.js2
-rw-r--r--test/parallel/test-net-reconnect.js4
-rw-r--r--test/parallel/test-net-server-bind.js4
-rw-r--r--test/parallel/test-net-server-listen-handle.js4
-rw-r--r--test/parallel/test-net-server-listen-path.js2
-rw-r--r--test/parallel/test-net-server-max-connections-close-makes-more-available.js16
-rw-r--r--test/parallel/test-next-tick-ordering.js2
-rw-r--r--test/parallel/test-npm-install.js4
-rw-r--r--test/parallel/test-openssl-ca-options.js6
-rw-r--r--test/parallel/test-os.js2
-rw-r--r--test/parallel/test-path-makelong.js6
-rw-r--r--test/parallel/test-path-parse-format.js10
-rw-r--r--test/parallel/test-path.js33
-rw-r--r--test/parallel/test-preload.js20
-rw-r--r--test/parallel/test-process-exit-code.js6
-rw-r--r--test/parallel/test-process-raw-debug.js4
-rw-r--r--test/parallel/test-process-redirect-warnings-env.js2
-rw-r--r--test/parallel/test-process-redirect-warnings.js2
-rw-r--r--test/parallel/test-promises-unhandled-rejections.js4
-rw-r--r--test/parallel/test-querystring-maxKeys-non-finite.js2
-rw-r--r--test/parallel/test-readline-interface.js8
-rw-r--r--test/parallel/test-regress-GH-1531.js4
-rw-r--r--test/parallel/test-regress-GH-3739.js2
-rw-r--r--test/parallel/test-regress-GH-9819.js2
-rw-r--r--test/parallel/test-repl-autolibs.js4
-rw-r--r--test/parallel/test-repl-definecommand.js2
-rw-r--r--test/parallel/test-repl-envvars.js8
-rw-r--r--test/parallel/test-repl-mode.js24
-rw-r--r--test/parallel/test-repl-persistent-history.js16
-rw-r--r--test/parallel/test-repl-save-load.js21
-rw-r--r--test/parallel/test-repl-tab-complete.js2
-rw-r--r--test/parallel/test-repl.js115
-rw-r--r--test/parallel/test-require-dot.js6
-rw-r--r--test/parallel/test-require-exceptions.js4
-rw-r--r--test/parallel/test-signal-handler.js4
-rw-r--r--test/parallel/test-signal-unregister.js2
-rw-r--r--test/parallel/test-socket-write-after-fin-error.js2
-rw-r--r--test/parallel/test-spawn-cmd-named-pipe.js6
-rw-r--r--test/parallel/test-stdin-from-file.js7
-rw-r--r--test/parallel/test-stdin-script-child.js4
-rw-r--r--test/parallel/test-stdout-stderr-reading.js4
-rw-r--r--test/parallel/test-stdout-to-file.js9
-rw-r--r--test/parallel/test-stream-base-no-abort.js4
-rw-r--r--test/parallel/test-stream-push-strings.js2
-rw-r--r--test/parallel/test-stream-readable-flow-recursion.js4
-rw-r--r--test/parallel/test-stream2-base64-single-char-read-end.js2
-rw-r--r--test/parallel/test-stream2-readable-empty-buffer-no-eof.js4
-rw-r--r--test/parallel/test-stream2-transform.js2
-rw-r--r--test/parallel/test-stream2-writable.js4
-rw-r--r--test/parallel/test-string-decoder.js2
-rw-r--r--test/parallel/test-tcp-wrap-listen.js4
-rw-r--r--test/parallel/test-timers-ordering.js5
-rw-r--r--test/parallel/test-tls-0-dns-altname.js4
-rw-r--r--test/parallel/test-tls-alert-handling.js2
-rw-r--r--test/parallel/test-tls-alert.js2
-rw-r--r--test/parallel/test-tls-alpn-server-client.js2
-rw-r--r--test/parallel/test-tls-ca-concat.js2
-rw-r--r--test/parallel/test-tls-client-destroy-soon.js4
-rw-r--r--test/parallel/test-tls-client-getephemeralkeyinfo.js6
-rw-r--r--test/parallel/test-tls-client-mindhsize.js6
-rw-r--r--test/parallel/test-tls-client-resume.js4
-rw-r--r--test/parallel/test-tls-client-verify.js4
-rw-r--r--test/parallel/test-tls-close-error.js4
-rw-r--r--test/parallel/test-tls-close-notify.js4
-rw-r--r--test/parallel/test-tls-cnnic-whitelist.js2
-rw-r--r--test/parallel/test-tls-connect-pipe.js4
-rw-r--r--test/parallel/test-tls-connect-simple.js4
-rw-r--r--test/parallel/test-tls-connect-stream-writes.js6
-rw-r--r--test/parallel/test-tls-delayed-attach-error.js4
-rw-r--r--test/parallel/test-tls-delayed-attach.js4
-rw-r--r--test/parallel/test-tls-dhe.js8
-rw-r--r--test/parallel/test-tls-ecdh-disable.js8
-rw-r--r--test/parallel/test-tls-ecdh.js8
-rw-r--r--test/parallel/test-tls-env-bad-extra-ca.js2
-rw-r--r--test/parallel/test-tls-env-extra-ca.js6
-rw-r--r--test/parallel/test-tls-fast-writing.js6
-rw-r--r--test/parallel/test-tls-friendly-error-message.js4
-rw-r--r--test/parallel/test-tls-getcipher.js4
-rw-r--r--test/parallel/test-tls-getprotocol.js4
-rw-r--r--test/parallel/test-tls-handshake-error.js4
-rw-r--r--test/parallel/test-tls-hello-parser-failure.js4
-rw-r--r--test/parallel/test-tls-honorcipherorder.js4
-rw-r--r--test/parallel/test-tls-interleave.js6
-rw-r--r--test/parallel/test-tls-invoke-queued.js4
-rw-r--r--test/parallel/test-tls-js-stream.js4
-rw-r--r--test/parallel/test-tls-junk-closes-server.js4
-rw-r--r--test/parallel/test-tls-key-mismatch.js4
-rw-r--r--test/parallel/test-tls-max-send-fragment.js4
-rw-r--r--test/parallel/test-tls-multi-key.js8
-rw-r--r--test/parallel/test-tls-no-rsa-key.js4
-rw-r--r--test/parallel/test-tls-no-sslv3.js6
-rw-r--r--test/parallel/test-tls-npn-server-client.js2
-rw-r--r--test/parallel/test-tls-on-empty-socket.js4
-rw-r--r--test/parallel/test-tls-over-http-tunnel.js4
-rw-r--r--test/parallel/test-tls-pause.js4
-rw-r--r--test/parallel/test-tls-regr-gh-5108.js4
-rw-r--r--test/parallel/test-tls-request-timeout.js4
-rw-r--r--test/parallel/test-tls-retain-handle-no-abort.js4
-rw-r--r--test/parallel/test-tls-securepair-fiftharg.js6
-rw-r--r--test/parallel/test-tls-securepair-server.js6
-rw-r--r--test/parallel/test-tls-server-connection-server.js4
-rw-r--r--test/parallel/test-tls-server-verify.js52
-rw-r--r--test/parallel/test-tls-set-ciphers.js8
-rw-r--r--test/parallel/test-tls-set-encoding.js4
-rw-r--r--test/parallel/test-tls-sni-option.js2
-rw-r--r--test/parallel/test-tls-sni-server-client.js2
-rw-r--r--test/parallel/test-tls-socket-close.js4
-rw-r--r--test/parallel/test-tls-socket-destroy.js4
-rw-r--r--test/parallel/test-tls-startcom-wosign-whitelist.js2
-rw-r--r--test/parallel/test-tls-starttls-server.js4
-rw-r--r--test/parallel/test-tls-ticket.js4
-rw-r--r--test/parallel/test-tls-timeout-server-2.js4
-rw-r--r--test/parallel/test-tls-timeout-server.js4
-rw-r--r--test/parallel/test-tls-two-cas-one-string.js2
-rw-r--r--test/parallel/test-tls-wrap-timeout.js4
-rw-r--r--test/parallel/test-url-format.js8
-rw-r--r--test/parallel/test-url-parse-format.js2
-rw-r--r--test/parallel/test-util-inspect.js3
-rw-r--r--test/parallel/test-vm-cached-data.js2
-rw-r--r--test/parallel/test-vm-create-context-accessors.js2
-rw-r--r--test/parallel/test-vm-debug-context.js4
-rw-r--r--test/parallel/test-vm-syntax-error-stderr.js2
-rw-r--r--test/parallel/test-zlib-convenience-methods.js8
-rw-r--r--test/parallel/test-zlib-deflate-constructors.js2
-rw-r--r--test/parallel/test-zlib-from-gzip.js2
-rw-r--r--test/parallel/test-zlib-invalid-input.js4
-rw-r--r--test/parallel/test-zlib.js28
-rw-r--r--test/pseudo-tty/no_dropped_stdio.js4
-rw-r--r--test/pseudo-tty/no_interleaved_stdio.js4
-rw-r--r--test/pummel/test-abort-fatal-error.js2
-rw-r--r--test/pummel/test-child-process-spawn-loop.js4
-rw-r--r--test/pummel/test-dtrace-jsstack.js16
-rw-r--r--test/pummel/test-exec.js14
-rw-r--r--test/pummel/test-fs-watch-file.js2
-rw-r--r--test/pummel/test-http-client-reconnect-bug.js2
-rw-r--r--test/pummel/test-https-ci-reneg-attack.js12
-rw-r--r--test/pummel/test-https-large-response.js4
-rw-r--r--test/pummel/test-net-pause.js8
-rw-r--r--test/pummel/test-net-pingpong.js6
-rw-r--r--test/pummel/test-net-throttle.js6
-rw-r--r--test/pummel/test-net-timeout.js6
-rw-r--r--test/pummel/test-net-timeout2.js2
-rw-r--r--test/pummel/test-net-write-callbacks.js6
-rw-r--r--test/pummel/test-regress-GH-814_2.js2
-rw-r--r--test/pummel/test-regress-GH-892.js4
-rw-r--r--test/pummel/test-timers.js4
-rw-r--r--test/pummel/test-tls-ci-reneg-attack.js12
-rw-r--r--test/pummel/test-tls-connect-memleak.js4
-rw-r--r--test/pummel/test-tls-securepair-client.js6
-rw-r--r--test/pummel/test-tls-server-large-request.js4
-rw-r--r--test/pummel/test-tls-session-timeout.js2
-rw-r--r--test/pummel/test-tls-throttle.js4
-rw-r--r--test/sequential/test-child-process-execsync.js6
-rw-r--r--test/sequential/test-deprecation-flags.js8
-rw-r--r--test/sequential/test-dgram-pingpong.js4
-rw-r--r--test/sequential/test-domain-abort-on-uncaught.js7
-rw-r--r--test/sequential/test-https-set-timeout-server.js4
-rw-r--r--test/sequential/test-module-loading.js18
-rw-r--r--test/sequential/test-net-GH-5504.js2
-rw-r--r--test/sequential/test-process-warnings.js2
-rw-r--r--test/sequential/test-regress-GH-1697.js2
-rw-r--r--test/sequential/test-regress-GH-4015.js4
-rw-r--r--test/sequential/test-regress-GH-784.js4
-rw-r--r--test/sequential/test-regress-GH-877.js7
-rw-r--r--test/sequential/test-repl-timeout-throw.js2
-rw-r--r--test/sequential/test-require-cache-without-stat.js4
-rw-r--r--test/sequential/test-stream2-stderr-sync.js6
350 files changed, 1001 insertions, 1075 deletions
diff --git a/test/addons/repl-domain-abort/test.js b/test/addons/repl-domain-abort/test.js
index 66b08d507a..4d217e0456 100644
--- a/test/addons/repl-domain-abort/test.js
+++ b/test/addons/repl-domain-abort/test.js
@@ -39,7 +39,7 @@ process.on('exit', function() {
const lines = [
// This line shouldn't cause an assertion error.
- 'require(\'' + buildPath + '\')' +
+ `require('${buildPath}')` +
// Log output to double check callback ran.
'.method(function() { console.log(\'cb_ran\'); });',
];
diff --git a/test/common/index.js b/test/common/index.js
index 3b707a93ba..a10adc4d0d 100644
--- a/test/common/index.js
+++ b/test/common/index.js
@@ -55,9 +55,8 @@ exports.isLinux = process.platform === 'linux';
exports.isOSX = process.platform === 'darwin';
exports.enoughTestMem = os.totalmem() > 0x40000000; /* 1 Gb */
-exports.bufferMaxSizeMsg = new RegExp('^RangeError: "size" argument' +
- ' must not be larger than ' +
- buffer.kMaxLength + '$');
+exports.bufferMaxSizeMsg = new RegExp(
+ `^RangeError: "size" argument must not be larger than ${buffer.kMaxLength}$`);
const cpus = os.cpus();
exports.enoughTestCpu = Array.isArray(cpus) &&
(cpus.length > 1 || cpus[0].speed > 999);
@@ -118,7 +117,7 @@ exports.refreshTmpDir = function() {
if (process.env.TEST_THREAD_ID) {
exports.PORT += process.env.TEST_THREAD_ID * 100;
- exports.tmpDirName += '.' + process.env.TEST_THREAD_ID;
+ exports.tmpDirName += `.${process.env.TEST_THREAD_ID}`;
}
exports.tmpDir = path.join(testRoot, exports.tmpDirName);
@@ -217,10 +216,10 @@ Object.defineProperty(exports, 'hasFipsCrypto', {
if (exports.isWindows) {
exports.PIPE = '\\\\.\\pipe\\libuv-test';
if (process.env.TEST_THREAD_ID) {
- exports.PIPE += '.' + process.env.TEST_THREAD_ID;
+ exports.PIPE += `.${process.env.TEST_THREAD_ID}`;
}
} else {
- exports.PIPE = exports.tmpDir + '/test.sock';
+ exports.PIPE = `${exports.tmpDir}/test.sock`;
}
const ifaces = os.networkInterfaces();
@@ -256,10 +255,9 @@ exports.childShouldThrowAndAbort = function() {
exports.ddCommand = function(filename, kilobytes) {
if (exports.isWindows) {
const p = path.resolve(exports.fixturesDir, 'create-file.js');
- return '"' + process.argv[0] + '" "' + p + '" "' +
- filename + '" ' + (kilobytes * 1024);
+ return `"${process.argv[0]}" "${p}" "${filename}" ${kilobytes * 1024}`;
} else {
- return 'dd if=/dev/zero of="' + filename + '" bs=1024 count=' + kilobytes;
+ return `dd if=/dev/zero of="${filename}" bs=1024 count=${kilobytes}`;
}
};
@@ -495,7 +493,7 @@ exports.canCreateSymLink = function() {
let output = '';
try {
- output = execSync(whoamiPath + ' /priv', { timout: 1000 });
+ output = execSync(`${whoamiPath} /priv`, { timout: 1000 });
} catch (e) {
err = true;
} finally {
@@ -522,7 +520,7 @@ exports.skip = function(msg) {
function ArrayStream() {
this.run = function(data) {
data.forEach((line) => {
- this.emit('data', line + '\n');
+ this.emit('data', `${line}\n`);
});
};
}
diff --git a/test/debugger/helper-debugger-repl.js b/test/debugger/helper-debugger-repl.js
index cbd29d7674..234a401023 100644
--- a/test/debugger/helper-debugger-repl.js
+++ b/test/debugger/helper-debugger-repl.js
@@ -34,11 +34,11 @@ let quit;
function startDebugger(scriptToDebug) {
scriptToDebug = process.env.NODE_DEBUGGER_TEST_SCRIPT ||
- common.fixturesDir + '/' + scriptToDebug;
+ `${common.fixturesDir}/${scriptToDebug}`;
- child = spawn(process.execPath, ['debug', '--port=' + port, scriptToDebug]);
+ child = spawn(process.execPath, ['debug', `--port=${port}`, scriptToDebug]);
- console.error('./node', 'debug', '--port=' + port, scriptToDebug);
+ console.error('./node', 'debug', `--port=${port}`, scriptToDebug);
child.stdout.setEncoding('utf-8');
child.stdout.on('data', function(data) {
@@ -53,10 +53,10 @@ function startDebugger(scriptToDebug) {
child.on('line', function(line) {
line = line.replace(/^(debug> *)+/, '');
console.log(line);
- assert.ok(expected.length > 0, 'Got unexpected line: ' + line);
+ assert.ok(expected.length > 0, `Got unexpected line: ${line}`);
const expectedLine = expected[0].lines.shift();
- assert.ok(line.match(expectedLine) !== null, line + ' != ' + expectedLine);
+ assert.ok(line.match(expectedLine) !== null, `${line} != ${expectedLine}`);
if (expected[0].lines.length === 0) {
const callback = expected[0].callback;
@@ -83,7 +83,7 @@ function startDebugger(scriptToDebug) {
console.error('dying badly buffer=%j', buffer);
let err = 'Timeout';
if (expected.length > 0 && expected[0].lines) {
- err = err + '. Expected: ' + expected[0].lines.shift();
+ err = `${err}. Expected: ${expected[0].lines.shift()}`;
}
child.on('close', function() {
@@ -112,8 +112,8 @@ function startDebugger(scriptToDebug) {
function addTest(input, output) {
function next() {
if (expected.length > 0) {
- console.log('debug> ' + expected[0].input);
- child.stdin.write(expected[0].input + '\n');
+ console.log(`debug> ${expected[0].input}`);
+ child.stdin.write(`${expected[0].input}\n`);
if (!expected[0].lines) {
const callback = expected[0].callback;
diff --git a/test/debugger/test-debugger-repl-utf8.js b/test/debugger/test-debugger-repl-utf8.js
index 8a88c97d14..76e604dd23 100644
--- a/test/debugger/test-debugger-repl-utf8.js
+++ b/test/debugger/test-debugger-repl-utf8.js
@@ -21,7 +21,7 @@
'use strict';
const common = require('../common');
-const script = common.fixturesDir + '/breakpoints_utf8.js';
+const script = `${common.fixturesDir}/breakpoints_utf8.js`;
process.env.NODE_DEBUGGER_TEST_SCRIPT = script;
require('./test-debugger-repl.js');
diff --git a/test/gc/test-http-client-connaborted.js b/test/gc/test-http-client-connaborted.js
index b0c8c1dd2f..008d75bca5 100644
--- a/test/gc/test-http-client-connaborted.js
+++ b/test/gc/test-http-client-connaborted.js
@@ -15,7 +15,7 @@ let done = 0;
let count = 0;
let countGC = 0;
-console.log('We should do ' + todo + ' requests');
+console.log(`We should do ${todo} requests`);
const server = http.createServer(serverHandler);
server.listen(0, getall);
diff --git a/test/gc/test-http-client-onerror.js b/test/gc/test-http-client-onerror.js
index 53a98626ed..0baa310a04 100644
--- a/test/gc/test-http-client-onerror.js
+++ b/test/gc/test-http-client-onerror.js
@@ -17,7 +17,7 @@ let done = 0;
let count = 0;
let countGC = 0;
-console.log('We should do ' + todo + ' requests');
+console.log(`We should do ${todo} requests`);
const server = http.createServer(serverHandler);
server.listen(0, runTest);
diff --git a/test/gc/test-http-client-timeout.js b/test/gc/test-http-client-timeout.js
index f37daacd21..c396a89032 100644
--- a/test/gc/test-http-client-timeout.js
+++ b/test/gc/test-http-client-timeout.js
@@ -19,7 +19,7 @@ let done = 0;
let count = 0;
let countGC = 0;
-console.log('We should do ' + todo + ' requests');
+console.log(`We should do ${todo} requests`);
const server = http.createServer(serverHandler);
server.listen(0, getall);
diff --git a/test/gc/test-http-client.js b/test/gc/test-http-client.js
index 5c7cab8c97..569dc57491 100644
--- a/test/gc/test-http-client.js
+++ b/test/gc/test-http-client.js
@@ -15,7 +15,7 @@ let done = 0;
let count = 0;
let countGC = 0;
-console.log('We should do ' + todo + ' requests');
+console.log(`We should do ${todo} requests`);
const server = http.createServer(serverHandler);
server.listen(0, getall);
diff --git a/test/gc/test-net-timeout.js b/test/gc/test-net-timeout.js
index ad6c29e28b..05d854d18e 100644
--- a/test/gc/test-net-timeout.js
+++ b/test/gc/test-net-timeout.js
@@ -26,7 +26,7 @@ let done = 0;
let count = 0;
let countGC = 0;
-console.log('We should do ' + todo + ' requests');
+console.log(`We should do ${todo} requests`);
const server = net.createServer(serverHandler);
server.listen(0, getall);
diff --git a/test/inspector/inspector-helper.js b/test/inspector/inspector-helper.js
index 1f58287068..d3d975ade8 100644
--- a/test/inspector/inspector-helper.js
+++ b/test/inspector/inspector-helper.js
@@ -169,13 +169,15 @@ TestSession.prototype.processMessage_ = function(message) {
assert.strictEqual(id, this.expectedId_);
this.expectedId_++;
if (this.responseCheckers_[id]) {
- assert(message['result'], JSON.stringify(message) + ' (response to ' +
- JSON.stringify(this.messages_[id]) + ')');
+ const messageJSON = JSON.stringify(message);
+ const idJSON = JSON.stringify(this.messages_[id]);
+ assert(message['result'], `${messageJSON} (response to ${idJSON})`);
this.responseCheckers_[id](message['result']);
delete this.responseCheckers_[id];
}
- assert(!message['error'], JSON.stringify(message) + ' (replying to ' +
- JSON.stringify(this.messages_[id]) + ')');
+ const messageJSON = JSON.stringify(message);
+ const idJSON = JSON.stringify(this.messages_[id]);
+ assert(!message['error'], `${messageJSON} (replying to ${idJSON})`);
delete this.messages_[id];
if (id === this.lastId_) {
this.lastMessageResponseCallback_ && this.lastMessageResponseCallback_();
@@ -213,12 +215,8 @@ TestSession.prototype.sendInspectorCommands = function(commands) {
};
this.sendAll_(commands, () => {
timeoutId = setTimeout(() => {
- let s = '';
- for (const id in this.messages_) {
- s += id + ', ';
- }
- assert.fail('Messages without response: ' +
- s.substring(0, s.length - 2));
+ assert.fail(`Messages without response: ${
+ Object.keys(this.messages_).join(', ')}`);
}, TIMEOUT);
});
});
@@ -241,7 +239,7 @@ TestSession.prototype.expectMessages = function(expects) {
if (!(expects instanceof Array)) expects = [ expects ];
const callback = this.createCallbackWithTimeout_(
- 'Matching response was not received:\n' + expects[0]);
+ `Matching response was not received:\n${expects[0]}`);
this.messagefilter_ = (message) => {
if (expects[0](message))
expects.shift();
@@ -256,7 +254,7 @@ TestSession.prototype.expectMessages = function(expects) {
TestSession.prototype.expectStderrOutput = function(regexp) {
this.harness_.addStderrFilter(
regexp,
- this.createCallbackWithTimeout_('Timed out waiting for ' + regexp));
+ this.createCallbackWithTimeout_(`Timed out waiting for ${regexp}`));
return this;
};
diff --git a/test/inspector/test-inspector.js b/test/inspector/test-inspector.js
index 0fb8b17995..865d9a0015 100644
--- a/test/inspector/test-inspector.js
+++ b/test/inspector/test-inspector.js
@@ -19,7 +19,7 @@ function checkVersion(err, response) {
assert.ifError(err);
assert.ok(response);
const expected = {
- 'Browser': 'node.js/' + process.version,
+ 'Browser': `node.js/${process.version}`,
'Protocol-Version': '1.1',
};
assert.strictEqual(JSON.stringify(response),
@@ -36,7 +36,7 @@ function expectMainScriptSource(result) {
const expected = helper.mainScriptSource();
const source = result['scriptSource'];
assert(source && (source.includes(expected)),
- 'Script source is wrong: ' + source);
+ `Script source is wrong: ${source}`);
}
function setupExpectBreakOnLine(line, url, session, scopeIdCallback) {
@@ -187,7 +187,7 @@ function testI18NCharacters(session) {
{
'method': 'Debugger.evaluateOnCallFrame', 'params': {
'callFrameId': '{"ordinal":0,"injectedScriptId":1}',
- 'expression': 'console.log("' + chars + '")',
+ 'expression': `console.log("${chars}")`,
'objectGroup': 'console',
'includeCommandLineAPI': true,
'silent': false,
diff --git a/test/internet/test-dns-cares-domains.js b/test/internet/test-dns-cares-domains.js
index 5328d7e3d9..62c1847ea2 100644
--- a/test/internet/test-dns-cares-domains.js
+++ b/test/internet/test-dns-cares-domains.js
@@ -21,7 +21,7 @@ methods.forEach(function(method) {
const d = domain.create();
d.run(function() {
dns[method]('google.com', function() {
- assert.strictEqual(process.domain, d, method + ' retains domain');
+ assert.strictEqual(process.domain, d, `${method} retains domain`);
});
});
});
diff --git a/test/internet/test-dns-ipv6.js b/test/internet/test-dns-ipv6.js
index 34382660f2..31f9df5eab 100644
--- a/test/internet/test-dns-ipv6.js
+++ b/test/internet/test-dns-ipv6.js
@@ -164,7 +164,7 @@ TEST(function test_lookup_all_ipv6(done) {
ips.forEach((ip) => {
assert.ok(isIPv6(ip.address),
- 'Invalid IPv6: ' + ip.address.toString());
+ `Invalid IPv6: ${ip.address.toString()}`);
assert.strictEqual(ip.family, 6);
});
diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js
index ed4ff777ff..c927e1e665 100644
--- a/test/internet/test-dns.js
+++ b/test/internet/test-dns.js
@@ -545,7 +545,7 @@ req.oncomplete = function(err, domains) {
};
process.on('exit', function() {
- console.log(completed + ' tests completed');
+ console.log(`${completed} tests completed`);
assert.strictEqual(running, false);
assert.strictEqual(expected, completed);
assert.ok(getaddrinfoCallbackCalled);
diff --git a/test/internet/test-tls-add-ca-cert.js b/test/internet/test-tls-add-ca-cert.js
index e64b9b20fe..457dfdac7f 100644
--- a/test/internet/test-tls-add-ca-cert.js
+++ b/test/internet/test-tls-add-ca-cert.js
@@ -13,7 +13,7 @@ const fs = require('fs');
const tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/known_issues/test-cwd-enoent-file.js b/test/known_issues/test-cwd-enoent-file.js
index 3a5094eb39..9431919804 100644
--- a/test/known_issues/test-cwd-enoent-file.js
+++ b/test/known_issues/test-cwd-enoent-file.js
@@ -19,7 +19,7 @@ if (process.argv[2] === 'child') {
// Do nothing.
} else {
common.refreshTmpDir();
- const dir = fs.mkdtempSync(common.tmpDir + '/');
+ const dir = fs.mkdtempSync(`${common.tmpDir}/`);
process.chdir(dir);
fs.rmdirSync(dir);
assert.throws(process.cwd,
diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js
index 639439bca5..8772d997f0 100644
--- a/test/parallel/test-assert.js
+++ b/test/parallel/test-assert.js
@@ -177,7 +177,7 @@ assert.doesNotThrow(makeBlock(a.deepEqual, a1, a2));
// having an identical prototype property
const nbRoot = {
- toString: function() { return this.first + ' ' + this.last; }
+ toString: function() { return `${this.first} ${this.last}`; }
};
function nameBuilder(first, last) {
diff --git a/test/parallel/test-async-wrap-check-providers.js b/test/parallel/test-async-wrap-check-providers.js
index 2800dbb16c..ed30fa257b 100644
--- a/test/parallel/test-async-wrap-check-providers.js
+++ b/test/parallel/test-async-wrap-check-providers.js
@@ -94,8 +94,8 @@ process.on('SIGINT', () => process.exit());
// Run from closed net server above.
function checkTLS() {
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/ec-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/ec-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/ec-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/ec-cert.pem`)
};
const server = tls.createServer(options, common.noop)
.listen(0, function() {
diff --git a/test/parallel/test-buffer-badhex.js b/test/parallel/test-buffer-badhex.js
index ad0b513395..c3d151ba18 100644
--- a/test/parallel/test-buffer-badhex.js
+++ b/test/parallel/test-buffer-badhex.js
@@ -44,6 +44,6 @@ const Buffer = require('buffer').Buffer;
const hex = buf.toString('hex');
assert.deepStrictEqual(Buffer.from(hex, 'hex'), buf);
- const badHex = hex.slice(0, 256) + 'xx' + hex.slice(256, 510);
+ const badHex = `${hex.slice(0, 256)}xx${hex.slice(256, 510)}`;
assert.deepStrictEqual(Buffer.from(badHex, 'hex'), buf.slice(0, 128));
}
diff --git a/test/parallel/test-buffer-includes.js b/test/parallel/test-buffer-includes.js
index 9b80d56782..59d6cee94b 100644
--- a/test/parallel/test-buffer-includes.js
+++ b/test/parallel/test-buffer-includes.js
@@ -199,7 +199,7 @@ const longBufferString = Buffer.from(longString);
let pattern = 'ABACABADABACABA';
for (let i = 0; i < longBufferString.length - pattern.length; i += 7) {
const includes = longBufferString.includes(pattern, i);
- assert(includes, 'Long ABACABA...-string at index ' + i);
+ assert(includes, `Long ABACABA...-string at index ${i}`);
}
assert(longBufferString.includes('AJABACA'), 'Long AJABACA, First J');
assert(longBufferString.includes('AJABACA', 511), 'Long AJABACA, Second J');
diff --git a/test/parallel/test-buffer-indexof.js b/test/parallel/test-buffer-indexof.js
index 99f147b338..680ba1c23d 100644
--- a/test/parallel/test-buffer-indexof.js
+++ b/test/parallel/test-buffer-indexof.js
@@ -255,7 +255,7 @@ let pattern = 'ABACABADABACABA';
for (let i = 0; i < longBufferString.length - pattern.length; i += 7) {
const index = longBufferString.indexOf(pattern, i);
assert.strictEqual((i + 15) & ~0xf, index,
- 'Long ABACABA...-string at index ' + i);
+ `Long ABACABA...-string at index ${i}`);
}
assert.strictEqual(510, longBufferString.indexOf('AJABACA'),
'Long AJABACA, First J');
diff --git a/test/parallel/test-child-process-buffering.js b/test/parallel/test-child-process-buffering.js
index ca8673cb82..d37d255e18 100644
--- a/test/parallel/test-child-process-buffering.js
+++ b/test/parallel/test-child-process-buffering.js
@@ -29,12 +29,12 @@ function pwd(callback) {
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(s) {
- console.log('stdout: ' + JSON.stringify(s));
+ console.log(`stdout: ${JSON.stringify(s)}`);
output += s;
});
child.on('exit', common.mustCall(function(c) {
- console.log('exit: ' + c);
+ console.log(`exit: ${c}`);
assert.strictEqual(0, c);
}));
diff --git a/test/parallel/test-child-process-default-options.js b/test/parallel/test-child-process-default-options.js
index 3972787f8f..b09c2d316f 100644
--- a/test/parallel/test-child-process-default-options.js
+++ b/test/parallel/test-child-process-default-options.js
@@ -39,7 +39,7 @@ let response = '';
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(chunk) {
- console.log('stdout: ' + chunk);
+ console.log(`stdout: ${chunk}`);
response += chunk;
});
diff --git a/test/parallel/test-child-process-double-pipe.js b/test/parallel/test-child-process-double-pipe.js
index a028963739..08d5b1f9cf 100644
--- a/test/parallel/test-child-process-double-pipe.js
+++ b/test/parallel/test-child-process-double-pipe.js
@@ -56,7 +56,7 @@ if (common.isWindows) {
// pipe echo | grep
echo.stdout.on('data', function(data) {
- console.error('grep stdin write ' + data.length);
+ console.error(`grep stdin write ${data.length}`);
if (!grep.stdin.write(data)) {
echo.stdout.pause();
}
@@ -86,7 +86,7 @@ sed.on('exit', function() {
// pipe grep | sed
grep.stdout.on('data', function(data) {
- console.error('grep stdout ' + data.length);
+ console.error(`grep stdout ${data.length}`);
if (!sed.stdin.write(data)) {
grep.stdout.pause();
}
diff --git a/test/parallel/test-child-process-env.js b/test/parallel/test-child-process-env.js
index 16683af4b6..015ab4e0c0 100644
--- a/test/parallel/test-child-process-env.js
+++ b/test/parallel/test-child-process-env.js
@@ -45,7 +45,7 @@ let response = '';
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(chunk) {
- console.log('stdout: ' + chunk);
+ console.log(`stdout: ${chunk}`);
response += chunk;
});
diff --git a/test/parallel/test-child-process-exec-env.js b/test/parallel/test-child-process-exec-env.js
index 143cd174d8..3b1ef741e6 100644
--- a/test/parallel/test-child-process-exec-env.js
+++ b/test/parallel/test-child-process-exec-env.js
@@ -31,9 +31,9 @@ let child;
function after(err, stdout, stderr) {
if (err) {
error_count++;
- console.log('error!: ' + err.code);
- console.log('stdout: ' + JSON.stringify(stdout));
- console.log('stderr: ' + JSON.stringify(stderr));
+ console.log(`error!: ${err.code}`);
+ console.log(`stdout: ${JSON.stringify(stdout)}`);
+ console.log(`stderr: ${JSON.stringify(stderr)}`);
assert.strictEqual(false, err.killed);
} else {
success_count++;
diff --git a/test/parallel/test-child-process-fork-close.js b/test/parallel/test-child-process-fork-close.js
index 8ee4c873fb..d8e78b4d5b 100644
--- a/test/parallel/test-child-process-fork-close.js
+++ b/test/parallel/test-child-process-fork-close.js
@@ -24,7 +24,7 @@ const common = require('../common');
const assert = require('assert');
const fork = require('child_process').fork;
-const cp = fork(common.fixturesDir + '/child-process-message-and-exit.js');
+const cp = fork(`${common.fixturesDir}/child-process-message-and-exit.js`);
let gotMessage = false;
let gotExit = false;
diff --git a/test/parallel/test-child-process-fork.js b/test/parallel/test-child-process-fork.js
index 5177a19f1a..72654f488e 100644
--- a/test/parallel/test-child-process-fork.js
+++ b/test/parallel/test-child-process-fork.js
@@ -25,7 +25,7 @@ const assert = require('assert');
const fork = require('child_process').fork;
const args = ['foo', 'bar'];
-const n = fork(common.fixturesDir + '/child-process-spawn-node.js', args);
+const n = fork(`${common.fixturesDir}/child-process-spawn-node.js`, args);
assert.strictEqual(n.channel, n._channel);
assert.deepStrictEqual(args, ['foo', 'bar']);
diff --git a/test/parallel/test-child-process-fork3.js b/test/parallel/test-child-process-fork3.js
index cffcf2128f..dab689da0c 100644
--- a/test/parallel/test-child-process-fork3.js
+++ b/test/parallel/test-child-process-fork3.js
@@ -23,4 +23,4 @@
const common = require('../common');
const child_process = require('child_process');
-child_process.fork(common.fixturesDir + '/empty.js'); // should not hang
+child_process.fork(`${common.fixturesDir}/empty.js`); // should not hang
diff --git a/test/parallel/test-child-process-internal.js b/test/parallel/test-child-process-internal.js
index e12866ffff..0056d4215b 100644
--- a/test/parallel/test-child-process-internal.js
+++ b/test/parallel/test-child-process-internal.js
@@ -25,8 +25,8 @@ const assert = require('assert');
//messages
const PREFIX = 'NODE_';
-const normal = {cmd: 'foo' + PREFIX};
-const internal = {cmd: PREFIX + 'bar'};
+const normal = {cmd: `foo${PREFIX}`};
+const internal = {cmd: `${PREFIX}bar`};
if (process.argv[2] === 'child') {
//send non-internal message containing PREFIX at a non prefix position
diff --git a/test/parallel/test-child-process-ipc.js b/test/parallel/test-child-process-ipc.js
index cdcc3c63ff..b4a2a5e019 100644
--- a/test/parallel/test-child-process-ipc.js
+++ b/test/parallel/test-child-process-ipc.js
@@ -36,13 +36,13 @@ let gotEcho = false;
const child = spawn(process.argv[0], [sub]);
child.stderr.on('data', function(data) {
- console.log('parent stderr: ' + data);
+ console.log(`parent stderr: ${data}`);
});
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(data) {
- console.log('child said: ' + JSON.stringify(data));
+ console.log(`child said: ${JSON.stringify(data)}`);
if (!gotHelloWorld) {
console.error('testing for hello world');
assert.strictEqual('hello world\r\n', data);
diff --git a/test/parallel/test-child-process-set-blocking.js b/test/parallel/test-child-process-set-blocking.js
index 2b9896154f..bca886ed55 100644
--- a/test/parallel/test-child-process-set-blocking.js
+++ b/test/parallel/test-child-process-set-blocking.js
@@ -26,7 +26,7 @@ const ch = require('child_process');
const SIZE = 100000;
-const cp = ch.spawn('python', ['-c', 'print ' + SIZE + ' * "C"'], {
+const cp = ch.spawn('python', ['-c', `print ${SIZE} * "C"`], {
stdio: 'inherit'
});
diff --git a/test/parallel/test-child-process-spawn-error.js b/test/parallel/test-child-process-spawn-error.js
index ae84666223..109effa5c8 100644
--- a/test/parallel/test-child-process-spawn-error.js
+++ b/test/parallel/test-child-process-spawn-error.js
@@ -32,7 +32,7 @@ const enoentChild = spawn(enoentPath, spawnargs);
enoentChild.on('error', common.mustCall(function(err) {
assert.strictEqual(err.code, 'ENOENT');
assert.strictEqual(err.errno, 'ENOENT');
- assert.strictEqual(err.syscall, 'spawn ' + enoentPath);
+ assert.strictEqual(err.syscall, `spawn ${enoentPath}`);
assert.strictEqual(err.path, enoentPath);
assert.deepStrictEqual(err.spawnargs, spawnargs);
}));
diff --git a/test/parallel/test-child-process-spawn-typeerror.js b/test/parallel/test-child-process-spawn-typeerror.js
index cf5884b38f..93b26107a7 100644
--- a/test/parallel/test-child-process-spawn-typeerror.js
+++ b/test/parallel/test-child-process-spawn-typeerror.js
@@ -32,7 +32,7 @@ const invalidArgsMsg = /Incorrect value of args option/;
const invalidOptionsMsg = /"options" argument must be an object/;
const invalidFileMsg =
/^TypeError: "file" argument must be a non-empty string$/;
-const empty = common.fixturesDir + '/empty.js';
+const empty = `${common.fixturesDir}/empty.js`;
assert.throws(function() {
const child = spawn(invalidcmd, 'this is not an array');
diff --git a/test/parallel/test-child-process-spawnsync-input.js b/test/parallel/test-child-process-spawnsync-input.js
index 5b9f418cf7..b44c236384 100644
--- a/test/parallel/test-child-process-spawnsync-input.js
+++ b/test/parallel/test-child-process-spawnsync-input.js
@@ -30,8 +30,8 @@ const msgOut = 'this is stdout';
const msgErr = 'this is stderr';
// this is actually not os.EOL?
-const msgOutBuf = Buffer.from(msgOut + '\n');
-const msgErrBuf = Buffer.from(msgErr + '\n');
+const msgOutBuf = Buffer.from(`${msgOut}\n`);
+const msgErrBuf = Buffer.from(`${msgErr}\n`);
const args = [
'-e',
@@ -117,5 +117,5 @@ verifyBufOutput(spawnSync(process.execPath, args));
ret = spawnSync(process.execPath, args, { encoding: 'utf8' });
checkSpawnSyncRet(ret);
-assert.strictEqual(ret.stdout, msgOut + '\n');
-assert.strictEqual(ret.stderr, msgErr + '\n');
+assert.strictEqual(ret.stdout, `${msgOut}\n`);
+assert.strictEqual(ret.stderr, `${msgErr}\n`);
diff --git a/test/parallel/test-child-process-spawnsync-maxbuf.js b/test/parallel/test-child-process-spawnsync-maxbuf.js
index d9c2c4d23e..2d94c338bb 100644
--- a/test/parallel/test-child-process-spawnsync-maxbuf.js
+++ b/test/parallel/test-child-process-spawnsync-maxbuf.js
@@ -5,7 +5,7 @@ const spawnSync = require('child_process').spawnSync;
const msgOut = 'this is stdout';
// This is actually not os.EOL?
-const msgOutBuf = Buffer.from(msgOut + '\n');
+const msgOutBuf = Buffer.from(`${msgOut}\n`);
const args = [
'-e',
diff --git a/test/parallel/test-child-process-stdin.js b/test/parallel/test-child-process-stdin.js
index 4100786577..7f49d90f3a 100644
--- a/test/parallel/test-child-process-stdin.js
+++ b/test/parallel/test-child-process-stdin.js
@@ -39,7 +39,7 @@ let response = '';
cat.stdout.setEncoding('utf8');
cat.stdout.on('data', function(chunk) {
- console.log('stdout: ' + chunk);
+ console.log(`stdout: ${chunk}`);
response += chunk;
});
diff --git a/test/parallel/test-cli-eval.js b/test/parallel/test-cli-eval.js
index 337e8e9b2a..0ec561ff0d 100644
--- a/test/parallel/test-cli-eval.js
+++ b/test/parallel/test-cli-eval.js
@@ -203,7 +203,7 @@ child.exec(`${nodejs} --use-strict -p process.execArgv`,
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');
+ assert.strictEqual(stdout, `${args}\n`);
assert.strictEqual(stderr, '');
assert.strictEqual(err, null);
}));
@@ -212,7 +212,7 @@ child.exec(`${nodejs} --use-strict -p process.execArgv`,
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');
+ assert.strictEqual(stdout, `${args}\n`);
assert.strictEqual(stderr, '');
assert.strictEqual(err, null);
}));
@@ -222,7 +222,7 @@ child.exec(`${nodejs} --use-strict -p process.execArgv`,
// filename.
const filecmd = `${nodejs} -- ${__filename} ${args}`;
child.exec(filecmd, common.mustCall(function(err, stdout, stderr) {
- assert.strictEqual(stdout, args + '\n');
+ assert.strictEqual(stdout, `${args}\n`);
assert.strictEqual(stderr, '');
assert.strictEqual(err, null);
}));
diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js
index 47fd4b85c7..6b0b9f53f9 100644
--- a/test/parallel/test-cli-node-options.js
+++ b/test/parallel/test-cli-node-options.js
@@ -31,8 +31,7 @@ function disallow(opt) {
const options = {env: {NODE_OPTIONS: opt}};
exec(process.execPath, options, common.mustCall(function(err) {
const message = err.message.split(/\r?\n/)[1];
- const expect = process.execPath + ': ' + opt +
- ' is not allowed in NODE_OPTIONS';
+ const expect = `${process.execPath}: ${opt} is not allowed in NODE_OPTIONS`;
assert.strictEqual(err.code, 9);
assert.strictEqual(message, expect);
@@ -41,7 +40,7 @@ function disallow(opt) {
const printA = require.resolve('../fixtures/printA.js');
-expect('-r ' + printA, 'A\nB\n');
+expect(`-r ${printA}`, 'A\nB\n');
expect('--no-deprecation', 'B\n');
expect('--no-warnings', 'B\n');
expect('--trace-warnings', 'B\n');
@@ -75,7 +74,7 @@ function expect(opt, want) {
if (!RegExp(want).test(stdout)) {
console.error('For %j, failed to find %j in: <\n%s\n>',
opt, expect, stdout);
- assert(false, 'Expected ' + expect);
+ assert(false, `Expected ${expect}`);
}
}));
}
diff --git a/test/parallel/test-cli-syntax.js b/test/parallel/test-cli-syntax.js
index 5698d86ea4..eda45701a5 100644
--- a/test/parallel/test-cli-syntax.js
+++ b/test/parallel/test-cli-syntax.js
@@ -31,7 +31,7 @@ const syntaxArgs = [
// no output should be produced
assert.strictEqual(c.stdout, '', 'stdout produced');
assert.strictEqual(c.stderr, '', 'stderr produced');
- assert.strictEqual(c.status, 0, 'code === ' + c.status);
+ assert.strictEqual(c.status, 0, `code === ${c.status}`);
});
});
@@ -59,7 +59,7 @@ const syntaxArgs = [
const match = c.stderr.match(/^SyntaxError: Unexpected identifier$/m);
assert(match, 'stderr incorrect');
- assert.strictEqual(c.status, 1, 'code === ' + c.status);
+ assert.strictEqual(c.status, 1, `code === ${c.status}`);
});
});
@@ -82,7 +82,7 @@ const syntaxArgs = [
const match = c.stderr.match(/^Error: Cannot find module/m);
assert(match, 'stderr incorrect');
- assert.strictEqual(c.status, 1, 'code === ' + c.status);
+ assert.strictEqual(c.status, 1, `code === ${c.status}`);
});
});
@@ -96,7 +96,7 @@ syntaxArgs.forEach(function(args) {
assert.strictEqual(c.stdout, '', 'stdout produced');
assert.strictEqual(c.stderr, '', 'stderr produced');
- assert.strictEqual(c.status, 0, 'code === ' + c.status);
+ assert.strictEqual(c.status, 0, `code === ${c.status}`);
});
// should throw if code piped from stdin with --check has bad syntax
@@ -115,7 +115,7 @@ syntaxArgs.forEach(function(args) {
const match = c.stderr.match(/^SyntaxError: Unexpected identifier$/m);
assert(match, 'stderr incorrect');
- assert.strictEqual(c.status, 1, 'code === ' + c.status);
+ assert.strictEqual(c.status, 1, `code === ${c.status}`);
});
// should throw if -c and -e flags are both passed
@@ -130,6 +130,6 @@ syntaxArgs.forEach(function(args) {
)
);
- assert.strictEqual(c.status, 9, 'code === ' + c.status);
+ assert.strictEqual(c.status, 9, `code === ${c.status}`);
});
});
diff --git a/test/parallel/test-cluster-bind-twice.js b/test/parallel/test-cluster-bind-twice.js
index 5b1ecdb4c2..1fde246525 100644
--- a/test/parallel/test-cluster-bind-twice.js
+++ b/test/parallel/test-cluster-bind-twice.js
@@ -54,14 +54,14 @@ if (!id) {
a.on('exit', common.mustCall((c) => {
if (c) {
b.send('QUIT');
- throw new Error('A exited with ' + c);
+ throw new Error(`A exited with ${c}`);
}
}));
b.on('exit', common.mustCall((c) => {
if (c) {
a.send('QUIT');
- throw new Error('B exited with ' + c);
+ throw new Error(`B exited with ${c}`);
}
}));
diff --git a/test/parallel/test-cluster-eaccess.js b/test/parallel/test-cluster-eaccess.js
index fa5b8077de..bc2ffddab8 100644
--- a/test/parallel/test-cluster-eaccess.js
+++ b/test/parallel/test-cluster-eaccess.js
@@ -58,7 +58,7 @@ if (cluster.isMaster) {
} else {
common.refreshTmpDir();
- const cp = fork(common.fixturesDir + '/listen-on-socket-and-exit.js',
+ const cp = fork(`${common.fixturesDir}/listen-on-socket-and-exit.js`,
{ stdio: 'inherit' });
// message from the child indicates it's ready and listening
diff --git a/test/parallel/test-cluster-eaddrinuse.js b/test/parallel/test-cluster-eaddrinuse.js
index bab0fe0d8b..eae6d9a455 100644
--- a/test/parallel/test-cluster-eaddrinuse.js
+++ b/test/parallel/test-cluster-eaddrinuse.js
@@ -29,8 +29,8 @@ const assert = require('assert');
const fork = require('child_process').fork;
const net = require('net');
-const id = '' + process.argv[2];
-const port = '' + process.argv[3];
+const id = String(process.argv[2]);
+const port = String(process.argv[3]);
if (id === 'undefined') {
const server = net.createServer(common.mustNotCall());
diff --git a/test/parallel/test-cluster-message.js b/test/parallel/test-cluster-message.js
index df9f8ca2a4..48bd7ee36a 100644
--- a/test/parallel/test-cluster-message.js
+++ b/test/parallel/test-cluster-message.js
@@ -123,7 +123,7 @@ if (cluster.isWorker) {
if (data.code === 'received message') {
check('worker', data.echo === 'message from master');
} else {
- throw new Error('wrong TCP message received: ' + data);
+ throw new Error(`wrong TCP message received: ${data}`);
}
});
@@ -139,9 +139,8 @@ if (cluster.isWorker) {
process.once('exit', function() {
forEach(checks, function(check, type) {
- assert.ok(check.receive, 'The ' + type + ' did not receive any message');
- assert.ok(check.correct,
- 'The ' + type + ' did not get the correct message');
+ assert.ok(check.receive, `The ${type} did not receive any message`);
+ assert.ok(check.correct, `The ${type} did not get the correct message`);
});
});
}
diff --git a/test/parallel/test-cluster-worker-exit.js b/test/parallel/test-cluster-worker-exit.js
index 18d6fe25eb..75a271278f 100644
--- a/test/parallel/test-cluster-worker-exit.js
+++ b/test/parallel/test-cluster-worker-exit.js
@@ -125,9 +125,8 @@ function checkResults(expected_results, results) {
const actual = results[k];
const expected = expected_results[k];
- assert.strictEqual(actual,
- expected && expected.length ? expected[0] : expected,
- (expected[1] || '') +
- ` [expected: ${expected[0]} / actual: ${actual}]`);
+ assert.strictEqual(
+ actual, expected && expected.length ? expected[0] : expected,
+ `${expected[1] || ''} [expected: ${expected[0]} / actual: ${actual}]`);
}
}
diff --git a/test/parallel/test-cluster-worker-kill.js b/test/parallel/test-cluster-worker-kill.js
index ad06ff0978..38e2deb155 100644
--- a/test/parallel/test-cluster-worker-kill.js
+++ b/test/parallel/test-cluster-worker-kill.js
@@ -111,9 +111,8 @@ function checkResults(expected_results, results) {
const actual = results[k];
const expected = expected_results[k];
- assert.strictEqual(actual,
- expected && expected.length ? expected[0] : expected,
- (expected[1] || '') +
- ` [expected: ${expected[0]} / actual: ${actual}]`);
+ assert.strictEqual(
+ actual, expected && expected.length ? expected[0] : expected,
+ `${expected[1] || ''} [expected: ${expected[0]} / actual: ${actual}]`);
}
}
diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js
index a8aa93a3bd..0c41341015 100644
--- a/test/parallel/test-console.js
+++ b/test/parallel/test-console.js
@@ -123,13 +123,13 @@ const expectedStrings = [
];
for (const expected of expectedStrings) {
- assert.strictEqual(expected + '\n', strings.shift());
- assert.strictEqual(expected + '\n', errStrings.shift());
+ assert.strictEqual(`${expected}\n`, strings.shift());
+ assert.strictEqual(`${expected}\n`, errStrings.shift());
}
for (const expected of expectedStrings) {
- assert.strictEqual(expected + '\n', strings.shift());
- assert.strictEqual(expected + '\n', errStrings.shift());
+ assert.strictEqual(`${expected}\n`, strings.shift());
+ assert.strictEqual(`${expected}\n`, errStrings.shift());
}
assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n",
diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js
index eefd42cd68..c1d70efa5f 100644
--- a/test/parallel/test-crypto-authenticated.js
+++ b/test/parallel/test-crypto-authenticated.js
@@ -334,7 +334,7 @@ for (const i in TEST_CASES) {
const test = TEST_CASES[i];
if (!ciphers.includes(test.algo)) {
- common.skip('unsupported ' + test.algo + ' test');
+ common.skip(`unsupported ${test.algo} test`);
continue;
}
diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js
index 0ee11577d2..e92f70035b 100644
--- a/test/parallel/test-crypto-binary-default.js
+++ b/test/parallel/test-crypto-binary-default.js
@@ -37,17 +37,16 @@ const fs = require('fs');
const path = require('path');
const tls = require('tls');
const DH_NOT_SUITABLE_GENERATOR = crypto.constants.DH_NOT_SUITABLE_GENERATOR;
+const fixtDir = common.fixturesDir;
crypto.DEFAULT_ENCODING = 'latin1';
// Test Certificates
-const certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
-const certPfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx');
-const keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');
-const rsaPubPem = fs.readFileSync(common.fixturesDir + '/test_rsa_pubkey.pem',
- 'ascii');
-const rsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_rsa_privkey.pem',
- 'ascii');
+const certPem = fs.readFileSync(`${fixtDir}/test_cert.pem`, 'ascii');
+const certPfx = fs.readFileSync(`${fixtDir}/test_cert.pfx`);
+const keyPem = fs.readFileSync(`${fixtDir}/test_key.pem`, 'ascii');
+const rsaPubPem = fs.readFileSync(`${fixtDir}/test_rsa_pubkey.pem`, 'ascii');
+const rsaKeyPem = fs.readFileSync(`${fixtDir}/test_rsa_privkey.pem`, 'ascii');
// PFX tests
assert.doesNotThrow(function() {
@@ -408,7 +407,7 @@ const h2 = crypto.createHash('sha1').update('Test').update('123').digest('hex');
assert.strictEqual(h1, h2, 'multipled updates');
// Test hashing for binary files
-const fn = path.join(common.fixturesDir, 'sample.png');
+const fn = path.join(fixtDir, 'sample.png');
const sha1Hash = crypto.createHash('sha1');
const fileStream = fs.createReadStream(fn);
fileStream.on('data', function(data) {
@@ -617,11 +616,9 @@ assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true);
// Test RSA signing and verification
//
{
- const privateKey = fs.readFileSync(
- common.fixturesDir + '/test_rsa_privkey_2.pem');
+ const privateKey = fs.readFileSync(`${fixtDir}/test_rsa_privkey_2.pem`);
- const publicKey = fs.readFileSync(
- common.fixturesDir + '/test_rsa_pubkey_2.pem');
+ const publicKey = fs.readFileSync(`${fixtDir}/test_rsa_pubkey_2.pem`);
const input = 'I AM THE WALRUS';
@@ -649,11 +646,9 @@ assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true);
// Test DSA signing and verification
//
{
- const privateKey = fs.readFileSync(
- common.fixturesDir + '/test_dsa_privkey.pem');
+ const privateKey = fs.readFileSync(`${fixtDir}/test_dsa_privkey.pem`);
- const publicKey = fs.readFileSync(
- common.fixturesDir + '/test_dsa_pubkey.pem');
+ const publicKey = fs.readFileSync(`${fixtDir}/test_dsa_pubkey.pem`);
const input = 'I AM THE WALRUS';
diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js
index f62fdfa3f3..831fed0f14 100644
--- a/test/parallel/test-crypto-certificate.js
+++ b/test/parallel/test-crypto-certificate.js
@@ -34,9 +34,9 @@ crypto.DEFAULT_ENCODING = 'buffer';
const fs = require('fs');
// Test Certificates
-const spkacValid = fs.readFileSync(common.fixturesDir + '/spkac.valid');
-const spkacFail = fs.readFileSync(common.fixturesDir + '/spkac.fail');
-const spkacPem = fs.readFileSync(common.fixturesDir + '/spkac.pem');
+const spkacValid = fs.readFileSync(`${common.fixturesDir}/spkac.valid`);
+const spkacFail = fs.readFileSync(`${common.fixturesDir}/spkac.fail`);
+const spkacPem = fs.readFileSync(`${common.fixturesDir}/spkac.pem`);
const certificate = new crypto.Certificate();
diff --git a/test/parallel/test-crypto-fips.js b/test/parallel/test-crypto-fips.js
index ae51074194..2b87937fe7 100644
--- a/test/parallel/test-crypto-fips.js
+++ b/test/parallel/test-crypto-fips.js
@@ -31,19 +31,18 @@ function addToEnv(newVar, value) {
}
function testHelper(stream, args, expectedOutput, cmd, env) {
- const fullArgs = args.concat(['-e', 'console.log(' + cmd + ')']);
+ const fullArgs = args.concat(['-e', `console.log(${cmd})`]);
const child = spawnSync(process.execPath, fullArgs, {
cwd: path.dirname(process.execPath),
env: env
});
- console.error('Spawned child [pid:' + child.pid + '] with cmd \'' +
- cmd + '\' expect %j with args \'' + args + '\'' +
- ' OPENSSL_CONF=%j', expectedOutput, env.OPENSSL_CONF);
+ console.error(
+ `Spawned child [pid:${child.pid}] with cmd '${cmd}' expect %j with args '${
+ args}' OPENSSL_CONF=%j`, expectedOutput, env.OPENSSL_CONF);
function childOk(child) {
- console.error('Child #' + ++num_children_ok +
- ' [pid:' + child.pid + '] OK.');
+ console.error(`Child #${++num_children_ok} [pid:${child.pid}] OK.`);
}
function responseHandler(buffer, expectedOutput) {
diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js
index dabdac3433..daa818705b 100644
--- a/test/parallel/test-crypto-rsa-dsa.js
+++ b/test/parallel/test-crypto-rsa-dsa.js
@@ -10,21 +10,19 @@ if (!common.hasCrypto) {
const constants = require('crypto').constants;
const crypto = require('crypto');
+const fixtDir = common.fixturesDir;
+
// Test certificates
-const certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
-const keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');
-const rsaPubPem = fs.readFileSync(common.fixturesDir + '/test_rsa_pubkey.pem',
- 'ascii');
-const rsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_rsa_privkey.pem',
- 'ascii');
+const certPem = fs.readFileSync(`${fixtDir}/test_cert.pem`, 'ascii');
+const keyPem = fs.readFileSync(`${fixtDir}/test_key.pem`, 'ascii');
+const rsaPubPem = fs.readFileSync(`${fixtDir}/test_rsa_pubkey.pem`, 'ascii');
+const rsaKeyPem = fs.readFileSync(`${fixtDir}/test_rsa_privkey.pem`, 'ascii');
const rsaKeyPemEncrypted = fs.readFileSync(
- common.fixturesDir + '/test_rsa_privkey_encrypted.pem', 'ascii');
-const dsaPubPem = fs.readFileSync(common.fixturesDir + '/test_dsa_pubkey.pem',
- 'ascii');
-const dsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_dsa_privkey.pem',
- 'ascii');
+ `${fixtDir}/test_rsa_privkey_encrypted.pem`, 'ascii');
+const dsaPubPem = fs.readFileSync(`${fixtDir}/test_dsa_pubkey.pem`, 'ascii');
+const dsaKeyPem = fs.readFileSync(`${fixtDir}/test_dsa_privkey.pem`, 'ascii');
const dsaKeyPemEncrypted = fs.readFileSync(
- common.fixturesDir + '/test_dsa_privkey_encrypted.pem', 'ascii');
+ `${fixtDir}/test_dsa_privkey_encrypted.pem`, 'ascii');
const decryptError =
/^Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt$/;
@@ -178,11 +176,9 @@ assert.throws(() => {
// Test RSA signing and verification
//
{
- const privateKey = fs.readFileSync(
- common.fixturesDir + '/test_rsa_privkey_2.pem');
+ const privateKey = fs.readFileSync(`${fixtDir}/test_rsa_privkey_2.pem`);
- const publicKey = fs.readFileSync(
- common.fixturesDir + '/test_rsa_pubkey_2.pem');
+ const publicKey = fs.readFileSync(`${fixtDir}/test_rsa_pubkey_2.pem`);
const input = 'I AM THE WALRUS';
diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js
index e79346a85d..52daf2e6ff 100644
--- a/test/parallel/test-crypto-sign-verify.js
+++ b/test/parallel/test-crypto-sign-verify.js
@@ -12,8 +12,8 @@ if (!common.hasCrypto) {
const crypto = require('crypto');
// Test certificates
-const certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
-const keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');
+const certPem = fs.readFileSync(`${common.fixturesDir}/test_cert.pem`, 'ascii');
+const keyPem = fs.readFileSync(`${common.fixturesDir}/test_key.pem`, 'ascii');
const modSize = 1024;
// Test signing and verifying
@@ -265,10 +265,10 @@ const modSize = 1024;
const msgfile = path.join(common.tmpDir, 's5.msg');
fs.writeFileSync(msgfile, msg);
- const cmd = '"' + common.opensslCli + '" dgst -sha256 -verify "' + pubfile +
- '" -signature "' + sigfile +
- '" -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:-2 "' +
- msgfile + '"';
+ const cmd =
+ `"${common.opensslCli}" dgst -sha256 -verify "${pubfile}" -signature "${
+ sigfile}" -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:-2 "${
+ msgfile}"`;
exec(cmd, common.mustCall((err, stdout, stderr) => {
assert(stdout.includes('Verified OK'));
diff --git a/test/parallel/test-crypto-verify-failure.js b/test/parallel/test-crypto-verify-failure.js
index 7255410935..1b3622fe01 100644
--- a/test/parallel/test-crypto-verify-failure.js
+++ b/test/parallel/test-crypto-verify-failure.js
@@ -33,11 +33,11 @@ crypto.DEFAULT_ENCODING = 'buffer';
const fs = require('fs');
-const certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
+const certPem = fs.readFileSync(`${common.fixturesDir}/test_cert.pem`, 'ascii');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = tls.Server(options, (socket) => {
diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js
index 37729b2cbc..19fb6f2687 100644
--- a/test/parallel/test-crypto.js
+++ b/test/parallel/test-crypto.js
@@ -35,10 +35,10 @@ const tls = require('tls');
crypto.DEFAULT_ENCODING = 'buffer';
// Test Certificates
-const caPem = fs.readFileSync(common.fixturesDir + '/test_ca.pem', 'ascii');
-const certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
-const certPfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx');
-const keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');
+const caPem = fs.readFileSync(`${common.fixturesDir}/test_ca.pem`, 'ascii');
+const certPem = fs.readFileSync(`${common.fixturesDir}/test_cert.pem`, 'ascii');
+const certPfx = fs.readFileSync(`${common.fixturesDir}/test_cert.pfx`);
+const keyPem = fs.readFileSync(`${common.fixturesDir}/test_key.pem`, 'ascii');
// 'this' safety
// https://github.com/joyent/node/issues/6690
@@ -177,8 +177,8 @@ assert.throws(function() {
// $ openssl pkcs8 -topk8 -inform PEM -outform PEM -in mykey.pem \
// -out private_key.pem -nocrypt;
// Then open private_key.pem and change its header and footer.
- const sha1_privateKey = fs.readFileSync(common.fixturesDir +
- '/test_bad_rsa_privkey.pem', 'ascii');
+ const sha1_privateKey = fs.readFileSync(
+ `${common.fixturesDir}/test_bad_rsa_privkey.pem`, 'ascii');
// this would inject errors onto OpenSSL's error stack
crypto.createSign('sha1').sign(sha1_privateKey);
}, /asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag/);
diff --git a/test/parallel/test-cwd-enoent-preload.js b/test/parallel/test-cwd-enoent-preload.js
index 8418e1177e..5d44814d2f 100644
--- a/test/parallel/test-cwd-enoent-preload.js
+++ b/test/parallel/test-cwd-enoent-preload.js
@@ -10,7 +10,7 @@ if (common.isSunOS || common.isWindows || common.isAix) {
return;
}
-const dirname = common.tmpDir + '/cwd-does-not-exist-' + process.pid;
+const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`;
const abspathFile = require('path').join(common.fixturesDir, 'a.js');
common.refreshTmpDir();
fs.mkdirSync(dirname);
diff --git a/test/parallel/test-cwd-enoent-repl.js b/test/parallel/test-cwd-enoent-repl.js
index 942fc07b64..c82083668a 100644
--- a/test/parallel/test-cwd-enoent-repl.js
+++ b/test/parallel/test-cwd-enoent-repl.js
@@ -10,7 +10,7 @@ if (common.isSunOS || common.isWindows || common.isAix) {
return;
}
-const dirname = common.tmpDir + '/cwd-does-not-exist-' + process.pid;
+const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`;
common.refreshTmpDir();
fs.mkdirSync(dirname);
process.chdir(dirname);
diff --git a/test/parallel/test-cwd-enoent.js b/test/parallel/test-cwd-enoent.js
index 736121a7c8..dac23e4084 100644
--- a/test/parallel/test-cwd-enoent.js
+++ b/test/parallel/test-cwd-enoent.js
@@ -10,7 +10,7 @@ if (common.isSunOS || common.isWindows || common.isAix) {
return;
}
-const dirname = common.tmpDir + '/cwd-does-not-exist-' + process.pid;
+const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`;
common.refreshTmpDir();
fs.mkdirSync(dirname);
process.chdir(dirname);
diff --git a/test/parallel/test-dgram-bind-shared-ports.js b/test/parallel/test-dgram-bind-shared-ports.js
index d782729b19..4eaf9a14d6 100644
--- a/test/parallel/test-dgram-bind-shared-ports.js
+++ b/test/parallel/test-dgram-bind-shared-ports.js
@@ -54,12 +54,12 @@ if (cluster.isMaster) {
socket1.on('error', (err) => {
// no errors expected
- process.send('socket1:' + err.code);
+ process.send(`socket1:${err.code}`);
});
socket2.on('error', (err) => {
// an error is expected on the second worker
- process.send('socket2:' + err.code);
+ process.send(`socket2:${err.code}`);
});
socket1.bind({
diff --git a/test/parallel/test-dgram-error-message-address.js b/test/parallel/test-dgram-error-message-address.js
index 480295b523..cdb913691f 100644
--- a/test/parallel/test-dgram-error-message-address.js
+++ b/test/parallel/test-dgram-error-message-address.js
@@ -49,7 +49,7 @@ socket_ipv6.on('error', common.mustCall(function(e) {
const allowed = ['EADDRNOTAVAIL', 'EAFNOSUPPORT', 'EPROTONOSUPPORT'];
assert.notStrictEqual(allowed.indexOf(e.code), -1);
assert.strictEqual(e.port, undefined);
- assert.strictEqual(e.message, 'bind ' + e.code + ' 111::1');
+ assert.strictEqual(e.message, `bind ${e.code} 111::1`);
assert.strictEqual(e.address, '111::1');
socket_ipv6.close();
}));
diff --git a/test/parallel/test-domain-enter-exit.js b/test/parallel/test-domain-enter-exit.js
index 66dbfa4c1e..e9458409ff 100644
--- a/test/parallel/test-domain-enter-exit.js
+++ b/test/parallel/test-domain-enter-exit.js
@@ -41,20 +41,20 @@ c.name = 'c';
a.enter(); // push
assert.deepStrictEqual(domain._stack, [a],
- 'a not pushed: ' + names(domain._stack));
+ `a not pushed: ${names(domain._stack)}`);
b.enter(); // push
assert.deepStrictEqual(domain._stack, [a, b],
- 'b not pushed: ' + names(domain._stack));
+ `b not pushed: ${names(domain._stack)}`);
c.enter(); // push
assert.deepStrictEqual(domain._stack, [a, b, c],
- 'c not pushed: ' + names(domain._stack));
+ `c not pushed: ${names(domain._stack)}`);
b.exit(); // pop
assert.deepStrictEqual(domain._stack, [a],
- 'b and c not popped: ' + names(domain._stack));
+ `b and c not popped: ${names(domain._stack)}`);
b.enter(); // push
assert.deepStrictEqual(domain._stack, [a, b],
- 'b not pushed: ' + names(domain._stack));
+ `b not pushed: ${names(domain._stack)}`);
diff --git a/test/parallel/test-domain-uncaught-exception.js b/test/parallel/test-domain-uncaught-exception.js
index b4a3d0d1d9..2a157f9398 100644
--- a/test/parallel/test-domain-uncaught-exception.js
+++ b/test/parallel/test-domain-uncaught-exception.js
@@ -184,16 +184,15 @@ if (process.argv[2] === 'child') {
test.expectedMessages.forEach(function(expectedMessage) {
if (test.messagesReceived === undefined ||
test.messagesReceived.indexOf(expectedMessage) === -1)
- assert.fail('test ' + test.fn.name + ' should have sent message: ' +
- expectedMessage + ' but didn\'t');
+ assert.fail(`test ${test.fn.name} should have sent message: ${
+ expectedMessage} but didn't`);
});
if (test.messagesReceived) {
test.messagesReceived.forEach(function(receivedMessage) {
if (test.expectedMessages.indexOf(receivedMessage) === -1) {
- assert.fail('test ' + test.fn.name +
- ' should not have sent message: ' + receivedMessage +
- ' but did');
+ assert.fail(`test ${test.fn.name} should not have sent message: ${
+ receivedMessage} but did`);
}
});
}
diff --git a/test/parallel/test-domain-with-abort-on-uncaught-exception.js b/test/parallel/test-domain-with-abort-on-uncaught-exception.js
index db530fbccb..5b455f6f91 100644
--- a/test/parallel/test-domain-with-abort-on-uncaught-exception.js
+++ b/test/parallel/test-domain-with-abort-on-uncaught-exception.js
@@ -103,14 +103,8 @@ if (process.argv[2] === 'child') {
if (options.useTryCatch)
useTryCatchOpt = 'useTryCatch';
- cmdToExec += process.argv[0] + ' ';
- cmdToExec += (cmdLineOption ? cmdLineOption : '') + ' ';
- cmdToExec += process.argv[1] + ' ';
- cmdToExec += [
- 'child',
- throwInDomainErrHandlerOpt,
- useTryCatchOpt
- ].join(' ');
+ cmdToExec += `${process.argv[0]} ${cmdLineOption ? cmdLineOption : ''} ${
+ process.argv[1]} child ${throwInDomainErrHandlerOpt} ${useTryCatchOpt}`;
const child = exec(cmdToExec);
diff --git a/test/parallel/test-domain.js b/test/parallel/test-domain.js
index fad71b0427..1b6e1c7bbf 100644
--- a/test/parallel/test-domain.js
+++ b/test/parallel/test-domain.js
@@ -251,9 +251,7 @@ assert.strictEqual(result, 'return value');
// check if the executed function take in count the applied parameters
-result = d.run(function(a, b) {
- return a + ' ' + b;
-}, 'return', 'value');
+result = d.run((a, b) => `${a} ${b}`, 'return', 'value');
assert.strictEqual(result, 'return value');
diff --git a/test/parallel/test-dsa-fips-invalid-key.js b/test/parallel/test-dsa-fips-invalid-key.js
index 6055a9b4c4..b22be9d077 100644
--- a/test/parallel/test-dsa-fips-invalid-key.js
+++ b/test/parallel/test-dsa-fips-invalid-key.js
@@ -12,8 +12,8 @@ const fs = require('fs');
const input = 'hello';
-const dsapri = fs.readFileSync(common.fixturesDir +
- '/keys/dsa_private_1025.pem');
+const dsapri = fs.readFileSync(
+ `${common.fixturesDir}/keys/dsa_private_1025.pem`);
const sign = crypto.createSign('DSS1');
sign.update(input);
diff --git a/test/parallel/test-error-reporting.js b/test/parallel/test-error-reporting.js
index e7eb5abc00..cdd066f959 100644
--- a/test/parallel/test-error-reporting.js
+++ b/test/parallel/test-error-reporting.js
@@ -26,8 +26,7 @@ const exec = require('child_process').exec;
const path = require('path');
function errExec(script, callback) {
- const cmd = '"' + process.argv[0] + '" "' +
- path.join(common.fixturesDir, script) + '"';
+ const cmd = `"${process.argv[0]}" "${path.join(common.fixturesDir, script)}"`;
return exec(cmd, function(err, stdout, stderr) {
// There was some error
assert.ok(err);
diff --git a/test/parallel/test-eval.js b/test/parallel/test-eval.js
index 0383511ef7..62416148a3 100644
--- a/test/parallel/test-eval.js
+++ b/test/parallel/test-eval.js
@@ -29,7 +29,7 @@ const cmd = [
`"${process.execPath}"`, '-e',
'"console.error(process.argv)"',
'foo', 'bar'].join(' ');
-const expected = util.format([process.execPath, 'foo', 'bar']) + '\n';
+const expected = `${util.format([process.execPath, 'foo', 'bar'])}\n`;
exec(cmd, common.mustCall((err, stdout, stderr) => {
assert.ifError(err);
assert.strictEqual(stderr, expected);
diff --git a/test/parallel/test-exception-handler2.js b/test/parallel/test-exception-handler2.js
index 0911b89dd7..ae95d45245 100644
--- a/test/parallel/test-exception-handler2.js
+++ b/test/parallel/test-exception-handler2.js
@@ -24,7 +24,7 @@ const common = require('../common');
const assert = require('assert');
process.on('uncaughtException', function(err) {
- console.log('Caught exception: ' + err);
+ console.log(`Caught exception: ${err}`);
});
setTimeout(common.mustCall(function() {
diff --git a/test/parallel/test-file-write-stream2.js b/test/parallel/test-file-write-stream2.js
index e0e9dae337..757d9d91b3 100644
--- a/test/parallel/test-file-write-stream2.js
+++ b/test/parallel/test-file-write-stream2.js
@@ -43,9 +43,9 @@ process.on('exit', function() {
console.log(' Test callback events missing or out of order:');
console.log(' expected: %j', cb_expected);
console.log(' occurred: %j', cb_occurred);
- assert.strictEqual(cb_occurred, cb_expected,
- 'events missing or out of order: "' +
- cb_occurred + '" !== "' + cb_expected + '"');
+ assert.strictEqual(
+ cb_occurred, cb_expected,
+ `events missing or out of order: "${cb_occurred}" !== "${cb_expected}"`);
} else {
console.log('ok');
}
@@ -101,7 +101,7 @@ file.on('error', function(err) {
for (let i = 0; i < 11; i++) {
- const ret = file.write(i + '');
+ const ret = file.write(String(i));
console.error('%d %j', i, ret);
// return false when i hits 10
diff --git a/test/parallel/test-file-write-stream3.js b/test/parallel/test-file-write-stream3.js
index ed29d67ac9..e248960a8f 100644
--- a/test/parallel/test-file-write-stream3.js
+++ b/test/parallel/test-file-write-stream3.js
@@ -44,9 +44,9 @@ process.on('exit', function() {
console.log(' Test callback events missing or out of order:');
console.log(' expected: %j', cb_expected);
console.log(' occurred: %j', cb_occurred);
- assert.strictEqual(cb_occurred, cb_expected,
- 'events missing or out of order: "' +
- cb_occurred + '" !== "' + cb_expected + '"');
+ assert.strictEqual(
+ cb_occurred, cb_expected,
+ `events missing or out of order: "${cb_occurred}" !== "${cb_expected}"`);
}
});
diff --git a/test/parallel/test-fs-append-file-sync.js b/test/parallel/test-fs-append-file-sync.js
index eade1801cd..31e95c2e36 100644
--- a/test/parallel/test-fs-append-file-sync.js
+++ b/test/parallel/test-fs-append-file-sync.js
@@ -83,7 +83,7 @@ if (!common.isWindows) {
const fileData4 = fs.readFileSync(filename4);
-assert.strictEqual(Buffer.byteLength('' + num) + currentFileData.length,
+assert.strictEqual(Buffer.byteLength(String(num)) + currentFileData.length,
fileData4.length);
// test that appendFile accepts file descriptors
diff --git a/test/parallel/test-fs-append-file.js b/test/parallel/test-fs-append-file.js
index 72315026aa..025a0ed034 100644
--- a/test/parallel/test-fs-append-file.js
+++ b/test/parallel/test-fs-append-file.js
@@ -109,7 +109,7 @@ fs.appendFile(filename4, n, { mode: m }, function(e) {
fs.readFile(filename4, function(e, buffer) {
assert.ifError(e);
ncallbacks++;
- assert.strictEqual(Buffer.byteLength('' + n) + currentFileData.length,
+ assert.strictEqual(Buffer.byteLength(String(n)) + currentFileData.length,
buffer.length);
});
});
diff --git a/test/parallel/test-fs-buffertype-writesync.js b/test/parallel/test-fs-buffertype-writesync.js
index 0c8bf4b0fc..02d2cb58f8 100644
--- a/test/parallel/test-fs-buffertype-writesync.js
+++ b/test/parallel/test-fs-buffertype-writesync.js
@@ -16,5 +16,5 @@ common.refreshTmpDir();
v.forEach((value) => {
const fd = fs.openSync(filePath, 'w');
fs.writeSync(fd, value);
- assert.strictEqual(fs.readFileSync(filePath).toString(), value + '');
+ assert.strictEqual(fs.readFileSync(filePath).toString(), String(value));
});
diff --git a/test/parallel/test-fs-error-messages.js b/test/parallel/test-fs-error-messages.js
index 0991a798fe..6fc555eca2 100644
--- a/test/parallel/test-fs-error-messages.js
+++ b/test/parallel/test-fs-error-messages.js
@@ -225,7 +225,8 @@ try {
}
process.on('exit', function() {
- assert.strictEqual(expected, errors.length,
- 'Test fs sync exceptions raised, got ' + errors.length +
- ' expected ' + expected);
+ assert.strictEqual(
+ expected, errors.length,
+ `Test fs sync exceptions raised, got ${errors.length} expected ${expected}`
+ );
});
diff --git a/test/parallel/test-fs-exists.js b/test/parallel/test-fs-exists.js
index fa8fd68844..071f85fc81 100644
--- a/test/parallel/test-fs-exists.js
+++ b/test/parallel/test-fs-exists.js
@@ -29,9 +29,9 @@ fs.exists(f, common.mustCall(function(y) {
assert.strictEqual(y, true);
}));
-fs.exists(f + '-NO', common.mustCall(function(y) {
+fs.exists(`${f}-NO`, common.mustCall(function(y) {
assert.strictEqual(y, false);
}));
assert(fs.existsSync(f));
-assert(!fs.existsSync(f + '-NO'));
+assert(!fs.existsSync(`${f}-NO`));
diff --git a/test/parallel/test-fs-mkdir.js b/test/parallel/test-fs-mkdir.js
index 9140f0edb5..17a945c975 100644
--- a/test/parallel/test-fs-mkdir.js
+++ b/test/parallel/test-fs-mkdir.js
@@ -34,7 +34,7 @@ function unlink(pathname) {
common.refreshTmpDir();
{
- const pathname = common.tmpDir + '/test1';
+ const pathname = `${common.tmpDir}/test1`;
unlink(pathname);
@@ -49,7 +49,7 @@ common.refreshTmpDir();
}
{
- const pathname = common.tmpDir + '/test2';
+ const pathname = `${common.tmpDir}/test2`;
unlink(pathname);
@@ -64,7 +64,7 @@ common.refreshTmpDir();
}
{
- const pathname = common.tmpDir + '/test3';
+ const pathname = `${common.tmpDir}/test3`;
unlink(pathname);
fs.mkdirSync(pathname);
diff --git a/test/parallel/test-fs-non-number-arguments-throw.js b/test/parallel/test-fs-non-number-arguments-throw.js
index 3e40a5fd41..5e4deb12a8 100644
--- a/test/parallel/test-fs-non-number-arguments-throw.js
+++ b/test/parallel/test-fs-non-number-arguments-throw.js
@@ -29,6 +29,7 @@ assert.throws(function() {
"start as string didn't throw an error for createWriteStream");
saneEmitter.on('data', common.mustCall(function(data) {
- assert.strictEqual(sanity, data.toString('utf8'), 'read ' +
- data.toString('utf8') + ' instead of ' + sanity);
+ assert.strictEqual(
+ sanity, data.toString('utf8'),
+ `read ${data.toString('utf8')} instead of ${sanity}`);
}));
diff --git a/test/parallel/test-fs-readdir.js b/test/parallel/test-fs-readdir.js
index 57612f3e26..a5c7ebfe68 100644
--- a/test/parallel/test-fs-readdir.js
+++ b/test/parallel/test-fs-readdir.js
@@ -12,7 +12,7 @@ common.refreshTmpDir();
// Create the necessary files
files.forEach(function(currentFile) {
- fs.closeSync(fs.openSync(readdirDir + '/' + currentFile, 'w'));
+ fs.closeSync(fs.openSync(`${readdirDir}/${currentFile}`, 'w'));
});
// Check the readdir Sync version
diff --git a/test/parallel/test-fs-readfile-error.js b/test/parallel/test-fs-readfile-error.js
index 5b3efe1de6..208b478c12 100644
--- a/test/parallel/test-fs-readfile-error.js
+++ b/test/parallel/test-fs-readfile-error.js
@@ -34,13 +34,13 @@ if (common.isFreeBSD) {
function test(env, cb) {
const filename = path.join(common.fixturesDir, 'test-fs-readfile-error.js');
- const execPath = '"' + process.execPath + '" "' + filename + '"';
+ const execPath = `"${process.execPath}" "${filename}"`;
const options = { env: Object.assign(process.env, env) };
exec(execPath, options, common.mustCall((err, stdout, stderr) => {
assert(err);
assert.strictEqual(stdout, '');
assert.notStrictEqual(stderr, '');
- cb('' + stderr);
+ cb(String(stderr));
}));
}
diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js
index ee77ca0899..1c9f7a7d90 100644
--- a/test/parallel/test-fs-realpath.js
+++ b/test/parallel/test-fs-realpath.js
@@ -29,6 +29,7 @@ let async_completed = 0;
let async_expected = 0;
const unlink = [];
let skipSymlinks = false;
+const tmpDir = common.tmpDir;
common.refreshTmpDir();
@@ -62,11 +63,11 @@ if (common.isWindows) {
function tmp(p) {
- return path.join(common.tmpDir, p);
+ return path.join(tmpDir, p);
}
-const targetsAbsDir = path.join(common.tmpDir, 'targets');
-const tmpAbsDir = common.tmpDir;
+const targetsAbsDir = path.join(tmpDir, 'targets');
+const tmpAbsDir = tmpDir;
// Set up targetsAbsDir and expected subdirectories
fs.mkdirSync(targetsAbsDir);
@@ -105,10 +106,10 @@ function test_simple_relative_symlink(callback) {
common.skip('symlink test (no privs)');
return runNextTest();
}
- const entry = common.tmpDir + '/symlink';
- const expected = common.tmpDir + '/cycles/root.js';
+ const entry = `${tmpDir}/symlink`;
+ const expected = `${tmpDir}/cycles/root.js`;
[
- [entry, '../' + common.tmpDirName + '/cycles/root.js']
+ [entry, `../${common.tmpDirName}/cycles/root.js`]
].forEach(function(t) {
try { fs.unlinkSync(t[0]); } catch (e) {}
console.log('fs.symlinkSync(%j, %j, %j)', t[1], t[0], 'file');
@@ -131,8 +132,8 @@ function test_simple_absolute_symlink(callback) {
console.log('using type=%s', type);
- const entry = tmpAbsDir + '/symlink';
- const expected = common.fixturesDir + '/nested-index/one';
+ const entry = `${tmpAbsDir}/symlink`;
+ const expected = `${common.fixturesDir}/nested-index/one`;
[
[entry, expected]
].forEach(function(t) {
@@ -212,11 +213,11 @@ function test_cyclic_link_protection(callback) {
common.skip('symlink test (no privs)');
return runNextTest();
}
- const entry = path.join(common.tmpDir, '/cycles/realpath-3a');
+ const entry = path.join(tmpDir, '/cycles/realpath-3a');
[
[entry, '../cycles/realpath-3b'],
- [path.join(common.tmpDir, '/cycles/realpath-3b'), '../cycles/realpath-3c'],
- [path.join(common.tmpDir, '/cycles/realpath-3c'), '../cycles/realpath-3a']
+ [path.join(tmpDir, '/cycles/realpath-3b'), '../cycles/realpath-3c'],
+ [path.join(tmpDir, '/cycles/realpath-3c'), '../cycles/realpath-3a']
].forEach(function(t) {
try { fs.unlinkSync(t[0]); } catch (e) {}
fs.symlinkSync(t[1], t[0], 'dir');
@@ -239,10 +240,10 @@ function test_cyclic_link_overprotection(callback) {
common.skip('symlink test (no privs)');
return runNextTest();
}
- const cycles = common.tmpDir + '/cycles';
+ const cycles = `${tmpDir}/cycles`;
const expected = fs.realpathSync(cycles);
- const folder = cycles + '/folder';
- const link = folder + '/cycles';
+ const folder = `${cycles}/folder`;
+ const link = `${folder}/cycles`;
let testPath = cycles;
testPath += '/folder/cycles'.repeat(10);
try { fs.unlinkSync(link); } catch (ex) {}
@@ -264,12 +265,12 @@ function test_relative_input_cwd(callback) {
// we need to calculate the relative path to the tmp dir from cwd
const entrydir = process.cwd();
const entry = path.relative(entrydir,
- path.join(common.tmpDir + '/cycles/realpath-3a'));
- const expected = common.tmpDir + '/cycles/root.js';
+ path.join(`${tmpDir}/cycles/realpath-3a`));
+ const expected = `${tmpDir}/cycles/root.js`;
[
[entry, '../cycles/realpath-3b'],
- [common.tmpDir + '/cycles/realpath-3b', '../cycles/realpath-3c'],
- [common.tmpDir + '/cycles/realpath-3c', 'root.js']
+ [`${tmpDir}/cycles/realpath-3b`, '../cycles/realpath-3c'],
+ [`${tmpDir}/cycles/realpath-3c`, 'root.js']
].forEach(function(t) {
const fn = t[0];
console.error('fn=%j', fn);
@@ -317,16 +318,16 @@ function test_deep_symlink_mix(callback) {
fs.mkdirSync(tmp('node-test-realpath-d2'), 0o700);
try {
[
- [entry, common.tmpDir + '/node-test-realpath-d1/foo'],
+ [entry, `${tmpDir}/node-test-realpath-d1/foo`],
[tmp('node-test-realpath-d1'),
- common.tmpDir + '/node-test-realpath-d2'],
+ `${tmpDir}/node-test-realpath-d2`],
[tmp('node-test-realpath-d2/foo'), '../node-test-realpath-f2'],
- [tmp('node-test-realpath-f2'), targetsAbsDir +
- '/nested-index/one/realpath-c'],
- [targetsAbsDir + '/nested-index/one/realpath-c', targetsAbsDir +
- '/nested-index/two/realpath-c'],
- [targetsAbsDir + '/nested-index/two/realpath-c',
- common.tmpDir + '/cycles/root.js']
+ [tmp('node-test-realpath-f2'),
+ `${targetsAbsDir}/nested-index/one/realpath-c`],
+ [`${targetsAbsDir}/nested-index/one/realpath-c`,
+ `${targetsAbsDir}/nested-index/two/realpath-c`],
+ [`${targetsAbsDir}/nested-index/two/realpath-c`,
+ `${tmpDir}/cycles/root.js`]
].forEach(function(t) {
try { fs.unlinkSync(t[0]); } catch (e) {}
fs.symlinkSync(t[1], t[0]);
@@ -335,7 +336,7 @@ function test_deep_symlink_mix(callback) {
} finally {
unlink.push(tmp('node-test-realpath-d2'));
}
- const expected = tmpAbsDir + '/cycles/root.js';
+ const expected = `${tmpAbsDir}/cycles/root.js`;
assertEqualPath(fs.realpathSync(entry), path.resolve(expected));
asynctest(fs.realpath, [entry], callback, function(err, result) {
assertEqualPath(result, path.resolve(expected));
@@ -346,8 +347,8 @@ function test_deep_symlink_mix(callback) {
function test_non_symlinks(callback) {
console.log('test_non_symlinks');
const entrydir = path.dirname(tmpAbsDir);
- const entry = tmpAbsDir.substr(entrydir.length + 1) + '/cycles/root.js';
- const expected = tmpAbsDir + '/cycles/root.js';
+ const entry = `${tmpAbsDir.substr(entrydir.length + 1)}/cycles/root.js`;
+ const expected = `${tmpAbsDir}/cycles/root.js`;
const origcwd = process.cwd();
process.chdir(entrydir);
assertEqualPath(fs.realpathSync(entry), path.resolve(expected));
@@ -362,15 +363,15 @@ const upone = path.join(process.cwd(), '..');
function test_escape_cwd(cb) {
console.log('test_escape_cwd');
asynctest(fs.realpath, ['..'], cb, function(er, uponeActual) {
- assertEqualPath(upone, uponeActual,
- 'realpath("..") expected: ' + path.resolve(upone) +
- ' actual:' + uponeActual);
+ assertEqualPath(
+ upone, uponeActual,
+ `realpath("..") expected: ${path.resolve(upone)} actual:${uponeActual}`);
});
}
const uponeActual = fs.realpathSync('..');
-assertEqualPath(upone, uponeActual,
- 'realpathSync("..") expected: ' + path.resolve(upone) +
- ' actual:' + uponeActual);
+assertEqualPath(
+ upone, uponeActual,
+ `realpathSync("..") expected: ${path.resolve(upone)} actual:${uponeActual}`);
// going up with .. multiple times
@@ -442,7 +443,7 @@ function test_abs_with_kids(cb) {
console.log('using type=%s', type);
- const root = tmpAbsDir + '/node-test-realpath-abs-kids';
+ const root = `${tmpAbsDir}/node-test-realpath-abs-kids`;
function cleanup() {
['/a/b/c/x.txt',
'/a/link'
@@ -464,15 +465,15 @@ function test_abs_with_kids(cb) {
'/a/b',
'/a/b/c'
].forEach(function(folder) {
- console.log('mkdir ' + root + folder);
+ console.log(`mkdir ${root}${folder}`);
fs.mkdirSync(root + folder, 0o700);
});
- fs.writeFileSync(root + '/a/b/c/x.txt', 'foo');
- fs.symlinkSync(root + '/a/b', root + '/a/link', type);
+ fs.writeFileSync(`${root}/a/b/c/x.txt`, 'foo');
+ fs.symlinkSync(`${root}/a/b`, `${root}/a/link`, type);
}
setup();
- const linkPath = root + '/a/link/c/x.txt';
- const expectPath = root + '/a/b/c/x.txt';
+ const linkPath = `${root}/a/link/c/x.txt`;
+ const expectPath = `${root}/a/b/c/x.txt`;
const actual = fs.realpathSync(linkPath);
// console.log({link:linkPath,expect:expectPath,actual:actual},'sync');
assertEqualPath(actual, path.resolve(expectPath));
@@ -506,8 +507,7 @@ function runNextTest(err) {
assert.ifError(err);
const test = tests.shift();
if (!test) {
- return console.log(numtests +
- ' subtests completed OK for fs.realpath');
+ return console.log(`${numtests} subtests completed OK for fs.realpath`);
}
testsRun++;
test(runNextTest);
diff --git a/test/parallel/test-fs-sir-writes-alot.js b/test/parallel/test-fs-sir-writes-alot.js
index 0b27d90766..3a3458a552 100644
--- a/test/parallel/test-fs-sir-writes-alot.js
+++ b/test/parallel/test-fs-sir-writes-alot.js
@@ -56,7 +56,7 @@ function testBuffer(b) {
for (let i = 0; i < b.length; i++) {
bytesChecked++;
if (b[i] !== 'a'.charCodeAt(0) && b[i] !== '\n'.charCodeAt(0)) {
- throw new Error('invalid char ' + i + ',' + b[i]);
+ throw new Error(`invalid char ${i},${b[i]}`);
}
}
}
diff --git a/test/parallel/test-fs-stat.js b/test/parallel/test-fs-stat.js
index dfd45855c0..6ed27806b9 100644
--- a/test/parallel/test-fs-stat.js
+++ b/test/parallel/test-fs-stat.js
@@ -77,25 +77,25 @@ fs.stat(__filename, common.mustCall(function(err, s) {
console.dir(s);
- console.log('isDirectory: ' + JSON.stringify(s.isDirectory()));
+ console.log(`isDirectory: ${JSON.stringify(s.isDirectory())}`);
assert.strictEqual(false, s.isDirectory());
- console.log('isFile: ' + JSON.stringify(s.isFile()));
+ console.log(`isFile: ${JSON.stringify(s.isFile())}`);
assert.strictEqual(true, s.isFile());
- console.log('isSocket: ' + JSON.stringify(s.isSocket()));
+ console.log(`isSocket: ${JSON.stringify(s.isSocket())}`);
assert.strictEqual(false, s.isSocket());
- console.log('isBlockDevice: ' + JSON.stringify(s.isBlockDevice()));
+ console.log(`isBlockDevice: ${JSON.stringify(s.isBlockDevice())}`);
assert.strictEqual(false, s.isBlockDevice());
- console.log('isCharacterDevice: ' + JSON.stringify(s.isCharacterDevice()));
+ console.log(`isCharacterDevice: ${JSON.stringify(s.isCharacterDevice())}`);
assert.strictEqual(false, s.isCharacterDevice());
- console.log('isFIFO: ' + JSON.stringify(s.isFIFO()));
+ console.log(`isFIFO: ${JSON.stringify(s.isFIFO())}`);
assert.strictEqual(false, s.isFIFO());
- console.log('isSymbolicLink: ' + JSON.stringify(s.isSymbolicLink()));
+ console.log(`isSymbolicLink: ${JSON.stringify(s.isSymbolicLink())}`);
assert.strictEqual(false, s.isSymbolicLink());
assert.ok(s.mtime instanceof Date);
diff --git a/test/parallel/test-fs-stream-double-close.js b/test/parallel/test-fs-stream-double-close.js
index dd896df16e..3a8086d0ac 100644
--- a/test/parallel/test-fs-stream-double-close.js
+++ b/test/parallel/test-fs-stream-double-close.js
@@ -29,9 +29,9 @@ test1(fs.createReadStream(__filename));
test2(fs.createReadStream(__filename));
test3(fs.createReadStream(__filename));
-test1(fs.createWriteStream(common.tmpDir + '/dummy1'));
-test2(fs.createWriteStream(common.tmpDir + '/dummy2'));
-test3(fs.createWriteStream(common.tmpDir + '/dummy3'));
+test1(fs.createWriteStream(`${common.tmpDir}/dummy1`));
+test2(fs.createWriteStream(`${common.tmpDir}/dummy2`));
+test3(fs.createWriteStream(`${common.tmpDir}/dummy3`));
function test1(stream) {
stream.destroy();
diff --git a/test/parallel/test-fs-symlink-dir-junction-relative.js b/test/parallel/test-fs-symlink-dir-junction-relative.js
index 964c32848e..64f9dd9feb 100644
--- a/test/parallel/test-fs-symlink-dir-junction-relative.js
+++ b/test/parallel/test-fs-symlink-dir-junction-relative.js
@@ -48,8 +48,8 @@ function verifyLink(linkPath) {
const stats = fs.lstatSync(linkPath);
assert.ok(stats.isSymbolicLink());
- const data1 = fs.readFileSync(linkPath + '/x.txt', 'ascii');
- const data2 = fs.readFileSync(linkTarget + '/x.txt', 'ascii');
+ const data1 = fs.readFileSync(`${linkPath}/x.txt`, 'ascii');
+ const data2 = fs.readFileSync(`${linkTarget}/x.txt`, 'ascii');
assert.strictEqual(data1, data2);
// Clean up.
diff --git a/test/parallel/test-fs-symlink-dir-junction.js b/test/parallel/test-fs-symlink-dir-junction.js
index 0c85f3991c..bc7495aed3 100644
--- a/test/parallel/test-fs-symlink-dir-junction.js
+++ b/test/parallel/test-fs-symlink-dir-junction.js
@@ -31,8 +31,8 @@ const linkPath = path.join(common.tmpDir, 'cycles_link');
common.refreshTmpDir();
-console.log('linkData: ' + linkData);
-console.log('linkPath: ' + linkPath);
+console.log(`linkData: ${linkData}`);
+console.log(`linkPath: ${linkPath}`);
fs.symlink(linkData, linkPath, 'junction', common.mustCall(function(err) {
assert.ifError(err);
diff --git a/test/parallel/test-fs-timestamp-parsing-error.js b/test/parallel/test-fs-timestamp-parsing-error.js
index 42bbe45d51..c37cf674a4 100644
--- a/test/parallel/test-fs-timestamp-parsing-error.js
+++ b/test/parallel/test-fs-timestamp-parsing-error.js
@@ -5,7 +5,7 @@ const assert = require('assert');
[Infinity, -Infinity, NaN].forEach((input) => {
assert.throws(() => fs._toUnixTimestamp(input),
- new RegExp('^Error: Cannot parse time: ' + input + '$'));
+ new RegExp(`^Error: Cannot parse time: ${input}$`));
});
assert.throws(() => fs._toUnixTimestamp({}),
diff --git a/test/parallel/test-fs-truncate-GH-6233.js b/test/parallel/test-fs-truncate-GH-6233.js
index b2982cccb9..07bd272024 100644
--- a/test/parallel/test-fs-truncate-GH-6233.js
+++ b/test/parallel/test-fs-truncate-GH-6233.js
@@ -24,7 +24,7 @@ const common = require('../common');
const assert = require('assert');
const fs = require('fs');
-const filename = common.tmpDir + '/truncate-file.txt';
+const filename = `${common.tmpDir}/truncate-file.txt`;
common.refreshTmpDir();
diff --git a/test/parallel/test-fs-write-file.js b/test/parallel/test-fs-write-file.js
index b18308ad0c..6dd1a58ecb 100644
--- a/test/parallel/test-fs-write-file.js
+++ b/test/parallel/test-fs-write-file.js
@@ -77,7 +77,7 @@ fs.writeFile(filename3, n, { mode: m }, common.mustCall(function(e) {
fs.readFile(filename3, common.mustCall(function(e, buffer) {
assert.ifError(e);
- assert.strictEqual(Buffer.byteLength('' + n), buffer.length);
+ assert.strictEqual(Buffer.byteLength(String(n)), buffer.length);
}));
}));
diff --git a/test/parallel/test-fs-write-stream-err.js b/test/parallel/test-fs-write-stream-err.js
index 762f6188e0..077bfb24b7 100644
--- a/test/parallel/test-fs-write-stream-err.js
+++ b/test/parallel/test-fs-write-stream-err.js
@@ -26,7 +26,7 @@ const fs = require('fs');
common.refreshTmpDir();
-const stream = fs.createWriteStream(common.tmpDir + '/out', {
+const stream = fs.createWriteStream(`${common.tmpDir}/out`, {
highWaterMark: 10
});
const err = new Error('BAM');
diff --git a/test/parallel/test-fs-write-string-coerce.js b/test/parallel/test-fs-write-string-coerce.js
index 8251a45766..58fe197a83 100644
--- a/test/parallel/test-fs-write-string-coerce.js
+++ b/test/parallel/test-fs-write-string-coerce.js
@@ -9,7 +9,7 @@ common.refreshTmpDir();
const fn = path.join(common.tmpDir, 'write-string-coerce.txt');
const data = true;
-const expected = data + '';
+const expected = String(data);
fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) {
assert.ifError(err);
diff --git a/test/parallel/test-http-abort-client.js b/test/parallel/test-http-abort-client.js
index 45261490ca..ada72dbcd0 100644
--- a/test/parallel/test-http-abort-client.js
+++ b/test/parallel/test-http-abort-client.js
@@ -38,11 +38,11 @@ server.listen(0, common.mustCall(function() {
}, common.mustCall(function(res) {
server.close();
- console.log('Got res: ' + res.statusCode);
+ console.log(`Got res: ${res.statusCode}`);
console.dir(res.headers);
res.on('data', function(chunk) {
- console.log('Read ' + chunk.length + ' bytes');
+ console.log(`Read ${chunk.length} bytes`);
console.log(' chunk=%j', chunk.toString());
});
diff --git a/test/parallel/test-http-abort-queued.js b/test/parallel/test-http-abort-queued.js
index 639947560e..788ec8c4f3 100644
--- a/test/parallel/test-http-abort-queued.js
+++ b/test/parallel/test-http-abort-queued.js
@@ -80,11 +80,11 @@ server.listen(0, function() {
assert.strictEqual(Object.keys(agent.sockets).length, 1);
assert.strictEqual(Object.keys(agent.requests).length, 1);
- console.log('Got res: ' + res1.statusCode);
+ console.log(`Got res: ${res1.statusCode}`);
console.dir(res1.headers);
res1.on('data', function(chunk) {
- console.log('Read ' + chunk.length + ' bytes');
+ console.log(`Read ${chunk.length} bytes`);
console.log(' chunk=%j', chunk.toString());
complete();
});
diff --git a/test/parallel/test-http-after-connect.js b/test/parallel/test-http-after-connect.js
index 323c905a87..d8a711c8d6 100644
--- a/test/parallel/test-http-after-connect.js
+++ b/test/parallel/test-http-after-connect.js
@@ -64,7 +64,7 @@ server.listen(0, function() {
function doRequest(i) {
http.get({
port: server.address().port,
- path: '/request' + i
+ path: `/request${i}`
}, common.mustCall(function(res) {
console.error('Client got GET response');
let data = '';
@@ -73,7 +73,7 @@ function doRequest(i) {
data += chunk;
});
res.on('end', function() {
- assert.strictEqual(data, '/request' + i);
+ assert.strictEqual(data, `/request${i}`);
++clientResponses;
if (clientResponses === 2) {
server.close();
diff --git a/test/parallel/test-http-agent-error-on-idle.js b/test/parallel/test-http-agent-error-on-idle.js
index 23fa4dddfa..2f270c0d30 100644
--- a/test/parallel/test-http-agent-error-on-idle.js
+++ b/test/parallel/test-http-agent-error-on-idle.js
@@ -29,7 +29,7 @@ server.listen(0, function() {
process.nextTick(function() {
const freeSockets = agent.freeSockets[socketKey];
assert.strictEqual(freeSockets.length, 1,
- 'expect a free socket on ' + socketKey);
+ `expect a free socket on ${socketKey}`);
//generate a random error on the free socket
const freeSocket = freeSockets[0];
diff --git a/test/parallel/test-http-agent-getname.js b/test/parallel/test-http-agent-getname.js
index 45e1817cf5..f84996ec01 100644
--- a/test/parallel/test-http-agent-getname.js
+++ b/test/parallel/test-http-agent-getname.js
@@ -35,4 +35,4 @@ for (const family of [0, null, undefined, 'bogus'])
assert.strictEqual(agent.getName({ family }), 'localhost::');
for (const family of [4, 6])
- assert.strictEqual(agent.getName({ family }), 'localhost:::' + family);
+ assert.strictEqual(agent.getName({ family }), `localhost:::${family}`);
diff --git a/test/parallel/test-http-agent-maxsockets.js b/test/parallel/test-http-agent-maxsockets.js
index fc7618c5c0..5139061600 100644
--- a/test/parallel/test-http-agent-maxsockets.js
+++ b/test/parallel/test-http-agent-maxsockets.js
@@ -30,7 +30,7 @@ function done() {
}
const freepool = agent.freeSockets[Object.keys(agent.freeSockets)[0]];
assert.strictEqual(freepool.length, 2,
- 'expect keep 2 free sockets, but got ' + freepool.length);
+ `expect keep 2 free sockets, but got ${freepool.length}`);
agent.destroy();
server.close();
}
diff --git a/test/parallel/test-http-buffer-sanity.js b/test/parallel/test-http-buffer-sanity.js
index c94ea1f358..a72d326d6f 100644
--- a/test/parallel/test-http-buffer-sanity.js
+++ b/test/parallel/test-http-buffer-sanity.js
@@ -58,7 +58,7 @@ const web = http.Server(function(req, res) {
});
req.connection.on('error', function(e) {
- console.log('http server-side error: ' + e.message);
+ console.log(`http server-side error: ${e.message}`);
process.exit(1);
});
});
diff --git a/test/parallel/test-http-chunk-problem.js b/test/parallel/test-http-chunk-problem.js
index 0ffd71813e..5127075f4f 100644
--- a/test/parallel/test-http-chunk-problem.js
+++ b/test/parallel/test-http-chunk-problem.js
@@ -82,7 +82,7 @@ cp.exec(ddcmd, function(err, stdout, stderr) {
// End the response on exit (and log errors)
cat.on('exit', (code) => {
if (code !== 0) {
- console.error('subprocess exited with code ' + code);
+ console.error(`subprocess exited with code ${code}`);
process.exit(1);
}
});
diff --git a/test/parallel/test-http-client-abort.js b/test/parallel/test-http-client-abort.js
index 549344f0cd..eaf4a05e6f 100644
--- a/test/parallel/test-http-client-abort.js
+++ b/test/parallel/test-http-client-abort.js
@@ -36,7 +36,7 @@ const server = http.Server(function(req, res) {
// event like "aborted" or something.
req.on('aborted', function() {
clientAborts++;
- console.log('Got abort ' + clientAborts);
+ console.log(`Got abort ${clientAborts}`);
if (clientAborts === N) {
console.log('All aborts detected, you win.');
server.close();
@@ -52,10 +52,10 @@ server.listen(0, function() {
console.log('Server listening.');
for (let i = 0; i < N; i++) {
- console.log('Making client ' + i);
- const options = { port: this.address().port, path: '/?id=' + i };
+ console.log(`Making client ${i}`);
+ const options = { port: this.address().port, path: `/?id=${i}` };
const req = http.get(options, function(res) {
- console.log('Client response code ' + res.statusCode);
+ console.log(`Client response code ${res.statusCode}`);
res.resume();
if (++responses === N) {
diff --git a/test/parallel/test-http-client-agent.js b/test/parallel/test-http-client-agent.js
index d3e1dea7aa..3fb647399d 100644
--- a/test/parallel/test-http-client-agent.js
+++ b/test/parallel/test-http-client-agent.js
@@ -49,7 +49,7 @@ server.listen(0, function() {
function request(i) {
const req = http.get({
port: server.address().port,
- path: '/' + i
+ path: `/${i}`
}, function(res) {
const socket = req.socket;
socket.on('close', function() {
diff --git a/test/parallel/test-http-client-default-headers-exist.js b/test/parallel/test-http-client-default-headers-exist.js
index 45bc861b4c..96f3119c3b 100644
--- a/test/parallel/test-http-client-default-headers-exist.js
+++ b/test/parallel/test-http-client-default-headers-exist.js
@@ -42,21 +42,21 @@ const server = http.createServer(function(req, res) {
res.end();
assert(expectedHeaders.hasOwnProperty(req.method),
- req.method + ' was an unexpected method');
+ `${req.method} was an unexpected method`);
const requestHeaders = Object.keys(req.headers);
requestHeaders.forEach(function(header) {
assert.notStrictEqual(
expectedHeaders[req.method].indexOf(header.toLowerCase()),
-1,
- header + ' shoud not exist for method ' + req.method
+ `${header} should not exist for method ${req.method}`
);
});
assert.strictEqual(
requestHeaders.length,
expectedHeaders[req.method].length,
- 'some headers were missing for method: ' + req.method
+ `some headers were missing for method: ${req.method}`
);
if (expectedMethods.length === requestCount)
diff --git a/test/parallel/test-http-client-timeout-agent.js b/test/parallel/test-http-client-timeout-agent.js
index 1e39797cde..b041f21ca8 100644
--- a/test/parallel/test-http-client-timeout-agent.js
+++ b/test/parallel/test-http-client-timeout-agent.js
@@ -51,27 +51,27 @@ server.listen(0, options.host, function() {
let req;
for (requests_sent = 0; requests_sent < 30; requests_sent += 1) {
- options.path = '/' + requests_sent;
+ options.path = `/${requests_sent}`;
req = http.request(options);
req.id = requests_sent;
req.on('response', function(res) {
res.on('data', function(data) {
- console.log('res#' + this.req.id + ' data:' + data);
+ console.log(`res#${this.req.id} data:${data}`);
});
res.on('end', function(data) {
- console.log('res#' + this.req.id + ' end');
+ console.log(`res#${this.req.id} end`);
requests_done += 1;
});
});
req.on('close', function() {
- console.log('req#' + this.id + ' close');
+ console.log(`req#${this.id} close`);
});
req.on('error', function() {
- console.log('req#' + this.id + ' error');
+ console.log(`req#${this.id} error`);
this.destroy();
});
req.setTimeout(50, function() {
- console.log('req#' + this.id + ' timeout');
+ console.log(`req#${this.id} timeout`);
this.abort();
requests_done += 1;
});
diff --git a/test/parallel/test-http-client-timeout-with-data.js b/test/parallel/test-http-client-timeout-with-data.js
index b7bd2c5479..a35611bb08 100644
--- a/test/parallel/test-http-client-timeout-with-data.js
+++ b/test/parallel/test-http-client-timeout-with-data.js
@@ -51,7 +51,7 @@ server.listen(0, options.host, function() {
}));
res.on('data', common.mustCall(function(data) {
- assert.strictEqual('' + data, '*');
+ assert.strictEqual(String(data), '*');
nchunks++;
}, 2));
diff --git a/test/parallel/test-http-client-unescaped-path.js b/test/parallel/test-http-client-unescaped-path.js
index 3aede27e7d..d991e9f75e 100644
--- a/test/parallel/test-http-client-unescaped-path.js
+++ b/test/parallel/test-http-client-unescaped-path.js
@@ -25,7 +25,7 @@ const assert = require('assert');
const http = require('http');
for (let i = 0; i <= 32; i += 1) {
- const path = 'bad' + String.fromCharCode(i) + 'path';
+ const path = `bad${String.fromCharCode(i)}path`;
assert.throws(() => http.get({ path }, common.mustNotCall()),
/contains unescaped characters/);
}
diff --git a/test/parallel/test-http-client-upload.js b/test/parallel/test-http-client-upload.js
index 5b384de743..1e1f540cf0 100644
--- a/test/parallel/test-http-client-upload.js
+++ b/test/parallel/test-http-client-upload.js
@@ -31,7 +31,7 @@ const server = http.createServer(common.mustCall(function(req, res) {
let sent_body = '';
req.on('data', function(chunk) {
- console.log('server got: ' + JSON.stringify(chunk));
+ console.log(`server got: ${JSON.stringify(chunk)}`);
sent_body += chunk;
});
diff --git a/test/parallel/test-http-connect-req-res.js b/test/parallel/test-http-connect-req-res.js
index c569d1f926..5db19aedde 100644
--- a/test/parallel/test-http-connect-req-res.js
+++ b/test/parallel/test-http-connect-req-res.js
@@ -39,7 +39,7 @@ server.listen(0, common.mustCall(function() {
console.error('Client got CONNECT request');
// Make sure this request got removed from the pool.
- const name = 'localhost:' + server.address().port;
+ const name = `localhost:${server.address().port}`;
assert(!http.globalAgent.sockets.hasOwnProperty(name));
assert(!http.globalAgent.requests.hasOwnProperty(name));
diff --git a/test/parallel/test-http-connect.js b/test/parallel/test-http-connect.js
index 6194b1625c..4b251832ff 100644
--- a/test/parallel/test-http-connect.js
+++ b/test/parallel/test-http-connect.js
@@ -53,7 +53,7 @@ server.listen(0, common.mustCall(function() {
req.on('connect', common.mustCall((res, socket, firstBodyChunk) => {
// Make sure this request got removed from the pool.
- const name = 'localhost:' + server.address().port;
+ const name = `localhost:${server.address().port}`;
assert(!http.globalAgent.sockets.hasOwnProperty(name));
assert(!http.globalAgent.requests.hasOwnProperty(name));
diff --git a/test/parallel/test-http-contentLength0.js b/test/parallel/test-http-contentLength0.js
index 25e098d425..565de21c72 100644
--- a/test/parallel/test-http-contentLength0.js
+++ b/test/parallel/test-http-contentLength0.js
@@ -35,7 +35,7 @@ const s = http.createServer(function(req, res) {
s.listen(0, function() {
const request = http.request({ port: this.address().port }, (response) => {
- console.log('STATUS: ' + response.statusCode);
+ console.log(`STATUS: ${response.statusCode}`);
s.close();
response.resume();
});
diff --git a/test/parallel/test-http-default-port.js b/test/parallel/test-http-default-port.js
index c09bb18495..d53c69c1b0 100644
--- a/test/parallel/test-http-default-port.js
+++ b/test/parallel/test-http-default-port.js
@@ -35,8 +35,8 @@ const fs = require('fs');
const path = require('path');
const fixtures = path.join(common.fixturesDir, 'keys');
const options = {
- key: fs.readFileSync(fixtures + '/agent1-key.pem'),
- cert: fs.readFileSync(fixtures + '/agent1-cert.pem')
+ key: fs.readFileSync(`${fixtures}/agent1-key.pem`),
+ cert: fs.readFileSync(`${fixtures}/agent1-cert.pem`)
};
let gotHttpsResp = false;
let gotHttpResp = false;
diff --git a/test/parallel/test-http-exceptions.js b/test/parallel/test-http-exceptions.js
index 37b4136713..6b02a98242 100644
--- a/test/parallel/test-http-exceptions.js
+++ b/test/parallel/test-http-exceptions.js
@@ -32,14 +32,14 @@ const server = http.createServer(function(req, res) {
server.listen(0, function() {
for (let i = 0; i < 4; i += 1) {
- http.get({ port: this.address().port, path: '/busy/' + i });
+ http.get({ port: this.address().port, path: `/busy/${i}` });
}
});
let exception_count = 0;
process.on('uncaughtException', function(err) {
- console.log('Caught an exception: ' + err);
+ console.log(`Caught an exception: ${err}`);
if (err.name === 'AssertionError') throw err;
if (++exception_count === 4) process.exit(0);
});
diff --git a/test/parallel/test-http-expect-continue.js b/test/parallel/test-http-expect-continue.js
index 5a08aa9fed..35b4c1fcee 100644
--- a/test/parallel/test-http-expect-continue.js
+++ b/test/parallel/test-http-expect-continue.js
@@ -71,8 +71,8 @@ server.on('listening', function() {
req.on('response', function(res) {
assert.strictEqual(got_continue, true,
'Full response received before 100 Continue');
- assert.strictEqual(200, res.statusCode, 'Final status code was ' +
- res.statusCode + ', not 200.');
+ assert.strictEqual(200, res.statusCode,
+ `Final status code was ${res.statusCode}, not 200.`);
res.setEncoding('utf8');
res.on('data', function(chunk) { body += chunk; });
res.on('end', function() {
diff --git a/test/parallel/test-http-expect-handling.js b/test/parallel/test-http-expect-handling.js
index fed715bc2a..fd1f244979 100644
--- a/test/parallel/test-http-expect-handling.js
+++ b/test/parallel/test-http-expect-handling.js
@@ -35,8 +35,8 @@ function nextTest() {
}
http.get(options, function(response) {
- console.log('client: expected status: ' + test);
- console.log('client: statusCode: ' + response.statusCode);
+ console.log(`client: expected status: ${test}`);
+ console.log(`client: statusCode: ${response.statusCode}`);
assert.strictEqual(response.statusCode, test);
assert.strictEqual(response.statusMessage, 'Expectation Failed');
diff --git a/test/parallel/test-http-extra-response.js b/test/parallel/test-http-extra-response.js
index e83171378d..e71decb0c3 100644
--- a/test/parallel/test-http-extra-response.js
+++ b/test/parallel/test-http-extra-response.js
@@ -65,7 +65,7 @@ const server = net.createServer(function(socket) {
server.listen(0, common.mustCall(function() {
http.get({ port: this.address().port }, common.mustCall(function(res) {
let buffer = '';
- console.log('Got res code: ' + res.statusCode);
+ console.log(`Got res code: ${res.statusCode}`);
res.setEncoding('utf8');
res.on('data', function(chunk) {
@@ -73,7 +73,7 @@ server.listen(0, common.mustCall(function() {
});
res.on('end', common.mustCall(function() {
- console.log('Response ended, read ' + buffer.length + ' bytes');
+ console.log(`Response ended, read ${buffer.length} bytes`);
assert.strictEqual(body, buffer);
server.close();
}));
diff --git a/test/parallel/test-http-full-response.js b/test/parallel/test-http-full-response.js
index c8cfdee284..6d81f967f4 100644
--- a/test/parallel/test-http-full-response.js
+++ b/test/parallel/test-http-full-response.js
@@ -43,7 +43,7 @@ function runAb(opts, callback) {
exec(command, function(err, stdout, stderr) {
if (err) {
if (/ab|apr/mi.test(stderr)) {
- common.skip('problem spawning `ab`.\n' + stderr);
+ common.skip(`problem spawning \`ab\`.\n${stderr}`);
process.reallyExit(0);
}
process.exit();
diff --git a/test/parallel/test-http-get-pipeline-problem.js b/test/parallel/test-http-get-pipeline-problem.js
index 762100511a..8439f80a07 100644
--- a/test/parallel/test-http-get-pipeline-problem.js
+++ b/test/parallel/test-http-get-pipeline-problem.js
@@ -32,9 +32,9 @@ http.globalAgent.maxSockets = 1;
common.refreshTmpDir();
-const image = fs.readFileSync(common.fixturesDir + '/person.jpg');
+const image = fs.readFileSync(`${common.fixturesDir}/person.jpg`);
-console.log('image.length = ' + image.length);
+console.log(`image.length = ${image.length}`);
const total = 10;
let requests = 0;
@@ -67,12 +67,12 @@ server.listen(0, function() {
};
http.get(opts, function(res) {
- console.error('recv ' + x);
- const s = fs.createWriteStream(common.tmpDir + '/' + x + '.jpg');
+ console.error(`recv ${x}`);
+ const s = fs.createWriteStream(`${common.tmpDir}/${x}.jpg`);
res.pipe(s);
s.on('finish', function() {
- console.error('done ' + x);
+ console.error(`done ${x}`);
if (++responses === total) {
checkFiles();
}
@@ -93,12 +93,12 @@ function checkFiles() {
assert(total <= files.length);
for (let i = 0; i < total; i++) {
- const fn = i + '.jpg';
- assert.ok(files.includes(fn), "couldn't find '" + fn + "'");
- const stat = fs.statSync(common.tmpDir + '/' + fn);
- assert.strictEqual(image.length, stat.size,
- "size doesn't match on '" + fn +
- "'. Got " + stat.size + ' bytes');
+ const fn = `${i}.jpg`;
+ assert.ok(files.includes(fn), `couldn't find '${fn}'`);
+ const stat = fs.statSync(`${common.tmpDir}/${fn}`);
+ assert.strictEqual(
+ image.length, stat.size,
+ `size doesn't match on '${fn}'. Got ${stat.size} bytes`);
}
checkedFiles = true;
diff --git a/test/parallel/test-http-host-headers.js b/test/parallel/test-http-host-headers.js
index a16e4fea09..97d200ade1 100644
--- a/test/parallel/test-http-host-headers.js
+++ b/test/parallel/test-http-host-headers.js
@@ -29,9 +29,9 @@ function reqHandler(req, res) {
if (req.url === '/setHostFalse5') {
assert.strictEqual(req.headers.host, undefined);
} else {
- assert.strictEqual(req.headers.host, `localhost:${this.address().port}`,
- 'Wrong host header for req[' + req.url + ']: ' +
- req.headers.host);
+ assert.strictEqual(
+ req.headers.host, `localhost:${this.address().port}`,
+ `Wrong host header for req[${req.url}]: ${req.headers.host}`);
}
res.writeHead(200, {});
res.end('ok');
@@ -55,7 +55,7 @@ function testHttp() {
assert.ifError(er);
http.get({
method: 'GET',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
port: httpServer.address().port,
rejectUnauthorized: false
@@ -63,7 +63,7 @@ function testHttp() {
http.request({
method: 'GET',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
port: httpServer.address().port,
rejectUnauthorized: false
@@ -71,7 +71,7 @@ function testHttp() {
http.request({
method: 'POST',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
port: httpServer.address().port,
rejectUnauthorized: false
@@ -79,7 +79,7 @@ function testHttp() {
http.request({
method: 'PUT',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
port: httpServer.address().port,
rejectUnauthorized: false
@@ -87,7 +87,7 @@ function testHttp() {
http.request({
method: 'DELETE',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
port: httpServer.address().port,
rejectUnauthorized: false
diff --git a/test/parallel/test-http-invalidheaderfield2.js b/test/parallel/test-http-invalidheaderfield2.js
index e7e8013c37..2267c8565c 100644
--- a/test/parallel/test-http-invalidheaderfield2.js
+++ b/test/parallel/test-http-invalidheaderfield2.js
@@ -28,11 +28,9 @@ const checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;
'4+2',
'3.14159265359'
].forEach(function(str) {
- assert.strictEqual(checkIsHttpToken(str),
- true,
- 'checkIsHttpToken(' +
- inspect(str) +
- ') unexpectedly failed');
+ assert.strictEqual(
+ checkIsHttpToken(str), true,
+ `checkIsHttpToken(${inspect(str)}) unexpectedly failed`);
});
// Bad header field names
[
@@ -56,11 +54,9 @@ const checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;
'"Quote"',
'This,That'
].forEach(function(str) {
- assert.strictEqual(checkIsHttpToken(str),
- false,
- 'checkIsHttpToken(' +
- inspect(str) +
- ') unexpectedly succeeded');
+ assert.strictEqual(
+ checkIsHttpToken(str), false,
+ `checkIsHttpToken(${inspect(str)}) unexpectedly succeeded`);
});
@@ -71,11 +67,9 @@ const checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;
'0123456789ABCdef',
'!@#$%^&*()-_=+\\;\':"[]{}<>,./?|~`'
].forEach(function(str) {
- assert.strictEqual(checkInvalidHeaderChar(str),
- false,
- 'checkInvalidHeaderChar(' +
- inspect(str) +
- ') unexpectedly failed');
+ assert.strictEqual(
+ checkInvalidHeaderChar(str), false,
+ `checkInvalidHeaderChar(${inspect(str)}) unexpectedly failed`);
});
// Bad header field values
@@ -89,9 +83,7 @@ const checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;
'foo\vbar',
'Ding!\x07'
].forEach(function(str) {
- assert.strictEqual(checkInvalidHeaderChar(str),
- true,
- 'checkInvalidHeaderChar(' +
- inspect(str) +
- ') unexpectedly succeeded');
+ assert.strictEqual(
+ checkInvalidHeaderChar(str), true,
+ `checkInvalidHeaderChar(${inspect(str)}) unexpectedly succeeded`);
});
diff --git a/test/parallel/test-http-keepalive-client.js b/test/parallel/test-http-keepalive-client.js
index 319165c59d..5a9277feee 100644
--- a/test/parallel/test-http-keepalive-client.js
+++ b/test/parallel/test-http-keepalive-client.js
@@ -59,7 +59,7 @@ function makeRequest(n) {
const req = http.request({
port: server.address().port,
agent: agent,
- path: '/' + n
+ path: `/${n}`
});
req.end();
@@ -79,7 +79,7 @@ function makeRequest(n) {
data += c;
});
res.on('end', function() {
- assert.strictEqual(data, '/' + n);
+ assert.strictEqual(data, `/${n}`);
setTimeout(function() {
actualRequests++;
makeRequest(n - 1);
diff --git a/test/parallel/test-http-keepalive-maxsockets.js b/test/parallel/test-http-keepalive-maxsockets.js
index e4db44f0a7..2d934793ac 100644
--- a/test/parallel/test-http-keepalive-maxsockets.js
+++ b/test/parallel/test-http-keepalive-maxsockets.js
@@ -84,7 +84,7 @@ server.listen(0, function() {
function makeReq(i, cb) {
http.request({
port: server.address().port,
- path: '/' + i,
+ path: `/${i}`,
agent: agent
}, function(res) {
let data = '';
@@ -93,7 +93,7 @@ server.listen(0, function() {
data += c;
});
res.on('end', function() {
- assert.strictEqual(data, '/' + i);
+ assert.strictEqual(data, `/${i}`);
cb();
});
}).end();
diff --git a/test/parallel/test-http-keepalive-request.js b/test/parallel/test-http-keepalive-request.js
index e0d17fa8f1..574dea9ba5 100644
--- a/test/parallel/test-http-keepalive-request.js
+++ b/test/parallel/test-http-keepalive-request.js
@@ -58,7 +58,7 @@ function makeRequest(n) {
const req = http.request({
port: server.address().port,
- path: '/' + n,
+ path: `/${n}`,
agent: agent
});
@@ -79,7 +79,7 @@ function makeRequest(n) {
data += c;
});
res.on('end', function() {
- assert.strictEqual(data, '/' + n);
+ assert.strictEqual(data, `/${n}`);
setTimeout(function() {
actualRequests++;
makeRequest(n - 1);
diff --git a/test/parallel/test-http-localaddress-bind-error.js b/test/parallel/test-http-localaddress-bind-error.js
index 74595d6320..d4bd72bae1 100644
--- a/test/parallel/test-http-localaddress-bind-error.js
+++ b/test/parallel/test-http-localaddress-bind-error.js
@@ -27,11 +27,11 @@ const http = require('http');
const invalidLocalAddress = '1.2.3.4';
const server = http.createServer(function(req, res) {
- console.log('Connect from: ' + req.connection.remoteAddress);
+ console.log(`Connect from: ${req.connection.remoteAddress}`);
req.on('end', function() {
res.writeHead(200, { 'Content-Type': 'text/plain' });
- res.end('You are from: ' + req.connection.remoteAddress);
+ res.end(`You are from: ${req.connection.remoteAddress}`);
});
req.resume();
});
@@ -46,7 +46,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() {
}, function(res) {
assert.fail('unexpectedly got response from server');
}).on('error', common.mustCall(function(e) {
- console.log('client got error: ' + e.message);
+ console.log(`client got error: ${e.message}`);
server.close();
})).end();
}));
diff --git a/test/parallel/test-http-localaddress.js b/test/parallel/test-http-localaddress.js
index 9053c5e089..35f2c15f8d 100644
--- a/test/parallel/test-http-localaddress.js
+++ b/test/parallel/test-http-localaddress.js
@@ -30,12 +30,12 @@ if (!common.hasMultiLocalhost()) {
}
const server = http.createServer(function(req, res) {
- console.log('Connect from: ' + req.connection.remoteAddress);
+ console.log(`Connect from: ${req.connection.remoteAddress}`);
assert.strictEqual('127.0.0.2', req.connection.remoteAddress);
req.on('end', function() {
res.writeHead(200, { 'Content-Type': 'text/plain' });
- res.end('You are from: ' + req.connection.remoteAddress);
+ res.end(`You are from: ${req.connection.remoteAddress}`);
});
req.resume();
});
diff --git a/test/parallel/test-http-malformed-request.js b/test/parallel/test-http-malformed-request.js
index 1b0a0278cc..e0f719614e 100644
--- a/test/parallel/test-http-malformed-request.js
+++ b/test/parallel/test-http-malformed-request.js
@@ -33,7 +33,7 @@ let nrequests_completed = 0;
const nrequests_expected = 1;
const server = http.createServer(function(req, res) {
- console.log('req: ' + JSON.stringify(url.parse(req.url)));
+ console.log(`req: ${JSON.stringify(url.parse(req.url))}`);
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Hello World');
diff --git a/test/parallel/test-http-max-headers-count.js b/test/parallel/test-http-max-headers-count.js
index 342a6a0412..05f4f774c2 100644
--- a/test/parallel/test-http-max-headers-count.js
+++ b/test/parallel/test-http-max-headers-count.js
@@ -30,7 +30,7 @@ let responses = 0;
const headers = {};
const N = 2000;
for (let i = 0; i < N; ++i) {
- headers['key' + i] = i;
+ headers[`key${i}`] = i;
}
const maxAndExpected = [ // for server
diff --git a/test/parallel/test-http-outgoing-finish.js b/test/parallel/test-http-outgoing-finish.js
index 13c1eafdd6..a242a4728e 100644
--- a/test/parallel/test-http-outgoing-finish.js
+++ b/test/parallel/test-http-outgoing-finish.js
@@ -60,7 +60,7 @@ function write(out) {
finishEvent = true;
console.error('%s finish event', name);
process.nextTick(function() {
- assert(endCb, name + ' got finish event before endcb!');
+ assert(endCb, `${name} got finish event before endcb!`);
console.log('ok - %s finishEvent', name);
});
});
@@ -69,7 +69,7 @@ function write(out) {
endCb = true;
console.error('%s endCb', name);
process.nextTick(function() {
- assert(finishEvent, name + ' got endCb event before finishEvent!');
+ assert(finishEvent, `${name} got endCb event before finishEvent!`);
console.log('ok - %s endCb', name);
});
});
diff --git a/test/parallel/test-http-parser.js b/test/parallel/test-http-parser.js
index b919891cbf..f0a525cda3 100644
--- a/test/parallel/test-http-parser.js
+++ b/test/parallel/test-http-parser.js
@@ -82,7 +82,7 @@ function mustCall(f, times) {
function expectBody(expected) {
return mustCall(function(buf, start, len) {
- const body = '' + buf.slice(start, start + len);
+ const body = String(buf.slice(start, start + len));
assert.strictEqual(body, expected);
});
}
@@ -92,9 +92,7 @@ function expectBody(expected) {
// Simple request test.
//
{
- const request = Buffer.from(
- 'GET /hello HTTP/1.1' + CRLF +
- CRLF);
+ const request = Buffer.from(`GET /hello HTTP/1.1${CRLF}${CRLF}`);
const onHeadersComplete = (versionMajor, versionMinor, headers,
method, url, statusCode, statusMessage,
@@ -148,7 +146,7 @@ function expectBody(expected) {
};
const onBody = (buf, start, len) => {
- const body = '' + buf.slice(start, start + len);
+ const body = String(buf.slice(start, start + len));
assert.strictEqual(body, 'pong');
};
@@ -164,8 +162,7 @@ function expectBody(expected) {
//
{
const request = Buffer.from(
- 'HTTP/1.0 200 Connection established' + CRLF +
- CRLF);
+ `HTTP/1.0 200 Connection established${CRLF}${CRLF}`);
const onHeadersComplete = (versionMajor, versionMinor, headers,
method, url, statusCode, statusMessage,
@@ -219,7 +216,7 @@ function expectBody(expected) {
};
const onBody = (buf, start, len) => {
- const body = '' + buf.slice(start, start + len);
+ const body = String(buf.slice(start, start + len));
assert.strictEqual(body, 'ping');
seen_body = true;
};
@@ -264,8 +261,7 @@ function expectBody(expected) {
//
{
// 256 X-Filler headers
- let lots_of_headers = 'X-Filler: 42' + CRLF;
- lots_of_headers = lots_of_headers.repeat(256);
+ const lots_of_headers = `X-Filler: 42${CRLF}`.repeat(256);
const request = Buffer.from(
'GET /foo/bar/baz?quux=42#1337 HTTP/1.0' + CRLF +
@@ -316,7 +312,7 @@ function expectBody(expected) {
};
const onBody = (buf, start, len) => {
- const body = '' + buf.slice(start, start + len);
+ const body = String(buf.slice(start, start + len));
assert.strictEqual(body, 'foo=42&bar=1337');
};
@@ -357,7 +353,7 @@ function expectBody(expected) {
const body_parts = ['123', '123456', '1234567890'];
const onBody = (buf, start, len) => {
- const body = '' + buf.slice(start, start + len);
+ const body = String(buf.slice(start, start + len));
assert.strictEqual(body, body_parts[body_part++]);
};
@@ -396,7 +392,7 @@ function expectBody(expected) {
['123', '123456', '123456789', '123456789ABC', '123456789ABCDEF'];
const onBody = (buf, start, len) => {
- const body = '' + buf.slice(start, start + len);
+ const body = String(buf.slice(start, start + len));
assert.strictEqual(body, body_parts[body_part++]);
};
@@ -452,7 +448,7 @@ function expectBody(expected) {
let expected_body = '123123456123456789123456789ABC123456789ABCDEF';
const onBody = (buf, start, len) => {
- const chunk = '' + buf.slice(start, start + len);
+ const chunk = String(buf.slice(start, start + len));
assert.strictEqual(expected_body.indexOf(chunk), 0);
expected_body = expected_body.slice(chunk.length);
};
@@ -468,11 +464,9 @@ function expectBody(expected) {
for (let i = 1; i < request.length - 1; ++i) {
const a = request.slice(0, i);
- console.error('request.slice(0, ' + i + ') = ',
- JSON.stringify(a.toString()));
+ console.error(`request.slice(0, ${i}) = ${JSON.stringify(a.toString())}`);
const b = request.slice(i);
- console.error('request.slice(' + i + ') = ',
- JSON.stringify(b.toString()));
+ console.error(`request.slice(${i}) = ${JSON.stringify(b.toString())}`);
test(a, b);
}
}
@@ -514,7 +508,7 @@ function expectBody(expected) {
let expected_body = '123123456123456789123456789ABC123456789ABCDEF';
const onBody = (buf, start, len) => {
- const chunk = '' + buf.slice(start, start + len);
+ const chunk = String(buf.slice(start, start + len));
assert.strictEqual(expected_body.indexOf(chunk), 0);
expected_body = expected_body.slice(chunk.length);
};
@@ -590,9 +584,7 @@ function expectBody(expected) {
// Test parser 'this' safety
// https://github.com/joyent/node/issues/6690
assert.throws(function() {
- const request = Buffer.from(
- 'GET /hello HTTP/1.1' + CRLF +
- CRLF);
+ const request = Buffer.from(`GET /hello HTTP/1.1${CRLF}${CRLF}`);
const parser = newParser(REQUEST);
const notparser = { execute: parser.execute };
diff --git a/test/parallel/test-http-pipe-fs.js b/test/parallel/test-http-pipe-fs.js
index e3c13c5a79..41508ed92d 100644
--- a/test/parallel/test-http-pipe-fs.js
+++ b/test/parallel/test-http-pipe-fs.js
@@ -49,7 +49,7 @@ const server = http.createServer(common.mustCall(function(req, res) {
}
}, function(res) {
res.on('end', function() {
- console.error('res' + i + ' end');
+ console.error(`res${i} end`);
if (i === 2) {
server.close();
}
@@ -57,7 +57,7 @@ const server = http.createServer(common.mustCall(function(req, res) {
res.resume();
});
req.on('socket', function(s) {
- console.error('req' + i + ' start');
+ console.error(`req${i} start`);
});
req.end('12345');
}(i + 1));
diff --git a/test/parallel/test-http-proxy.js b/test/parallel/test-http-proxy.js
index 9808e50696..dfe3218a48 100644
--- a/test/parallel/test-http-proxy.js
+++ b/test/parallel/test-http-proxy.js
@@ -42,13 +42,13 @@ const backend = http.createServer(function(req, res) {
});
const proxy = http.createServer(function(req, res) {
- console.error('proxy req headers: ' + JSON.stringify(req.headers));
+ console.error(`proxy req headers: ${JSON.stringify(req.headers)}`);
http.get({
port: backend.address().port,
path: url.parse(req.url).pathname
}, function(proxy_res) {
- console.error('proxy res headers: ' + JSON.stringify(proxy_res.headers));
+ console.error(`proxy res headers: ${JSON.stringify(proxy_res.headers)}`);
assert.strictEqual('world', proxy_res.headers['hello']);
assert.strictEqual('text/plain', proxy_res.headers['content-type']);
diff --git a/test/parallel/test-http-request-methods.js b/test/parallel/test-http-request-methods.js
index 888206c5ac..9be64e91a7 100644
--- a/test/parallel/test-http-request-methods.js
+++ b/test/parallel/test-http-request-methods.js
@@ -44,7 +44,7 @@ const http = require('http');
c.setEncoding('utf8');
c.on('connect', function() {
- c.write(method + ' / HTTP/1.0\r\n\r\n');
+ c.write(`${method} / HTTP/1.0\r\n\r\n`);
});
c.on('data', function(chunk) {
diff --git a/test/parallel/test-http-response-no-headers.js b/test/parallel/test-http-response-no-headers.js
index bfd74e1749..87b0f8e67f 100644
--- a/test/parallel/test-http-response-no-headers.js
+++ b/test/parallel/test-http-response-no-headers.js
@@ -33,8 +33,7 @@ const expected = {
function test(httpVersion, callback) {
const server = net.createServer(function(conn) {
- const reply = 'HTTP/' + httpVersion + ' 200 OK\r\n\r\n' +
- expected[httpVersion];
+ const reply = `HTTP/${httpVersion} 200 OK\r\n\r\n${expected[httpVersion]}`;
conn.end(reply);
});
diff --git a/test/parallel/test-http-response-status-message.js b/test/parallel/test-http-response-status-message.js
index b618de7559..e52abc57e6 100644
--- a/test/parallel/test-http-response-status-message.js
+++ b/test/parallel/test-http-response-status-message.js
@@ -66,8 +66,8 @@ function runTest(testCaseIndex) {
port: server.address().port,
path: testCase.path
}, function(response) {
- console.log('client: expected status message: ' + testCase.statusMessage);
- console.log('client: actual status message: ' + response.statusMessage);
+ console.log(`client: expected status message: ${testCase.statusMessage}`);
+ console.log(`client: actual status message: ${response.statusMessage}`);
assert.strictEqual(testCase.statusMessage, response.statusMessage);
response.on('end', function() {
diff --git a/test/parallel/test-http-server-multiheaders2.js b/test/parallel/test-http-server-multiheaders2.js
index 6634f46fec..265867abc6 100644
--- a/test/parallel/test-http-server-multiheaders2.js
+++ b/test/parallel/test-http-server-multiheaders2.js
@@ -71,14 +71,13 @@ const multipleForbidden = [
const srv = http.createServer(function(req, res) {
multipleForbidden.forEach(function(header) {
- assert.strictEqual(req.headers[header.toLowerCase()],
- 'foo', 'header parsed incorrectly: ' + header);
+ assert.strictEqual(req.headers[header.toLowerCase()], 'foo',
+ `header parsed incorrectly: ${header}`);
});
multipleAllowed.forEach(function(header) {
const sep = (header.toLowerCase() === 'cookie' ? '; ' : ', ');
- assert.strictEqual(req.headers[header.toLowerCase()],
- 'foo' + sep + 'bar',
- 'header parsed incorrectly: ' + header);
+ assert.strictEqual(req.headers[header.toLowerCase()], `foo${sep}bar`,
+ `header parsed incorrectly: ${header}`);
});
res.writeHead(200, {'Content-Type': 'text/plain'});
diff --git a/test/parallel/test-http-should-keep-alive.js b/test/parallel/test-http-should-keep-alive.js
index 742c1f03bd..9e3f96fd53 100644
--- a/test/parallel/test-http-should-keep-alive.js
+++ b/test/parallel/test-http-should-keep-alive.js
@@ -51,10 +51,10 @@ const server = net.createServer(function(socket) {
}).listen(0, function() {
function makeRequest() {
const req = http.get({port: server.address().port}, function(res) {
- assert.strictEqual(req.shouldKeepAlive, SHOULD_KEEP_ALIVE[responses],
- SERVER_RESPONSES[responses] + ' should ' +
- (SHOULD_KEEP_ALIVE[responses] ? '' : 'not ') +
- 'Keep-Alive');
+ assert.strictEqual(
+ req.shouldKeepAlive, SHOULD_KEEP_ALIVE[responses],
+ `${SERVER_RESPONSES[responses]} should ${
+ SHOULD_KEEP_ALIVE[responses] ? '' : 'not '}Keep-Alive`);
++responses;
if (responses < SHOULD_KEEP_ALIVE.length) {
makeRequest();
diff --git a/test/parallel/test-http-status-code.js b/test/parallel/test-http-status-code.js
index 42001f963f..d48b71eb84 100644
--- a/test/parallel/test-http-status-code.js
+++ b/test/parallel/test-http-status-code.js
@@ -34,7 +34,7 @@ let testIdx = 0;
const s = http.createServer(function(req, res) {
const t = tests[testIdx];
res.writeHead(t, {'Content-Type': 'text/plain'});
- console.log('--\nserver: statusCode after writeHead: ' + res.statusCode);
+ console.log(`--\nserver: statusCode after writeHead: ${res.statusCode}`);
assert.strictEqual(res.statusCode, t);
res.end('hello world\n');
});
@@ -49,8 +49,8 @@ function nextTest() {
const test = tests[testIdx];
http.get({ port: s.address().port }, function(response) {
- console.log('client: expected status: ' + test);
- console.log('client: statusCode: ' + response.statusCode);
+ console.log(`client: expected status: ${test}`);
+ console.log(`client: statusCode: ${response.statusCode}`);
assert.strictEqual(response.statusCode, test);
response.on('end', function() {
testsComplete++;
diff --git a/test/parallel/test-http-upgrade-agent.js b/test/parallel/test-http-upgrade-agent.js
index 3cdecd332a..5c840eeb53 100644
--- a/test/parallel/test-http-upgrade-agent.js
+++ b/test/parallel/test-http-upgrade-agent.js
@@ -56,7 +56,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() {
'upgrade': 'websocket'
}
};
- const name = options.host + ':' + options.port;
+ const name = `${options.host}:${options.port}`;
const req = http.request(options);
req.end();
diff --git a/test/parallel/test-http-url.parse-basic.js b/test/parallel/test-http-url.parse-basic.js
index 3ac138c5cc..0aa7616d05 100644
--- a/test/parallel/test-http-url.parse-basic.js
+++ b/test/parallel/test-http-url.parse-basic.js
@@ -35,7 +35,7 @@ function check(request) {
assert.strictEqual(request.url, '/');
// the host header should use the url.parse.hostname
assert.strictEqual(request.headers.host,
- testURL.hostname + ':' + testURL.port);
+ `${testURL.hostname}:${testURL.port}`);
}
const server = http.createServer(function(request, response) {
diff --git a/test/parallel/test-http-url.parse-https.request.js b/test/parallel/test-http-url.parse-https.request.js
index b5a36553de..5c625cf447 100644
--- a/test/parallel/test-http-url.parse-https.request.js
+++ b/test/parallel/test-http-url.parse-https.request.js
@@ -34,8 +34,8 @@ const fs = require('fs');
// https options
const httpsOptions = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
function check(request) {
diff --git a/test/parallel/test-http-url.parse-post.js b/test/parallel/test-http-url.parse-post.js
index fafcb620fe..dab2e8f97d 100644
--- a/test/parallel/test-http-url.parse-post.js
+++ b/test/parallel/test-http-url.parse-post.js
@@ -34,7 +34,7 @@ function check(request) {
assert.strictEqual(request.url, '/asdf?qwer=zxcv');
//the host header should use the url.parse.hostname
assert.strictEqual(request.headers.host,
- testURL.hostname + ':' + testURL.port);
+ `${testURL.hostname}:${testURL.port}`);
}
const server = http.createServer(function(request, response) {
diff --git a/test/parallel/test-http-write-empty-string.js b/test/parallel/test-http-write-empty-string.js
index 0a89f0cb66..a20602e39d 100644
--- a/test/parallel/test-http-write-empty-string.js
+++ b/test/parallel/test-http-write-empty-string.js
@@ -26,7 +26,7 @@ const assert = require('assert');
const http = require('http');
const server = http.createServer(function(request, response) {
- console.log('responding to ' + request.url);
+ console.log(`responding to ${request.url}`);
response.writeHead(200, {'Content-Type': 'text/plain'});
response.write('1\n');
diff --git a/test/parallel/test-http.js b/test/parallel/test-http.js
index d7a3c1cf47..e9d4950a46 100644
--- a/test/parallel/test-http.js
+++ b/test/parallel/test-http.js
@@ -54,7 +54,7 @@ const server = http.Server(common.mustCall(function(req, res) {
req.on('end', function() {
res.writeHead(200, {'Content-Type': 'text/plain'});
- res.write('The path was ' + url.parse(req.url).pathname);
+ res.write(`The path was ${url.parse(req.url).pathname}`);
res.end();
});
req.resume();
diff --git a/test/parallel/test-https-agent-create-connection.js b/test/parallel/test-https-agent-create-connection.js
index 7bb79567cb..a1f0c4ace4 100644
--- a/test/parallel/test-https-agent-create-connection.js
+++ b/test/parallel/test-https-agent-create-connection.js
@@ -14,8 +14,8 @@ const agent = new https.Agent();
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
};
const expectedHeader = /^HTTP\/1\.1 200 OK/;
diff --git a/test/parallel/test-https-agent-disable-session-reuse.js b/test/parallel/test-https-agent-disable-session-reuse.js
index 7cca9c713a..0331cd4e28 100644
--- a/test/parallel/test-https-agent-disable-session-reuse.js
+++ b/test/parallel/test-https-agent-disable-session-reuse.js
@@ -14,8 +14,8 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const clientSessions = [];
diff --git a/test/parallel/test-https-agent-secure-protocol.js b/test/parallel/test-https-agent-secure-protocol.js
index 7cca682101..c11d9f8ca8 100644
--- a/test/parallel/test-https-agent-secure-protocol.js
+++ b/test/parallel/test-https-agent-secure-protocol.js
@@ -11,9 +11,9 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
- ca: fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
+ ca: fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`)
};
const server = https.Server(options, function(req, res) {
diff --git a/test/parallel/test-https-agent-servername.js b/test/parallel/test-https-agent-servername.js
index a321f71403..8562d021c9 100644
--- a/test/parallel/test-https-agent-servername.js
+++ b/test/parallel/test-https-agent-servername.js
@@ -10,9 +10,9 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
- ca: fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
+ ca: fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`)
};
diff --git a/test/parallel/test-https-agent-session-eviction.js b/test/parallel/test-https-agent-session-eviction.js
index d27b968a4d..acead806ed 100644
--- a/test/parallel/test-https-agent-session-eviction.js
+++ b/test/parallel/test-https-agent-session-eviction.js
@@ -13,8 +13,8 @@ const fs = require('fs');
const SSL_OP_NO_TICKET = require('crypto').constants.SSL_OP_NO_TICKET;
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
secureOptions: SSL_OP_NO_TICKET
};
diff --git a/test/parallel/test-https-agent-session-reuse.js b/test/parallel/test-https-agent-session-reuse.js
index 3f06d1699f..a9977d8ce9 100644
--- a/test/parallel/test-https-agent-session-reuse.js
+++ b/test/parallel/test-https-agent-session-reuse.js
@@ -13,11 +13,11 @@ const crypto = require('crypto');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
-const ca = fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem');
+const ca = fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`);
const clientSessions = {};
let serverRequests = 0;
diff --git a/test/parallel/test-https-agent-sni.js b/test/parallel/test-https-agent-sni.js
index 9bfbe3d5c6..fb7bee16ec 100644
--- a/test/parallel/test-https-agent-sni.js
+++ b/test/parallel/test-https-agent-sni.js
@@ -11,8 +11,8 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const TOTAL = 4;
@@ -31,7 +31,7 @@ server.listen(0, function() {
function expectResponse(id) {
return common.mustCall(function(res) {
res.resume();
- assert.strictEqual(res.headers['x-sni'], 'sni.' + id);
+ assert.strictEqual(res.headers['x-sni'], `sni.${id}`);
});
}
@@ -45,7 +45,7 @@ server.listen(0, function() {
path: '/',
port: this.address().port,
host: '127.0.0.1',
- servername: 'sni.' + j,
+ servername: `sni.${j}`,
rejectUnauthorized: false
}, expectResponse(j));
}
diff --git a/test/parallel/test-https-agent-sockets-leak.js b/test/parallel/test-https-agent-sockets-leak.js
index 27b37dc4fe..bc86b9c241 100644
--- a/test/parallel/test-https-agent-sockets-leak.js
+++ b/test/parallel/test-https-agent-sockets-leak.js
@@ -11,9 +11,9 @@ const https = require('https');
const assert = require('assert');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
- ca: fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
+ ca: fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`)
};
const server = https.Server(options, common.mustCall((req, res) => {
diff --git a/test/parallel/test-https-agent.js b/test/parallel/test-https-agent.js
index a828c4b37e..add9913358 100644
--- a/test/parallel/test-https-agent.js
+++ b/test/parallel/test-https-agent.js
@@ -32,8 +32,8 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
diff --git a/test/parallel/test-https-byteswritten.js b/test/parallel/test-https-byteswritten.js
index 59b57d1293..cad824c5fe 100644
--- a/test/parallel/test-https-byteswritten.js
+++ b/test/parallel/test-https-byteswritten.js
@@ -31,8 +31,8 @@ if (!common.hasCrypto) {
const https = require('https');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const body = 'hello world\n';
diff --git a/test/parallel/test-https-client-get-url.js b/test/parallel/test-https-client-get-url.js
index cd22adf6a8..482eedec29 100644
--- a/test/parallel/test-https-client-get-url.js
+++ b/test/parallel/test-https-client-get-url.js
@@ -37,8 +37,8 @@ const url = require('url');
const URL = url.URL;
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = https.createServer(options, common.mustCall(function(req, res) {
diff --git a/test/parallel/test-https-client-resume.js b/test/parallel/test-https-client-resume.js
index 077a8e3f6d..95e1da56d0 100644
--- a/test/parallel/test-https-client-resume.js
+++ b/test/parallel/test-https-client-resume.js
@@ -36,8 +36,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
// create server
diff --git a/test/parallel/test-https-close.js b/test/parallel/test-https-close.js
index 38cd1819c6..e32e253147 100644
--- a/test/parallel/test-https-close.js
+++ b/test/parallel/test-https-close.js
@@ -9,8 +9,8 @@ if (!common.hasCrypto) {
const https = require('https');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const connections = {};
@@ -23,7 +23,7 @@ const server = https.createServer(options, function(req, res) {
});
server.on('connection', function(connection) {
- const key = connection.remoteAddress + ':' + connection.remotePort;
+ const key = `${connection.remoteAddress}:${connection.remotePort}`;
connection.on('close', function() {
delete connections[key];
});
diff --git a/test/parallel/test-https-drain.js b/test/parallel/test-https-drain.js
index e83ec3ebb5..ed0a11ae83 100644
--- a/test/parallel/test-https-drain.js
+++ b/test/parallel/test-https-drain.js
@@ -64,7 +64,7 @@ server.listen(0, function() {
return process.nextTick(send);
}
sent += bufSize;
- console.error('sent: ' + sent);
+ console.error(`sent: ${sent}`);
resumed = true;
res.resume();
console.error('resumed');
@@ -81,7 +81,7 @@ server.listen(0, function() {
}
received += data.length;
if (received >= sent) {
- console.error('received: ' + received);
+ console.error(`received: ${received}`);
req.end();
server.close();
}
diff --git a/test/parallel/test-https-eof-for-eom.js b/test/parallel/test-https-eof-for-eom.js
index 42090ea6f8..3300dabb54 100644
--- a/test/parallel/test-https-eof-for-eom.js
+++ b/test/parallel/test-https-eof-for-eom.js
@@ -41,8 +41,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
diff --git a/test/parallel/test-https-foafssl.js b/test/parallel/test-https-foafssl.js
index 661b196152..9900cf7a64 100644
--- a/test/parallel/test-https-foafssl.js
+++ b/test/parallel/test-https-foafssl.js
@@ -40,8 +40,8 @@ if (!common.hasCrypto) {
const https = require('https');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/agent.key'),
- cert: fs.readFileSync(common.fixturesDir + '/agent.crt'),
+ key: fs.readFileSync(`${common.fixturesDir}/agent.key`),
+ cert: fs.readFileSync(`${common.fixturesDir}/agent.crt`),
requestCert: true,
rejectUnauthorized: false
};
diff --git a/test/parallel/test-https-host-headers.js b/test/parallel/test-https-host-headers.js
index ce18522fc5..adb8952871 100644
--- a/test/parallel/test-https-host-headers.js
+++ b/test/parallel/test-https-host-headers.js
@@ -10,19 +10,19 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const httpsServer = https.createServer(options, reqHandler);
function reqHandler(req, res) {
- console.log('Got request: ' + req.headers.host + ' ' + req.url);
+ console.log(`Got request: ${req.headers.host} ${req.url}`);
if (req.url === '/setHostFalse5') {
assert.strictEqual(req.headers.host, undefined);
} else {
- assert.strictEqual(req.headers.host, `localhost:${this.address().port}`,
- 'Wrong host header for req[' + req.url + ']: ' +
- req.headers.host);
+ assert.strictEqual(
+ req.headers.host, `localhost:${this.address().port}`,
+ `Wrong host header for req[${req.url}]: ${req.headers.host}`);
}
res.writeHead(200, {});
//process.nextTick(function() { res.end('ok'); });
@@ -41,7 +41,7 @@ function testHttps() {
function cb(res) {
counter--;
- console.log('back from https request. counter = ' + counter);
+ console.log(`back from https request. counter = ${counter}`);
if (counter === 0) {
httpsServer.close();
console.log('ok');
@@ -54,7 +54,7 @@ function testHttps() {
assert.ifError(er);
https.get({
method: 'GET',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
//agent: false,
port: this.address().port,
@@ -63,7 +63,7 @@ function testHttps() {
https.request({
method: 'GET',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
//agent: false,
port: this.address().port,
@@ -72,7 +72,7 @@ function testHttps() {
https.request({
method: 'POST',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
//agent: false,
port: this.address().port,
@@ -81,7 +81,7 @@ function testHttps() {
https.request({
method: 'PUT',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
//agent: false,
port: this.address().port,
@@ -90,7 +90,7 @@ function testHttps() {
https.request({
method: 'DELETE',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
//agent: false,
port: this.address().port,
@@ -99,7 +99,7 @@ function testHttps() {
https.get({
method: 'GET',
- path: '/setHostFalse' + (counter++),
+ path: `/setHostFalse${counter++}`,
host: 'localhost',
setHost: false,
port: this.address().port,
diff --git a/test/parallel/test-https-localaddress-bind-error.js b/test/parallel/test-https-localaddress-bind-error.js
index caf6be85ec..0b046cfa85 100644
--- a/test/parallel/test-https-localaddress-bind-error.js
+++ b/test/parallel/test-https-localaddress-bind-error.js
@@ -31,18 +31,18 @@ if (!common.hasCrypto) {
const https = require('https');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const invalidLocalAddress = '1.2.3.4';
const server = https.createServer(options, function(req, res) {
- console.log('Connect from: ' + req.connection.remoteAddress);
+ console.log(`Connect from: ${req.connection.remoteAddress}`);
req.on('end', function() {
res.writeHead(200, { 'Content-Type': 'text/plain' });
- res.end('You are from: ' + req.connection.remoteAddress);
+ res.end(`You are from: ${req.connection.remoteAddress}`);
});
req.resume();
});
@@ -57,7 +57,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() {
}, function(res) {
assert.fail('unexpectedly got response from server');
}).on('error', common.mustCall(function(e) {
- console.log('client got error: ' + e.message);
+ console.log(`client got error: ${e.message}`);
server.close();
})).end();
}));
diff --git a/test/parallel/test-https-localaddress.js b/test/parallel/test-https-localaddress.js
index f6f0f5d500..bcd1d6fdbd 100644
--- a/test/parallel/test-https-localaddress.js
+++ b/test/parallel/test-https-localaddress.js
@@ -36,17 +36,17 @@ if (!common.hasMultiLocalhost()) {
}
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = https.createServer(options, function(req, res) {
- console.log('Connect from: ' + req.connection.remoteAddress);
+ console.log(`Connect from: ${req.connection.remoteAddress}`);
assert.strictEqual('127.0.0.2', req.connection.remoteAddress);
req.on('end', function() {
res.writeHead(200, { 'Content-Type': 'text/plain' });
- res.end('You are from: ' + req.connection.remoteAddress);
+ res.end(`You are from: ${req.connection.remoteAddress}`);
});
req.resume();
});
diff --git a/test/parallel/test-https-pfx.js b/test/parallel/test-https-pfx.js
index 47d7b893ba..9d7a1d888c 100644
--- a/test/parallel/test-https-pfx.js
+++ b/test/parallel/test-https-pfx.js
@@ -30,7 +30,7 @@ if (!common.hasCrypto) {
}
const https = require('https');
-const pfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx');
+const pfx = fs.readFileSync(`${common.fixturesDir}/test_cert.pfx`);
const options = {
host: '127.0.0.1',
diff --git a/test/parallel/test-https-req-split.js b/test/parallel/test-https-req-split.js
index 97730ebcb8..0abd74be61 100644
--- a/test/parallel/test-https-req-split.js
+++ b/test/parallel/test-https-req-split.js
@@ -34,8 +34,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
// Force splitting incoming data
@@ -44,7 +44,7 @@ tls.SLAB_BUFFER_SIZE = 1;
const server = https.createServer(options);
server.on('upgrade', common.mustCall(function(req, socket, upgrade) {
socket.on('data', function(data) {
- throw new Error('Unexpected data: ' + data);
+ throw new Error(`Unexpected data: ${data}`);
});
socket.end('HTTP/1.1 200 Ok\r\n\r\n');
}));
diff --git a/test/parallel/test-https-resume-after-renew.js b/test/parallel/test-https-resume-after-renew.js
index cc712b3124..c9e208ab97 100644
--- a/test/parallel/test-https-resume-after-renew.js
+++ b/test/parallel/test-https-resume-after-renew.js
@@ -10,9 +10,9 @@ const https = require('https');
const crypto = require('crypto');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
- ca: fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
+ ca: fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`)
};
const server = https.createServer(options, function(req, res) {
diff --git a/test/parallel/test-https-simple.js b/test/parallel/test-https-simple.js
index d20f6bb205..9f3482260e 100644
--- a/test/parallel/test-https-simple.js
+++ b/test/parallel/test-https-simple.js
@@ -32,8 +32,8 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const tests = 2;
diff --git a/test/parallel/test-https-socket-options.js b/test/parallel/test-https-socket-options.js
index 6433d8f4c7..3718d3809c 100644
--- a/test/parallel/test-https-socket-options.js
+++ b/test/parallel/test-https-socket-options.js
@@ -33,8 +33,8 @@ const fs = require('fs');
const http = require('http');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const body = 'hello world\n';
diff --git a/test/parallel/test-https-strict.js b/test/parallel/test-https-strict.js
index 01fad2f594..f28164a322 100644
--- a/test/parallel/test-https-strict.js
+++ b/test/parallel/test-https-strict.js
@@ -149,7 +149,7 @@ function makeReq(path, port, error, host, ca) {
port === server2.address().port ? server2 :
port === server3.address().port ? server3 :
null;
- if (!server) throw new Error('invalid port: ' + port);
+ if (!server) throw new Error(`invalid port: ${port}`);
server.expectCount++;
req.on('response', common.mustCall((res) => {
diff --git a/test/parallel/test-https-timeout-server-2.js b/test/parallel/test-https-timeout-server-2.js
index d31f6ba4c1..08144f108b 100644
--- a/test/parallel/test-https-timeout-server-2.js
+++ b/test/parallel/test-https-timeout-server-2.js
@@ -34,8 +34,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = https.createServer(options, common.mustNotCall());
diff --git a/test/parallel/test-https-timeout-server.js b/test/parallel/test-https-timeout-server.js
index 07e86f350b..7d33e55211 100644
--- a/test/parallel/test-https-timeout-server.js
+++ b/test/parallel/test-https-timeout-server.js
@@ -33,8 +33,8 @@ const net = require('net');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
handshakeTimeout: 50
};
diff --git a/test/parallel/test-https-timeout.js b/test/parallel/test-https-timeout.js
index 75e012a544..e75a8566e4 100644
--- a/test/parallel/test-https-timeout.js
+++ b/test/parallel/test-https-timeout.js
@@ -31,8 +31,8 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
// a server that never replies
diff --git a/test/parallel/test-https-truncate.js b/test/parallel/test-https-truncate.js
index c5a550dc5e..d15efc9abc 100644
--- a/test/parallel/test-https-truncate.js
+++ b/test/parallel/test-https-truncate.js
@@ -32,8 +32,8 @@ const https = require('https');
const fs = require('fs');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`);
// number of bytes discovered empirically to trigger the bug
const data = Buffer.alloc(1024 * 32 + 1);
diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js
index d10c76283c..1eb0521fb0 100644
--- a/test/parallel/test-intl.js
+++ b/test/parallel/test-intl.js
@@ -49,16 +49,14 @@ assert.strictEqual('ç'.toUpperCase(), 'Ç');
if (!common.hasIntl) {
const erMsg =
- '"Intl" object is NOT present but v8_enable_i18n_support is ' +
- enablei18n;
+ `"Intl" object is NOT present but v8_enable_i18n_support is ${enablei18n}`;
assert.strictEqual(enablei18n, 0, erMsg);
common.skip('Intl tests because Intl object not present.');
} else {
const erMsg =
- '"Intl" object is present but v8_enable_i18n_support is ' +
- enablei18n +
- '. Is this test out of date?';
+ `"Intl" object is present but v8_enable_i18n_support is ${
+ enablei18n}. Is this test out of date?`;
assert.strictEqual(enablei18n, 1, erMsg);
// Construct a new date at the beginning of Unix time
@@ -77,7 +75,7 @@ if (!common.hasIntl) {
common.skip('detailed Intl tests because English is not ' +
'listed as supported.');
// Smoke test. Does it format anything, or fail?
- console.log('Date(0) formatted to: ' + dtf.format(date0));
+ console.log(`Date(0) formatted to: ${dtf.format(date0)}`);
return;
}
diff --git a/test/parallel/test-module-globalpaths-nodepath.js b/test/parallel/test-module-globalpaths-nodepath.js
index f0366aedab..dce5bf12c1 100644
--- a/test/parallel/test-module-globalpaths-nodepath.js
+++ b/test/parallel/test-module-globalpaths-nodepath.js
@@ -30,11 +30,11 @@ const partC = '';
if (common.isWindows) {
partA = 'C:\\Users\\Rocko Artischocko\\AppData\\Roaming\\npm';
partB = 'C:\\Program Files (x86)\\nodejs\\';
- process.env['NODE_PATH'] = partA + ';' + partB + ';' + partC;
+ process.env['NODE_PATH'] = `${partA};${partB};${partC}`;
} else {
partA = '/usr/test/lib/node_modules';
partB = '/usr/test/lib/node';
- process.env['NODE_PATH'] = partA + ':' + partB + ':' + partC;
+ process.env['NODE_PATH'] = `${partA}:${partB}:${partC}`;
}
mod._initPaths();
diff --git a/test/parallel/test-module-loading-globalpaths.js b/test/parallel/test-module-loading-globalpaths.js
index d789f54099..418e5ac475 100644
--- a/test/parallel/test-module-loading-globalpaths.js
+++ b/test/parallel/test-module-loading-globalpaths.js
@@ -51,7 +51,7 @@ if (process.argv[2] === 'child') {
child_process.execFileSync(testExecPath, [ __filename, 'child' ],
{ encoding: 'utf8', env: env });
},
- new RegExp('Cannot find module \'' + pkgName + '\''));
+ new RegExp(`Cannot find module '${pkgName}'`));
// Test module in $HOME/.node_modules.
const modHomeDir = path.join(testFixturesDir, 'home-pkg-in-node_modules');
@@ -75,8 +75,8 @@ if (process.argv[2] === 'child') {
fs.mkdirSync(prefixLibPath);
const prefixLibNodePath = path.join(prefixLibPath, 'node');
fs.mkdirSync(prefixLibNodePath);
- const pkgPath = path.join(prefixLibNodePath, pkgName + '.js');
- fs.writeFileSync(pkgPath, 'exports.string = \'' + expectedString + '\';');
+ const pkgPath = path.join(prefixLibNodePath, `${pkgName}.js`);
+ fs.writeFileSync(pkgPath, `exports.string = '${expectedString}';`);
env['HOME'] = env['USERPROFILE'] = noPkgHomeDir;
runTest(expectedString, env);
diff --git a/test/parallel/test-module-nodemodulepaths.js b/test/parallel/test-module-nodemodulepaths.js
index f6e69af124..c79d2e6e72 100644
--- a/test/parallel/test-module-nodemodulepaths.js
+++ b/test/parallel/test-module-nodemodulepaths.js
@@ -121,6 +121,7 @@ node-gyp/node_modules/glob/node_modules',
const platformCases = common.isWindows ? cases.WIN : cases.POSIX;
platformCases.forEach((c) => {
const paths = _module._nodeModulePaths(c.file);
- assert.deepStrictEqual(c.expect, paths, 'case ' + c.file +
- ' failed, actual paths is ' + JSON.stringify(paths));
+ assert.deepStrictEqual(
+ c.expect, paths,
+ `case ${c.file} failed, actual paths is ${JSON.stringify(paths)}`);
});
diff --git a/test/parallel/test-module-require-depth.js b/test/parallel/test-module-require-depth.js
index 4d2ddac151..12a963e9b6 100644
--- a/test/parallel/test-module-require-depth.js
+++ b/test/parallel/test-module-require-depth.js
@@ -6,8 +6,8 @@ const internalModule = require('internal/module');
// Module one loads two too so the expected depth for two is, well, two.
assert.strictEqual(internalModule.requireDepth, 0);
-const one = require(common.fixturesDir + '/module-require-depth/one');
-const two = require(common.fixturesDir + '/module-require-depth/two');
+const one = require(`${common.fixturesDir}/module-require-depth/one`);
+const two = require(`${common.fixturesDir}/module-require-depth/two`);
assert.deepStrictEqual(one, { requireDepth: 1 });
assert.deepStrictEqual(two, { requireDepth: 2 });
assert.strictEqual(internalModule.requireDepth, 0);
diff --git a/test/parallel/test-net-better-error-messages-path.js b/test/parallel/test-net-better-error-messages-path.js
index 692e5c4cfe..f4d00c7aeb 100644
--- a/test/parallel/test-net-better-error-messages-path.js
+++ b/test/parallel/test-net-better-error-messages-path.js
@@ -9,5 +9,5 @@ c.on('connect', common.mustNotCall());
c.on('error', common.mustCall(function(e) {
assert.strictEqual(e.code, 'ENOENT');
- assert.strictEqual(e.message, 'connect ENOENT ' + fp);
+ assert.strictEqual(e.message, `connect ENOENT ${fp}`);
}));
diff --git a/test/parallel/test-net-bytes-stats.js b/test/parallel/test-net-bytes-stats.js
index 2cda173e98..40fa13d415 100644
--- a/test/parallel/test-net-bytes-stats.js
+++ b/test/parallel/test-net-bytes-stats.js
@@ -36,7 +36,7 @@ const tcp = net.Server(function(s) {
s.on('end', function() {
bytesRead += s.bytesRead;
- console.log('tcp socket disconnect #' + count);
+ console.log(`tcp socket disconnect #${count}`);
});
});
@@ -61,8 +61,8 @@ tcp.listen(0, function doTest() {
socket.on('close', function() {
console.error('CLIENT close event #%d', count);
- console.log('Bytes read: ' + bytesRead);
- console.log('Bytes written: ' + bytesWritten);
+ console.log(`Bytes read: ${bytesRead}`);
+ console.log(`Bytes written: ${bytesWritten}`);
if (count < 2) {
console.error('RECONNECTING');
socket.connect(tcp.address().port);
diff --git a/test/parallel/test-net-connect-buffer.js b/test/parallel/test-net-connect-buffer.js
index a391dfde74..828ce31780 100644
--- a/test/parallel/test-net-connect-buffer.js
+++ b/test/parallel/test-net-connect-buffer.js
@@ -45,7 +45,7 @@ const tcp = net.Server(function(s) {
});
s.on('error', function(e) {
- console.log('tcp server-side error: ' + e.message);
+ console.log(`tcp server-side error: ${e.message}`);
process.exit(1);
});
});
@@ -60,7 +60,7 @@ tcp.listen(0, function() {
connectHappened = true;
});
- console.log('connecting = ' + socket.connecting);
+ console.log(`connecting = ${socket.connecting}`);
assert.strictEqual('opening', socket.readyState);
diff --git a/test/parallel/test-net-connect-options-allowhalfopen.js b/test/parallel/test-net-connect-options-allowhalfopen.js
index 4bf6b9094b..4a0cc18772 100644
--- a/test/parallel/test-net-connect-options-allowhalfopen.js
+++ b/test/parallel/test-net-connect-options-allowhalfopen.js
@@ -105,7 +105,7 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS);
console.error(`No. ${index} client received FIN`);
assert(!client.readable);
assert(client.writable);
- assert(client.write(index + ''));
+ assert(client.write(String(index)));
client.end();
clientSentFIN++;
console.error(`No. ${index} client sent FIN, ` +
diff --git a/test/parallel/test-net-connect-options-fd.js b/test/parallel/test-net-connect-options-fd.js
index 9cc581243f..9e3859f843 100644
--- a/test/parallel/test-net-connect-options-fd.js
+++ b/test/parallel/test-net-connect-options-fd.js
@@ -69,13 +69,13 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS);
})
.on('error', function(err) {
console.error(err);
- assert.fail(null, null, '[Pipe server]' + err);
+ assert.fail(null, null, `[Pipe server]${err}`);
})
.listen({path: serverPath}, common.mustCall(function serverOnListen() {
const getSocketOpt = (index) => {
const handle = new Pipe();
const err = handle.bind(`${prefix}-client-${socketCounter++}`);
- assert(err >= 0, '' + err);
+ assert(err >= 0, String(err));
assert.notStrictEqual(handle.fd, -1);
handleMap.set(index, handle);
console.error(`[Pipe]Bound handle with Pipe ${handle.fd}`);
@@ -90,11 +90,11 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS);
assert(handleMap.has(index));
const oldHandle = handleMap.get(index);
assert.strictEqual(oldHandle.fd, this._handle.fd);
- client.write(oldHandle.fd + '');
+ client.write(String(oldHandle.fd));
console.error(`[Pipe]Sending data through fd ${oldHandle.fd}`);
client.on('error', function(err) {
console.error(err);
- assert.fail(null, null, '[Pipe Client]' + err);
+ assert.fail(null, null, `[Pipe Client]${err}`);
});
});
diff --git a/test/parallel/test-net-connect-options-port.js b/test/parallel/test-net-connect-options-port.js
index 73a719c7bd..b3c370c8d9 100644
--- a/test/parallel/test-net-connect-options-port.js
+++ b/test/parallel/test-net-connect-options-port.js
@@ -88,8 +88,8 @@ const net = require('net');
// Total connections = 3 * 4(canConnect) * 6(doConnect) = 72
canConnect(port);
- canConnect(port + '');
- canConnect('0x' + port.toString(16));
+ canConnect(String(port));
+ canConnect(`0x${port.toString(16)}`);
}));
// Try connecting to random ports, but do so once the server is closed
@@ -191,7 +191,7 @@ function canConnect(port) {
function asyncFailToConnect(port) {
const onError = () => common.mustCall(function(err) {
const regexp = /^Error: connect (E\w+)(.+)$/;
- assert(regexp.test(err + ''), err + '');
+ assert(regexp.test(String(err)), String(err));
});
const dont = () => common.mustNotCall();
diff --git a/test/parallel/test-net-internal.js b/test/parallel/test-net-internal.js
index a79d022a5d..309b56d4d9 100644
--- a/test/parallel/test-net-internal.js
+++ b/test/parallel/test-net-internal.js
@@ -8,7 +8,7 @@ const isLegalPort = require('internal/net').isLegalPort;
for (let n = 0; n <= 0xFFFF; n++) {
assert(isLegalPort(n));
- assert(isLegalPort('' + n));
+ assert(isLegalPort(String(n)));
assert(`0x${n.toString(16)}`);
assert(`0o${n.toString(8)}`);
assert(`0b${n.toString(2)}`);
diff --git a/test/parallel/test-net-listen-shared-ports.js b/test/parallel/test-net-listen-shared-ports.js
index 7b075511a4..c16285278a 100644
--- a/test/parallel/test-net-listen-shared-ports.js
+++ b/test/parallel/test-net-listen-shared-ports.js
@@ -44,12 +44,12 @@ if (cluster.isMaster) {
server1.on('error', function(err) {
// no errors expected
- process.send('server1:' + err.code);
+ process.send(`server1:${err.code}`);
});
server2.on('error', function(err) {
// an error is expected on the second worker
- process.send('server2:' + err.code);
+ process.send(`server2:${err.code}`);
});
server1.listen({
diff --git a/test/parallel/test-net-pipe-connect-errors.js b/test/parallel/test-net-pipe-connect-errors.js
index be0827e3f8..5ad77b7209 100644
--- a/test/parallel/test-net-pipe-connect-errors.js
+++ b/test/parallel/test-net-pipe-connect-errors.js
@@ -41,7 +41,7 @@ if (common.isWindows) {
// on CI for a POSIX socket. Even though this isn't actually a socket file,
// the error will be different from the one we are expecting if we exceed the
// limit.
- emptyTxt = common.tmpDir + '0.txt';
+ emptyTxt = `${common.tmpDir}0.txt`;
function cleanup() {
try {
diff --git a/test/parallel/test-net-reconnect-error.js b/test/parallel/test-net-reconnect-error.js
index 166d177365..d9a68e01d0 100644
--- a/test/parallel/test-net-reconnect-error.js
+++ b/test/parallel/test-net-reconnect-error.js
@@ -33,7 +33,7 @@ const c = net.createConnection(common.PORT);
c.on('connect', common.mustNotCall('client should not have connected'));
c.on('error', function(e) {
- console.error('CLIENT error: ' + e.code);
+ console.error(`CLIENT error: ${e.code}`);
client_error_count++;
assert.strictEqual('ECONNREFUSED', e.code);
});
diff --git a/test/parallel/test-net-reconnect.js b/test/parallel/test-net-reconnect.js
index 5b66c45e20..c8b1503cea 100644
--- a/test/parallel/test-net-reconnect.js
+++ b/test/parallel/test-net-reconnect.js
@@ -43,7 +43,7 @@ const server = net.createServer(function(socket) {
});
socket.on('close', function(had_error) {
- console.log('SERVER had_error: ' + JSON.stringify(had_error));
+ console.log(`SERVER had_error: ${JSON.stringify(had_error)}`);
assert.strictEqual(false, had_error);
});
});
@@ -60,7 +60,7 @@ server.listen(0, function() {
client.on('data', function(chunk) {
client_recv_count += 1;
- console.log('client_recv_count ' + client_recv_count);
+ console.log(`client_recv_count ${client_recv_count}`);
assert.strictEqual('hello\r\n', chunk);
console.error('CLIENT: calling end', client._writableState);
client.end();
diff --git a/test/parallel/test-net-server-bind.js b/test/parallel/test-net-server-bind.js
index 3617ff3e95..d276442006 100644
--- a/test/parallel/test-net-server-bind.js
+++ b/test/parallel/test-net-server-bind.js
@@ -75,9 +75,9 @@ process.on('exit', function() {
let expectedConnectionKey1;
if (address1.family === 'IPv6')
- expectedConnectionKey1 = '6::::' + address1.port;
+ expectedConnectionKey1 = `6::::${address1.port}`;
else
- expectedConnectionKey1 = '4:0.0.0.0:' + address1.port;
+ expectedConnectionKey1 = `4:0.0.0.0:${address1.port}`;
assert.strictEqual(connectionKey1, expectedConnectionKey1);
assert.strictEqual(common.PORT + 1, address2.port);
diff --git a/test/parallel/test-net-server-listen-handle.js b/test/parallel/test-net-server-listen-handle.js
index 8d25d88577..09398bd0e3 100644
--- a/test/parallel/test-net-server-listen-handle.js
+++ b/test/parallel/test-net-server-listen-handle.js
@@ -30,7 +30,7 @@ let counter = 0;
// Avoid conflict with listen-path
function randomPipePath() {
- return common.PIPE + '-listen-handle-' + (counter++);
+ return `${common.PIPE}-listen-handle-${counter++}`;
}
function randomHandle(type) {
@@ -146,7 +146,7 @@ if (!common.isWindows) { // Windows doesn't support {fd: <n>}
net.createServer()
.listen({fd: fd}, common.mustNotCall())
.on('error', common.mustCall(function(err) {
- assert.strictEqual(err + '', 'Error: listen EINVAL');
+ assert.strictEqual(String(err), 'Error: listen EINVAL');
this.close();
}));
}
diff --git a/test/parallel/test-net-server-listen-path.js b/test/parallel/test-net-server-listen-path.js
index f9cc982a42..2dbd588baf 100644
--- a/test/parallel/test-net-server-listen-path.js
+++ b/test/parallel/test-net-server-listen-path.js
@@ -15,7 +15,7 @@ let counter = 0;
// Avoid conflict with listen-handle
function randomPipePath() {
- return common.PIPE + '-listen-path-' + (counter++);
+ return `${common.PIPE}-listen-path-${counter++}`;
}
// Test listen(path)
diff --git a/test/parallel/test-net-server-max-connections-close-makes-more-available.js b/test/parallel/test-net-server-max-connections-close-makes-more-available.js
index 9fd34a6f45..12f1f81ffd 100644
--- a/test/parallel/test-net-server-max-connections-close-makes-more-available.js
+++ b/test/parallel/test-net-server-max-connections-close-makes-more-available.js
@@ -18,12 +18,12 @@ const received = [];
const sent = [];
function createConnection(index) {
- console.error('creating connection ' + index);
+ console.error(`creating connection ${index}`);
return new Promise(function(resolve, reject) {
const connection = net.createConnection(server.address().port, function() {
- const msg = '' + index;
- console.error('sending message: ' + msg);
+ const msg = String(index);
+ console.error(`sending message: ${msg}`);
this.write(msg);
sent.push(msg);
});
@@ -34,12 +34,12 @@ function createConnection(index) {
});
connection.on('data', function(e) {
- console.error('connection ' + index + ' received response');
+ console.error(`connection ${index} received response`);
resolve();
});
connection.on('end', function() {
- console.error('ending ' + index);
+ console.error(`ending ${index}`);
resolve();
});
@@ -48,7 +48,7 @@ function createConnection(index) {
}
function closeConnection(index) {
- console.error('closing connection ' + index);
+ console.error(`closing connection ${index}`);
return new Promise(function(resolve, reject) {
connections[index].on('end', function() {
resolve();
@@ -59,8 +59,8 @@ function closeConnection(index) {
const server = net.createServer(function(socket) {
socket.on('data', function(data) {
- console.error('received message: ' + data);
- received.push('' + data);
+ console.error(`received message: ${data}`);
+ received.push(String(data));
socket.write('acknowledged');
});
});
diff --git a/test/parallel/test-next-tick-ordering.js b/test/parallel/test-next-tick-ordering.js
index cd784cf8c0..76f43efa93 100644
--- a/test/parallel/test-next-tick-ordering.js
+++ b/test/parallel/test-next-tick-ordering.js
@@ -29,7 +29,7 @@ const done = [];
function get_printer(timeout) {
return function() {
- console.log('Running from setTimeout ' + timeout);
+ console.log(`Running from setTimeout ${timeout}`);
done.push(timeout);
};
}
diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js
index 5195dbc3ef..75e2c92d5a 100644
--- a/test/parallel/test-npm-install.js
+++ b/test/parallel/test-npm-install.js
@@ -33,7 +33,7 @@ const args = [
const pkgContent = JSON.stringify({
dependencies: {
- 'package-name': common.fixturesDir + '/packages/main'
+ 'package-name': `${common.fixturesDir}/packages/main`
}
});
@@ -56,7 +56,7 @@ function handleExit(code, signalCode) {
assert.strictEqual(code, 0, `npm install got error code ${code}`);
assert.strictEqual(signalCode, null, `unexpected signal: ${signalCode}`);
assert.doesNotThrow(function() {
- fs.accessSync(installDir + '/node_modules/package-name');
+ fs.accessSync(`${installDir}/node_modules/package-name`);
});
}
diff --git a/test/parallel/test-openssl-ca-options.js b/test/parallel/test-openssl-ca-options.js
index f27976fab7..144a7dfe3d 100644
--- a/test/parallel/test-openssl-ca-options.js
+++ b/test/parallel/test-openssl-ca-options.js
@@ -15,9 +15,9 @@ const result = childProcess.spawnSync(process.execPath, [
'-p', 'process.version'],
{encoding: 'utf8'});
-assert.strictEqual(result.stderr,
- process.execPath + ': either --use-openssl-ca or ' +
- '--use-bundled-ca can be used, not both' + os.EOL);
+assert.strictEqual(result.stderr, `${process.execPath
+ }: either --use-openssl-ca or --use-bundled-ca can be used, not both${os.EOL}`
+);
assert.strictEqual(result.status, 9);
const useBundledCA = childProcess.spawnSync(process.execPath, [
diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js
index 6092c411a8..a62c8b8512 100644
--- a/test/parallel/test-os.js
+++ b/test/parallel/test-os.js
@@ -43,7 +43,7 @@ if (common.isWindows) {
process.env.TEMP = '';
assert.strictEqual(os.tmpdir(), '/tmp');
process.env.TMP = '';
- const expected = (process.env.SystemRoot || process.env.windir) + '\\temp';
+ const expected = `${process.env.SystemRoot || process.env.windir}\\temp`;
assert.strictEqual(os.tmpdir(), expected);
process.env.TEMP = '\\temp\\';
assert.strictEqual(os.tmpdir(), '\\temp');
diff --git a/test/parallel/test-path-makelong.js b/test/parallel/test-path-makelong.js
index 3b89028af5..5f3863702b 100644
--- a/test/parallel/test-path-makelong.js
+++ b/test/parallel/test-path-makelong.js
@@ -28,9 +28,9 @@ if (common.isWindows) {
const file = path.join(common.fixturesDir, 'a.js');
const resolvedFile = path.resolve(file);
- assert.strictEqual('\\\\?\\' + resolvedFile, path._makeLong(file));
- assert.strictEqual('\\\\?\\' + resolvedFile, path._makeLong('\\\\?\\' +
- file));
+ assert.strictEqual(`\\\\?\\${resolvedFile}`, path._makeLong(file));
+ assert.strictEqual(`\\\\?\\${resolvedFile}`,
+ path._makeLong(`\\\\?\\${file}`));
assert.strictEqual('\\\\?\\UNC\\someserver\\someshare\\somefile',
path._makeLong('\\\\someserver\\someshare\\somefile'));
assert.strictEqual('\\\\?\\UNC\\someserver\\someshare\\somefile', path
diff --git a/test/parallel/test-path-parse-format.js b/test/parallel/test-path-parse-format.js
index d500180943..d69aeac9da 100644
--- a/test/parallel/test-path-parse-format.js
+++ b/test/parallel/test-path-parse-format.js
@@ -157,12 +157,8 @@ trailingTests.forEach(function(test) {
test[1].forEach(function(test) {
const actual = parse(test[0]);
const expected = test[1];
- const fn = `path.${os}.parse(`;
- const message = fn +
- JSON.stringify(test[0]) +
- ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message = `path.${os}.parse(${JSON.stringify(test[0])})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
const actualKeys = Object.keys(actual);
const expectedKeys = Object.keys(expected);
let failed = (actualKeys.length !== expectedKeys.length);
@@ -176,7 +172,7 @@ trailingTests.forEach(function(test) {
}
}
if (failed)
- failures.push('\n' + message);
+ failures.push(`\n${message}`);
});
});
assert.strictEqual(failures.length, 0, failures.join(''));
diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js
index 4aa0e8d5e6..cdf5c4d9f5 100644
--- a/test/parallel/test-path.js
+++ b/test/parallel/test-path.js
@@ -195,12 +195,10 @@ assert.strictEqual(path.win32.dirname('foo'), '.');
}
const actual = extname(input);
const expected = test[1];
- const fn = `path.${os}.extname(`;
- const message = fn + JSON.stringify(input) + ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message = `path.${os}.extname(${JSON.stringify(input)})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
if (actual !== expected)
- failures.push('\n' + message);
+ failures.push(`\n${message}`);
});
});
assert.strictEqual(failures.length, 0, failures.join(''));
@@ -352,10 +350,9 @@ joinTests.forEach((test) => {
} else {
os = 'posix';
}
- const fn = `path.${os}.join(`;
- const message = fn + test[0].map(JSON.stringify).join(',') + ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message =
+ `path.${os}.join(${test[0].map(JSON.stringify).join(',')})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
if (actual !== expected && actualAlt !== expected)
failures.push(`\n${message}`);
});
@@ -459,12 +456,11 @@ resolveTests.forEach((test) => {
actualAlt = actual.replace(/\//g, '\\');
const expected = test[1];
- const fn = `path.${os}.resolve(`;
- const message = fn + test[0].map(JSON.stringify).join(',') + ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message =
+ `path.${os}.resolve(${test[0].map(JSON.stringify).join(',')})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
if (actual !== expected && actualAlt !== expected)
- failures.push('\n' + message);
+ failures.push(`\n${message}`);
});
});
assert.strictEqual(failures.length, 0, failures.join(''));
@@ -560,12 +556,9 @@ relativeTests.forEach((test) => {
const actual = relative(test[0], test[1]);
const expected = test[2];
const os = relative === path.win32.relative ? 'win32' : 'posix';
- const fn = `path.${os}.relative(`;
- const message = fn +
- test.slice(0, 2).map(JSON.stringify).join(',') +
- ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message = `path.${os}.relative(${
+ test.slice(0, 2).map(JSON.stringify).join(',')})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
if (actual !== expected)
failures.push(`\n${message}`);
});
diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js
index 17aef54290..b0326c47b1 100644
--- a/test/parallel/test-preload.js
+++ b/test/parallel/test-preload.js
@@ -16,7 +16,7 @@ const nodeBinary = process.argv[0];
const preloadOption = (preloads) => {
let option = '';
preloads.forEach(function(preload, index) {
- option += '-r ' + preload + ' ';
+ option += `-r ${preload} `;
});
return option;
};
@@ -30,7 +30,7 @@ const fixtureD = fixture('define-global.js');
const fixtureThrows = fixture('throws_error4.js');
// test preloading a single module works
-childProcess.exec(nodeBinary + ' ' + preloadOption([fixtureA]) + ' ' + fixtureB,
+childProcess.exec(`${nodeBinary} ${preloadOption([fixtureA])} ${fixtureB}`,
function(err, stdout, stderr) {
assert.ifError(err);
assert.strictEqual(stdout, 'A\nB\n');
@@ -38,7 +38,7 @@ childProcess.exec(nodeBinary + ' ' + preloadOption([fixtureA]) + ' ' + fixtureB,
// test preloading multiple modules works
childProcess.exec(
- nodeBinary + ' ' + preloadOption([fixtureA, fixtureB]) + ' ' + fixtureC,
+ `${nodeBinary} ${preloadOption([fixtureA, fixtureB])} ${fixtureC}`,
function(err, stdout, stderr) {
assert.ifError(err);
assert.strictEqual(stdout, 'A\nB\nC\n');
@@ -47,7 +47,7 @@ childProcess.exec(
// test that preloading a throwing module aborts
childProcess.exec(
- nodeBinary + ' ' + preloadOption([fixtureA, fixtureThrows]) + ' ' + fixtureB,
+ `${nodeBinary} ${preloadOption([fixtureA, fixtureThrows])} ${fixtureB}`,
function(err, stdout, stderr) {
if (err) {
assert.strictEqual(stdout, 'A\n');
@@ -59,7 +59,7 @@ childProcess.exec(
// test that preload can be used with --eval
childProcess.exec(
- nodeBinary + ' ' + preloadOption([fixtureA]) + '-e "console.log(\'hello\');"',
+ `${nodeBinary} ${preloadOption([fixtureA])}-e "console.log('hello');"`,
function(err, stdout, stderr) {
assert.ifError(err);
assert.strictEqual(stdout, 'A\nhello\n');
@@ -105,8 +105,8 @@ replProc.on('close', function(code) {
// test that preload placement at other points in the cmdline
// also test that duplicated preload only gets loaded once
childProcess.exec(
- nodeBinary + ' ' + preloadOption([fixtureA]) +
- '-e "console.log(\'hello\');" ' + preloadOption([fixtureA, fixtureB]),
+ `${nodeBinary} ${preloadOption([fixtureA])}-e "console.log('hello');" ${
+ preloadOption([fixtureA, fixtureB])}`,
function(err, stdout, stderr) {
assert.ifError(err);
assert.strictEqual(stdout, 'A\nB\nhello\n');
@@ -115,7 +115,7 @@ childProcess.exec(
// test that preload works with -i
const interactive = childProcess.exec(
- nodeBinary + ' ' + preloadOption([fixtureD]) + '-i',
+ `${nodeBinary} ${preloadOption([fixtureD])}-i`,
common.mustCall(function(err, stdout, stderr) {
assert.ifError(err);
assert.strictEqual(stdout, "> 'test'\n> ");
@@ -126,8 +126,8 @@ interactive.stdin.write('a\n');
interactive.stdin.write('process.exit()\n');
childProcess.exec(
- `${nodeBinary} --require ${fixture('cluster-preload.js')} ` +
- fixture('cluster-preload-test.js'),
+ `${nodeBinary} --require ${fixture('cluster-preload.js')} ${
+ fixture('cluster-preload-test.js')}`,
function(err, stdout, stderr) {
assert.ifError(err);
assert.ok(/worker terminated with code 43/.test(stdout));
diff --git a/test/parallel/test-process-exit-code.js b/test/parallel/test-process-exit-code.js
index 284725293f..e84be0aead 100644
--- a/test/parallel/test-process-exit-code.js
+++ b/test/parallel/test-process-exit-code.js
@@ -96,9 +96,9 @@ function test(arg, exit) {
const f = __filename;
const option = { stdio: [ 0, 1, 'ignore' ] };
spawn(node, [f, arg], option).on('exit', function(code) {
- assert.strictEqual(code, exit, 'wrong exit for ' +
- arg + '\nexpected:' + exit +
- ' but got:' + code);
+ assert.strictEqual(
+ code, exit,
+ `wrong exit for ${arg}\nexpected:${exit} but got:${code}`);
console.log('ok - %s exited with %d', arg, exit);
});
}
diff --git a/test/parallel/test-process-raw-debug.js b/test/parallel/test-process-raw-debug.js
index eae0577c53..0459901464 100644
--- a/test/parallel/test-process-raw-debug.js
+++ b/test/parallel/test-process-raw-debug.js
@@ -30,7 +30,7 @@ switch (process.argv[2]) {
case undefined:
return parent();
default:
- throw new Error('wtf? ' + process.argv[2]);
+ throw new Error(`wtf? ${process.argv[2]}`);
}
function parent() {
@@ -46,7 +46,7 @@ function parent() {
child.stderr.setEncoding('utf8');
child.stderr.on('end', function() {
- assert.strictEqual(output, 'I can still debug!' + os.EOL);
+ assert.strictEqual(output, `I can still debug!${os.EOL}`);
console.log('ok - got expected message');
});
diff --git a/test/parallel/test-process-redirect-warnings-env.js b/test/parallel/test-process-redirect-warnings-env.js
index 86942dc9e8..ae21cff378 100644
--- a/test/parallel/test-process-redirect-warnings-env.js
+++ b/test/parallel/test-process-redirect-warnings-env.js
@@ -13,7 +13,7 @@ const assert = require('assert');
common.refreshTmpDir();
-const warnmod = require.resolve(common.fixturesDir + '/warnings.js');
+const warnmod = require.resolve(`${common.fixturesDir}/warnings.js`);
const warnpath = path.join(common.tmpDir, 'warnings.txt');
fork(warnmod, {env: {NODE_REDIRECT_WARNINGS: warnpath}})
diff --git a/test/parallel/test-process-redirect-warnings.js b/test/parallel/test-process-redirect-warnings.js
index b798e41bf6..b1097469b2 100644
--- a/test/parallel/test-process-redirect-warnings.js
+++ b/test/parallel/test-process-redirect-warnings.js
@@ -13,7 +13,7 @@ const assert = require('assert');
common.refreshTmpDir();
-const warnmod = require.resolve(common.fixturesDir + '/warnings.js');
+const warnmod = require.resolve(`${common.fixturesDir}/warnings.js`);
const warnpath = path.join(common.tmpDir, 'warnings.txt');
fork(warnmod, {execArgv: [`--redirect-warnings=${warnpath}`]})
diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js
index fb2404a990..7a367920b0 100644
--- a/test/parallel/test-promises-unhandled-rejections.js
+++ b/test/parallel/test-promises-unhandled-rejections.js
@@ -12,11 +12,11 @@ const asyncTest = (function() {
function fail(error) {
const stack = currentTest ?
- error.stack + '\nFrom previous event:\n' + currentTest.stack :
+ `${error.stack}\nFrom previous event:\n${currentTest.stack}` :
error.stack;
if (currentTest)
- process.stderr.write('\'' + currentTest.description + '\' failed\n\n');
+ process.stderr.write(`'${currentTest.description}' failed\n\n`);
process.stderr.write(stack);
process.exit(2);
diff --git a/test/parallel/test-querystring-maxKeys-non-finite.js b/test/parallel/test-querystring-maxKeys-non-finite.js
index 3df381405d..da72dbf17c 100644
--- a/test/parallel/test-querystring-maxKeys-non-finite.js
+++ b/test/parallel/test-querystring-maxKeys-non-finite.js
@@ -23,7 +23,7 @@ function createManyParams(count) {
for (let i = 1; i < count; i++) {
const n = i.toString(36);
- str += '&' + n + '=' + n;
+ str += `&${n}=${n}`;
}
return str;
diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js
index 50a6bf2daa..86c102c45f 100644
--- a/test/parallel/test-readline-interface.js
+++ b/test/parallel/test-readline-interface.js
@@ -155,7 +155,7 @@ function isWarned(emitter) {
assert.strictEqual(line, expectedLines[callCount]);
callCount++;
});
- fi.emit('data', expectedLines.join('\n') + '\n');
+ fi.emit('data', `${expectedLines.join('\n')}\n`);
assert.strictEqual(callCount, expectedLines.length);
rli.close();
@@ -216,7 +216,7 @@ function isWarned(emitter) {
callCount++;
});
expectedLines.forEach(function(line) {
- fi.emit('data', line + '\r');
+ fi.emit('data', `${line}\r`);
fi.emit('data', '\n');
});
assert.strictEqual(callCount, expectedLines.length);
@@ -339,7 +339,7 @@ function isWarned(emitter) {
assert.strictEqual(line, expectedLines[callCount]);
callCount++;
});
- fi.emit('data', expectedLines.join('\n') + '\n');
+ fi.emit('data', `${expectedLines.join('\n')}\n`);
assert.strictEqual(callCount, expectedLines.length);
fi.emit('keypress', '.', { name: 'up' }); // 'bat'
assert.strictEqual(rli.line, expectedLines[--callCount]);
@@ -369,7 +369,7 @@ function isWarned(emitter) {
assert.strictEqual(line, expectedLines[callCount]);
callCount++;
});
- fi.emit('data', expectedLines.join('\n') + '\n');
+ fi.emit('data', `${expectedLines.join('\n')}\n`);
assert.strictEqual(callCount, expectedLines.length);
fi.emit('keypress', '.', { name: 'up' }); // 'bat'
assert.strictEqual(rli.line, expectedLines[--callCount]);
diff --git a/test/parallel/test-regress-GH-1531.js b/test/parallel/test-regress-GH-1531.js
index 5189e50929..3cf342b869 100644
--- a/test/parallel/test-regress-GH-1531.js
+++ b/test/parallel/test-regress-GH-1531.js
@@ -10,8 +10,8 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = https.createServer(options, function(req, res) {
diff --git a/test/parallel/test-regress-GH-3739.js b/test/parallel/test-regress-GH-3739.js
index b845a2b7f1..d41accc2e6 100644
--- a/test/parallel/test-regress-GH-3739.js
+++ b/test/parallel/test-regress-GH-3739.js
@@ -12,7 +12,7 @@ common.refreshTmpDir();
// Make a long path.
for (let i = 0; i < 50; i++) {
- dir = dir + '/1234567890';
+ dir = `${dir}/1234567890`;
try {
fs.mkdirSync(dir, '0777');
} catch (e) {
diff --git a/test/parallel/test-regress-GH-9819.js b/test/parallel/test-regress-GH-9819.js
index f043bc3b28..fb9bb489a0 100644
--- a/test/parallel/test-regress-GH-9819.js
+++ b/test/parallel/test-regress-GH-9819.js
@@ -17,7 +17,7 @@ const scripts = [
scripts.forEach((script) => {
const node = process.execPath;
- const code = setup + ';' + script;
+ const code = `${setup};${script}`;
execFile(node, [ '-e', code ], common.mustCall((err, stdout, stderr) => {
assert(stderr.includes('Error: xyz'), 'digest crashes');
}));
diff --git a/test/parallel/test-repl-autolibs.js b/test/parallel/test-repl-autolibs.js
index 42370f0fcf..52234deb5e 100644
--- a/test/parallel/test-repl-autolibs.js
+++ b/test/parallel/test-repl-autolibs.js
@@ -40,8 +40,8 @@ function test1() {
if (data.length) {
// inspect output matches repl output
- assert.strictEqual(data, util.inspect(require('fs'), null, 2, false) +
- '\n');
+ assert.strictEqual(data,
+ `${util.inspect(require('fs'), null, 2, false)}\n`);
// globally added lib matches required lib
assert.strictEqual(global.fs, require('fs'));
test2();
diff --git a/test/parallel/test-repl-definecommand.js b/test/parallel/test-repl-definecommand.js
index f879043b94..b6368bbd94 100644
--- a/test/parallel/test-repl-definecommand.js
+++ b/test/parallel/test-repl-definecommand.js
@@ -23,7 +23,7 @@ r.defineCommand('say1', {
help: 'help for say1',
action: function(thing) {
output = '';
- this.write('hello ' + thing);
+ this.write(`hello ${thing}`);
this.displayPrompt();
}
});
diff --git a/test/parallel/test-repl-envvars.js b/test/parallel/test-repl-envvars.js
index bd4e1fc9af..c4efd184c4 100644
--- a/test/parallel/test-repl-envvars.js
+++ b/test/parallel/test-repl-envvars.js
@@ -50,10 +50,10 @@ function run(test) {
// The REPL registers 'module' and 'require' globals
common.allowGlobals(repl.context.module, repl.context.require);
- assert.strictEqual(expected.terminal, repl.terminal, 'Expected ' +
- inspect(expected) + ' with ' + inspect(env));
- assert.strictEqual(expected.useColors, repl.useColors, 'Expected ' +
- inspect(expected) + ' with ' + inspect(env));
+ assert.strictEqual(expected.terminal, repl.terminal,
+ `Expected ${inspect(expected)} with ${inspect(env)}`);
+ assert.strictEqual(expected.useColors, repl.useColors,
+ `Expected ${inspect(expected)} with ${inspect(env)}`);
repl.close();
});
}
diff --git a/test/parallel/test-repl-mode.js b/test/parallel/test-repl-mode.js
index cef4b6777c..cf492a7e4b 100644
--- a/test/parallel/test-repl-mode.js
+++ b/test/parallel/test-repl-mode.js
@@ -19,46 +19,34 @@ tests.forEach(function(test) {
function testSloppyMode() {
const cli = initRepl(repl.REPL_MODE_SLOPPY);
- cli.input.emit('data', `
- x = 3
- `.trim() + '\n');
+ cli.input.emit('data', 'x = 3\n');
assert.strictEqual(cli.output.accumulator.join(''), '> 3\n> ');
cli.output.accumulator.length = 0;
- cli.input.emit('data', `
- let y = 3
- `.trim() + '\n');
+ cli.input.emit('data', 'let y = 3\n');
assert.strictEqual(cli.output.accumulator.join(''), 'undefined\n> ');
}
function testStrictMode() {
const cli = initRepl(repl.REPL_MODE_STRICT);
- cli.input.emit('data', `
- x = 3
- `.trim() + '\n');
+ cli.input.emit('data', 'x = 3\n');
assert.ok(/ReferenceError: x is not defined/.test(
cli.output.accumulator.join('')));
cli.output.accumulator.length = 0;
- cli.input.emit('data', `
- let y = 3
- `.trim() + '\n');
+ cli.input.emit('data', 'let y = 3\n');
assert.strictEqual(cli.output.accumulator.join(''), 'undefined\n> ');
}
function testAutoMode() {
const cli = initRepl(repl.REPL_MODE_MAGIC);
- cli.input.emit('data', `
- x = 3
- `.trim() + '\n');
+ cli.input.emit('data', 'x = 3\n');
assert.strictEqual(cli.output.accumulator.join(''), '> 3\n> ');
cli.output.accumulator.length = 0;
- cli.input.emit('data', `
- let y = 3
- `.trim() + '\n');
+ cli.input.emit('data', 'let y = 3\n');
assert.strictEqual(cli.output.accumulator.join(''), 'undefined\n> ');
}
diff --git a/test/parallel/test-repl-persistent-history.js b/test/parallel/test-repl-persistent-history.js
index 0ce25a4dd5..f2c760cb38 100644
--- a/test/parallel/test-repl-persistent-history.js
+++ b/test/parallel/test-repl-persistent-history.js
@@ -35,7 +35,7 @@ class ActionStream extends stream.Stream {
if (typeof action === 'object') {
this.emit('keypress', '', action);
} else {
- this.emit('data', action + '\n');
+ this.emit('data', `${action}\n`);
}
setImmediate(doAction);
};
@@ -117,19 +117,19 @@ const tests = [
{
env: { NODE_REPL_HISTORY: historyPath },
test: [UP, CLEAR],
- expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
+ expected: [prompt, `${prompt}'you look fabulous today'`, prompt]
},
{
env: { NODE_REPL_HISTORY: historyPath,
NODE_REPL_HISTORY_FILE: oldHistoryPath },
test: [UP, CLEAR],
- expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
+ expected: [prompt, `${prompt}'you look fabulous today'`, prompt]
},
{
env: { NODE_REPL_HISTORY: historyPath,
NODE_REPL_HISTORY_FILE: '' },
test: [UP, CLEAR],
- expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
+ expected: [prompt, `${prompt}'you look fabulous today'`, prompt]
},
{
env: {},
@@ -139,27 +139,27 @@ const tests = [
{
env: { NODE_REPL_HISTORY_FILE: oldHistoryPath },
test: [UP, CLEAR, '\'42\'', ENTER],
- expected: [prompt, convertMsg, prompt, prompt + '\'=^.^=\'', prompt, '\'',
+ expected: [prompt, convertMsg, prompt, `${prompt}'=^.^='`, prompt, '\'',
'4', '2', '\'', '\'42\'\n', prompt, prompt],
clean: false
},
{ // Requires the above testcase
env: {},
test: [UP, UP, ENTER],
- expected: [prompt, prompt + '\'42\'', prompt + '\'=^.^=\'', '\'=^.^=\'\n',
+ expected: [prompt, `${prompt}'42'`, `${prompt}'=^.^='`, '\'=^.^=\'\n',
prompt]
},
{
env: { NODE_REPL_HISTORY: historyPath,
NODE_REPL_HISTORY_SIZE: 1 },
test: [UP, UP, CLEAR],
- expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
+ expected: [prompt, `${prompt}'you look fabulous today'`, prompt]
},
{
env: { NODE_REPL_HISTORY_FILE: oldHistoryPath,
NODE_REPL_HISTORY_SIZE: 1 },
test: [UP, UP, UP, CLEAR],
- expected: [prompt, convertMsg, prompt, prompt + '\'=^.^=\'', prompt]
+ expected: [prompt, convertMsg, prompt, `${prompt}'=^.^='`, prompt]
},
{
env: { NODE_REPL_HISTORY: historyPathFail,
diff --git a/test/parallel/test-repl-save-load.js b/test/parallel/test-repl-save-load.js
index ade32659bf..746f6f2b6c 100644
--- a/test/parallel/test-repl-save-load.js
+++ b/test/parallel/test-repl-save-load.js
@@ -45,11 +45,11 @@ const saveFileName = join(common.tmpDir, 'test.save.js');
putIn.run(testFile);
// save it to a file
-putIn.run(['.save ' + saveFileName]);
+putIn.run([`.save ${saveFileName}`]);
// the file should have what I wrote
-assert.strictEqual(fs.readFileSync(saveFileName, 'utf8'), testFile.join('\n') +
- '\n');
+assert.strictEqual(fs.readFileSync(saveFileName, 'utf8'),
+ `${testFile.join('\n')}\n`);
{
// save .editor mode code
@@ -81,7 +81,7 @@ testMe.complete('inner.o', function(error, data) {
putIn.run(['.clear']);
// Load the file back in
-putIn.run(['.load ' + saveFileName]);
+putIn.run([`.load ${saveFileName}`]);
// make sure that the REPL data is "correct"
testMe.complete('inner.o', function(error, data) {
@@ -96,20 +96,19 @@ let loadFile = join(common.tmpDir, 'file.does.not.exist');
// should not break
putIn.write = function(data) {
// make sure I get a failed to load message and not some crazy error
- assert.strictEqual(data, 'Failed to load:' + loadFile + '\n');
+ assert.strictEqual(data, `Failed to load:${loadFile}\n`);
// eat me to avoid work
putIn.write = common.noop;
};
-putIn.run(['.load ' + loadFile]);
+putIn.run([`.load ${loadFile}`]);
// throw error on loading directory
loadFile = common.tmpDir;
putIn.write = function(data) {
- assert.strictEqual(data, 'Failed to load:' + loadFile +
- ' is not a valid file\n');
+ assert.strictEqual(data, `Failed to load:${loadFile} is not a valid file\n`);
putIn.write = common.noop;
};
-putIn.run(['.load ' + loadFile]);
+putIn.run([`.load ${loadFile}`]);
// clear the REPL
putIn.run(['.clear']);
@@ -121,10 +120,10 @@ const invalidFileName = join(common.tmpDir, '\0\0\0\0\0');
// should not break
putIn.write = function(data) {
// make sure I get a failed to save message and not some other error
- assert.strictEqual(data, 'Failed to save:' + invalidFileName + '\n');
+ assert.strictEqual(data, `Failed to save:${invalidFileName}\n`);
// reset to no-op
putIn.write = common.noop;
};
// save it to a file
-putIn.run(['.save ' + invalidFileName]);
+putIn.run([`.save ${invalidFileName}`]);
diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js
index b0ff850edd..6df0d81f8d 100644
--- a/test/parallel/test-repl-tab-complete.js
+++ b/test/parallel/test-repl-tab-complete.js
@@ -207,7 +207,7 @@ putIn.run(['.clear']);
testMe.complete('require(\'', common.mustCall(function(error, data) {
assert.strictEqual(error, null);
repl._builtinLibs.forEach(function(lib) {
- assert.notStrictEqual(data[0].indexOf(lib), -1, lib + ' not found');
+ assert.notStrictEqual(data[0].indexOf(lib), -1, `${lib} not found`);
});
}));
diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js
index 824f4b094c..b22fccb15e 100644
--- a/test/parallel/test-repl.js
+++ b/test/parallel/test-repl.js
@@ -46,19 +46,19 @@ console.error('repl test');
// function for REPL to run
global.invoke_me = function(arg) {
- return 'invoked ' + arg;
+ return `invoked ${arg}`;
};
function send_expect(list) {
if (list.length > 0) {
const cur = list.shift();
- console.error('sending ' + JSON.stringify(cur.send));
+ console.error(`sending ${JSON.stringify(cur.send)}`);
cur.client.expect = cur.expect;
cur.client.list = list;
if (cur.send.length > 0) {
- cur.client.write(cur.send + '\n');
+ cur.client.write(`${cur.send}\n`);
}
}
}
@@ -83,10 +83,11 @@ function error_test() {
client_unix.on('data', function(data) {
read_buffer += data.toString('ascii', 0, data.length);
- console.error('Unix data: ' + JSON.stringify(read_buffer) + ', expecting ' +
- (client_unix.expect.exec ?
- client_unix.expect :
- JSON.stringify(client_unix.expect)));
+ console.error(
+ `Unix data: ${JSON.stringify(read_buffer)}, expecting ${
+ client_unix.expect.exec ?
+ client_unix.expect :
+ JSON.stringify(client_unix.expect)}`);
if (read_buffer.includes(prompt_unix)) {
// if it's an exact match, then don't do the regexp
@@ -217,7 +218,7 @@ function error_test() {
{ client: client_unix, send: 'function blah() { return 1; }',
expect: prompt_unix },
{ client: client_unix, send: 'blah()',
- expect: '1\n' + prompt_unix },
+ expect: `1\n${prompt_unix}` },
// Functions should not evaluate twice (#2773)
{ client: client_unix, send: 'var I = [1,2,3,function() {}]; I.pop()',
expect: '[Function]' },
@@ -241,7 +242,7 @@ function error_test() {
{ client: client_unix, send: '2)',
expect: prompt_multiline },
{ client: client_unix, send: ')',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
// npm prompt error message
{ client: client_unix, send: 'npm install foobar',
expect: expect_npm },
@@ -256,18 +257,18 @@ function error_test() {
// this makes sure that we don't print `undefined` when we actually print
// the error message
{ client: client_unix, send: '.invalid_repl_command',
- expect: 'Invalid REPL keyword\n' + prompt_unix },
+ expect: `Invalid REPL keyword\n${prompt_unix}` },
// this makes sure that we don't crash when we use an inherited property as
// a REPL command
{ client: client_unix, send: '.toString',
- expect: 'Invalid REPL keyword\n' + prompt_unix },
+ expect: `Invalid REPL keyword\n${prompt_unix}` },
// fail when we are not inside a String and a line continuation is used
{ client: client_unix, send: '[] \\',
expect: /\bSyntaxError: Invalid or unexpected token/ },
// do not fail when a String is created with line continuation
{ client: client_unix, send: '\'the\\\nfourth\\\neye\'',
- expect: prompt_multiline + prompt_multiline +
- '\'thefourtheye\'\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}'thefourtheye'\n${
+ prompt_unix}` },
// 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.
// This test is to make sure that we properly remove the whitespace
@@ -276,12 +277,12 @@ function error_test() {
expect: prompt_unix },
// multiline strings preserve whitespace characters in them
{ client: client_unix, send: '\'the \\\n fourth\t\t\\\n eye \'',
- expect: prompt_multiline + prompt_multiline +
- '\'the fourth\\t\\t eye \'\n' + prompt_unix },
+ expect: `${prompt_multiline}${
+ prompt_multiline}'the fourth\\t\\t eye '\n${prompt_unix}` },
// more than one multiline strings also should preserve whitespace chars
{ client: client_unix, send: '\'the \\\n fourth\' + \'\t\t\\\n eye \'',
- expect: prompt_multiline + prompt_multiline +
- '\'the fourth\\t\\t eye \'\n' + prompt_unix },
+ expect: `${prompt_multiline}${
+ prompt_multiline}'the fourth\\t\\t eye '\n${prompt_unix}` },
// using REPL commands within a string literal should still work
{ client: client_unix, send: '\'\\\n.break',
expect: prompt_unix },
@@ -293,8 +294,8 @@ function error_test() {
expect: prompt_unix + prompt_unix + prompt_unix },
// empty lines in the string literals should not affect the string
{ client: client_unix, send: '\'the\\\n\\\nfourtheye\'\n',
- expect: prompt_multiline + prompt_multiline +
- '\'thefourtheye\'\n' + prompt_unix },
+ expect: `${prompt_multiline}${
+ prompt_multiline}'thefourtheye'\n${prompt_unix}` },
// Regression test for https://github.com/nodejs/node/issues/597
{ client: client_unix,
send: '/(.)(.)(.)(.)(.)(.)(.)(.)(.)/.test(\'123456789\')\n',
@@ -307,39 +308,39 @@ function error_test() {
'\'7\'\n', '\'8\'\n', '\'9\'\n'].join(`${prompt_unix}`) },
// regression tests for https://github.com/nodejs/node/issues/2749
{ client: client_unix, send: 'function x() {\nreturn \'\\n\';\n }',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${
+ prompt_unix}` },
{ client: client_unix, send: 'function x() {\nreturn \'\\\\\';\n }',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${
+ prompt_unix}` },
// regression tests for https://github.com/nodejs/node/issues/3421
{ client: client_unix, send: 'function x() {\n//\'\n }',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${
+ prompt_unix}` },
{ client: client_unix, send: 'function x() {\n//"\n }',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${
+ prompt_unix}` },
{ client: client_unix, send: 'function x() {//\'\n }',
- expect: prompt_multiline + 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}undefined\n${prompt_unix}` },
{ client: client_unix, send: 'function x() {//"\n }',
- expect: prompt_multiline + 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}undefined\n${prompt_unix}` },
{ client: client_unix, send: 'function x() {\nvar i = "\'";\n }',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${
+ prompt_unix}` },
{ client: client_unix, send: 'function x(/*optional*/) {}',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
{ client: client_unix, send: 'function x(/* // 5 */) {}',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
{ client: client_unix, send: '// /* 5 */',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
{ client: client_unix, send: '"//"',
- expect: '\'//\'\n' + prompt_unix },
+ expect: `'//'\n${prompt_unix}` },
{ client: client_unix, send: '"data /*with*/ comment"',
- expect: '\'data /*with*/ comment\'\n' + prompt_unix },
+ expect: `'data /*with*/ comment'\n${prompt_unix}` },
{ client: client_unix, send: 'function x(/*fn\'s optional params*/) {}',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
{ client: client_unix, send: '/* \'\n"\n\'"\'\n*/',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
// REPL should get a normal require() function, not one that allows
// access to internal modules without the --expose_internals flag.
{ client: client_unix, send: 'require("internal/repl")',
@@ -347,31 +348,31 @@ function error_test() {
// REPL should handle quotes within regexp literal in multiline mode
{ client: client_unix,
send: "function x(s) {\nreturn s.replace(/'/,'');\n}",
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}` +
+ `undefined\n${prompt_unix}` },
{ client: client_unix,
send: "function x(s) {\nreturn s.replace(/'/,'');\n}",
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}` +
+ `undefined\n${prompt_unix}` },
{ client: client_unix,
send: 'function x(s) {\nreturn s.replace(/"/,"");\n}',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}` +
+ `undefined\n${prompt_unix}` },
{ client: client_unix,
send: 'function x(s) {\nreturn s.replace(/.*/,"");\n}',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}` +
+ `undefined\n${prompt_unix}` },
{ client: client_unix, send: '{ var x = 4; }',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
// Illegal token is not recoverable outside string literal, RegExp literal,
// or block comment. https://github.com/nodejs/node/issues/3611
{ client: client_unix, send: 'a = 3.5e',
expect: /\bSyntaxError: Invalid or unexpected token/ },
// Mitigate https://github.com/nodejs/node/issues/548
{ client: client_unix, send: 'function name(){ return "node"; };name()',
- expect: "'node'\n" + prompt_unix },
+ expect: `'node'\n${prompt_unix}` },
{ client: client_unix, send: 'function name(){ return "nodejs"; };name()',
- expect: "'nodejs'\n" + prompt_unix },
+ expect: `'nodejs'\n${prompt_unix}` },
// Avoid emitting repl:line-number for SyntaxError
{ client: client_unix, send: 'a = 3.5e',
expect: /^(?!repl)/ },
@@ -400,17 +401,17 @@ function error_test() {
{
client: client_unix, send: '(function() {\nreturn /foo/ / /bar/;\n}())',
- expect: prompt_multiline + prompt_multiline + 'NaN\n' + prompt_unix
+ expect: `${prompt_multiline}${prompt_multiline}NaN\n${prompt_unix}`
},
{
client: client_unix, send: '(function() {\nif (false) {} /bar"/;\n}())',
- expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${prompt_unix}`
},
// Newline within template string maintains whitespace.
{ client: client_unix, send: '`foo \n`',
- expect: prompt_multiline + '\'foo \\n\'\n' + prompt_unix },
+ expect: `${prompt_multiline}'foo \\n'\n${prompt_unix}` },
// Whitespace is not evaluated.
{ client: client_unix, send: ' \t \n',
expect: prompt_unix }
@@ -445,15 +446,15 @@ function tcp_test() {
{ client: client_tcp, send: 'a += 1',
expect: (`12346\n${prompt_tcp}`) },
{ client: client_tcp,
- send: 'require(' + JSON.stringify(moduleFilename) + ').number',
+ send: `require(${JSON.stringify(moduleFilename)}).number`,
expect: (`42\n${prompt_tcp}`) }
]);
});
client_tcp.on('data', function(data) {
read_buffer += data.toString('ascii', 0, data.length);
- console.error('TCP data: ' + JSON.stringify(read_buffer) +
- ', expecting ' + JSON.stringify(client_tcp.expect));
+ console.error(`TCP data: ${JSON.stringify(read_buffer)}, expecting ${
+ JSON.stringify(client_tcp.expect)}`);
if (read_buffer.includes(prompt_tcp)) {
assert.strictEqual(client_tcp.expect, read_buffer);
console.error('match');
@@ -522,8 +523,8 @@ function unix_test() {
client_unix.on('data', function(data) {
read_buffer += data.toString('ascii', 0, data.length);
- console.error('Unix data: ' + JSON.stringify(read_buffer) +
- ', expecting ' + JSON.stringify(client_unix.expect));
+ console.error(`Unix data: ${JSON.stringify(read_buffer)}, expecting ${
+ JSON.stringify(client_unix.expect)}`);
if (read_buffer.includes(prompt_unix)) {
assert.strictEqual(client_unix.expect, read_buffer);
console.error('match');
diff --git a/test/parallel/test-require-dot.js b/test/parallel/test-require-dot.js
index 26733c7fc4..04e978df56 100644
--- a/test/parallel/test-require-dot.js
+++ b/test/parallel/test-require-dot.js
@@ -3,13 +3,13 @@ const common = require('../common');
const assert = require('assert');
const m = require('module');
-const a = require(common.fixturesDir + '/module-require/relative/dot.js');
-const b = require(common.fixturesDir + '/module-require/relative/dot-slash.js');
+const a = require(`${common.fixturesDir}/module-require/relative/dot.js`);
+const b = require(`${common.fixturesDir}/module-require/relative/dot-slash.js`);
assert.strictEqual(a.value, 42);
assert.strictEqual(a, b, 'require(".") should resolve like require("./")');
-process.env.NODE_PATH = common.fixturesDir + '/module-require/relative';
+process.env.NODE_PATH = `${common.fixturesDir}/module-require/relative`;
m._initPaths();
const c = require('.');
diff --git a/test/parallel/test-require-exceptions.js b/test/parallel/test-require-exceptions.js
index 2ae51c5486..57d0e9c218 100644
--- a/test/parallel/test-require-exceptions.js
+++ b/test/parallel/test-require-exceptions.js
@@ -25,12 +25,12 @@ const assert = require('assert');
// A module with an error in it should throw
assert.throws(function() {
- require(common.fixturesDir + '/throws_error');
+ require(`${common.fixturesDir}/throws_error`);
}, /^Error: blah$/);
// Requiring the same module again should throw as well
assert.throws(function() {
- require(common.fixturesDir + '/throws_error');
+ require(`${common.fixturesDir}/throws_error`);
}, /^Error: blah$/);
// Requiring a module that does not exist should throw an
diff --git a/test/parallel/test-signal-handler.js b/test/parallel/test-signal-handler.js
index 3b2602ae9c..db34a036e4 100644
--- a/test/parallel/test-signal-handler.js
+++ b/test/parallel/test-signal-handler.js
@@ -28,7 +28,7 @@ if (common.isWindows) {
return;
}
-console.log('process.pid: ' + process.pid);
+console.log(`process.pid: ${process.pid}`);
process.on('SIGUSR1', common.mustCall());
@@ -41,7 +41,7 @@ process.on('SIGUSR1', common.mustCall(function() {
let i = 0;
setInterval(function() {
- console.log('running process...' + ++i);
+ console.log(`running process...${++i}`);
if (i === 5) {
process.kill(process.pid, 'SIGUSR1');
diff --git a/test/parallel/test-signal-unregister.js b/test/parallel/test-signal-unregister.js
index 88c6a367a9..f28c73c099 100644
--- a/test/parallel/test-signal-unregister.js
+++ b/test/parallel/test-signal-unregister.js
@@ -3,7 +3,7 @@ const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
-const child = spawn(process.argv[0], [common.fixturesDir + '/should_exit.js']);
+const child = spawn(process.argv[0], [`${common.fixturesDir}/should_exit.js`]);
child.stdout.once('data', function() {
child.kill('SIGINT');
});
diff --git a/test/parallel/test-socket-write-after-fin-error.js b/test/parallel/test-socket-write-after-fin-error.js
index 37d042b4c6..4626729c05 100644
--- a/test/parallel/test-socket-write-after-fin-error.js
+++ b/test/parallel/test-socket-write-after-fin-error.js
@@ -17,7 +17,7 @@ let gotServerError = false;
const server = net.createServer(function(sock) {
sock.setEncoding('utf8');
sock.on('error', function(er) {
- console.error(er.code + ': ' + er.message);
+ console.error(`${er.code}: ${er.message}`);
gotServerError = er;
});
diff --git a/test/parallel/test-spawn-cmd-named-pipe.js b/test/parallel/test-spawn-cmd-named-pipe.js
index d2cb16d26c..3843ba1f77 100644
--- a/test/parallel/test-spawn-cmd-named-pipe.js
+++ b/test/parallel/test-spawn-cmd-named-pipe.js
@@ -14,9 +14,9 @@ if (!process.argv[2]) {
const spawn = require('child_process').spawn;
const path = require('path');
- const pipeNamePrefix = path.basename(__filename) + '.' + process.pid;
- const stdinPipeName = '\\\\.\\pipe\\' + pipeNamePrefix + '.stdin';
- const stdoutPipeName = '\\\\.\\pipe\\' + pipeNamePrefix + '.stdout';
+ const pipeNamePrefix = `${path.basename(__filename)}.${process.pid}`;
+ const stdinPipeName = `\\\\.\\pipe\\${pipeNamePrefix}.stdin`;
+ const stdoutPipeName = `\\\\.\\pipe\\${pipeNamePrefix}.stdout`;
const stdinPipeServer = net.createServer(function(c) {
c.on('end', common.mustCall(function() {
diff --git a/test/parallel/test-stdin-from-file.js b/test/parallel/test-stdin-from-file.js
index 9a847118bd..908416e721 100644
--- a/test/parallel/test-stdin-from-file.js
+++ b/test/parallel/test-stdin-from-file.js
@@ -8,8 +8,7 @@ const fs = require('fs');
const stdoutScript = join(common.fixturesDir, 'echo-close-check.js');
const tmpFile = join(common.tmpDir, 'stdin.txt');
-const cmd = '"' + process.argv[0] + '" "' + stdoutScript + '" < "' +
- tmpFile + '"';
+const cmd = `"${process.argv[0]}" "${stdoutScript}" < "${tmpFile}"`;
const string = 'abc\nümlaut.\nsomething else\n' +
'南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,' +
@@ -26,7 +25,7 @@ const string = 'abc\nümlaut.\nsomething else\n' +
common.refreshTmpDir();
-console.log(cmd + '\n\n');
+console.log(`${cmd}\n\n`);
fs.writeFileSync(tmpFile, string);
@@ -34,6 +33,6 @@ childProcess.exec(cmd, common.mustCall(function(err, stdout, stderr) {
fs.unlinkSync(tmpFile);
assert.ifError(err);
- assert.strictEqual(stdout, 'hello world\r\n' + string);
+ assert.strictEqual(stdout, `hello world\r\n${string}`);
assert.strictEqual('', stderr);
}));
diff --git a/test/parallel/test-stdin-script-child.js b/test/parallel/test-stdin-script-child.js
index a8a161686e..81eb3ea5b4 100644
--- a/test/parallel/test-stdin-script-child.js
+++ b/test/parallel/test-stdin-script-child.js
@@ -8,7 +8,7 @@ const child = spawn(process.execPath, [], {
NODE_DEBUG: process.argv[2]
})
});
-const wanted = child.pid + '\n';
+const wanted = `${child.pid}\n`;
let found = '';
child.stdout.setEncoding('utf8');
@@ -18,7 +18,7 @@ child.stdout.on('data', function(c) {
child.stderr.setEncoding('utf8');
child.stderr.on('data', function(c) {
- console.error('> ' + c.trim().split(/\n/).join('\n> '));
+ console.error(`> ${c.trim().split(/\n/).join('\n> ')}`);
});
child.on('close', common.mustCall(function(c) {
diff --git a/test/parallel/test-stdout-stderr-reading.js b/test/parallel/test-stdout-stderr-reading.js
index 11cdcc3907..6466366a4f 100644
--- a/test/parallel/test-stdout-stderr-reading.js
+++ b/test/parallel/test-stdout-stderr-reading.js
@@ -31,7 +31,7 @@ function parent() {
});
c1.stderr.setEncoding('utf8');
c1.stderr.on('data', function(chunk) {
- console.error('c1err: ' + chunk.split('\n').join('\nc1err: '));
+ console.error(`c1err: ${chunk.split('\n').join('\nc1err: ')}`);
});
c1.on('close', common.mustCall(function(code, signal) {
assert(!code);
@@ -48,7 +48,7 @@ function parent() {
});
c1.stderr.setEncoding('utf8');
c1.stderr.on('data', function(chunk) {
- console.error('c1err: ' + chunk.split('\n').join('\nc1err: '));
+ console.error(`c1err: ${chunk.split('\n').join('\nc1err: ')}`);
});
c2.on('close', common.mustCall(function(code, signal) {
assert(!code);
diff --git a/test/parallel/test-stdout-to-file.js b/test/parallel/test-stdout-to-file.js
index 914fe5673e..d506ecd06a 100644
--- a/test/parallel/test-stdout-to-file.js
+++ b/test/parallel/test-stdout-to-file.js
@@ -13,13 +13,8 @@ const tmpFile = path.join(common.tmpDir, 'stdout.txt');
common.refreshTmpDir();
function test(size, useBuffer, cb) {
- const cmd = '"' + process.argv[0] + '"' +
- ' ' +
- '"' + (useBuffer ? scriptBuffer : scriptString) + '"' +
- ' ' +
- size +
- ' > ' +
- '"' + tmpFile + '"';
+ const cmd = `"${process.argv[0]}" "${
+ useBuffer ? scriptBuffer : scriptString}" ${size} > "${tmpFile}"`;
try {
fs.unlinkSync(tmpFile);
diff --git a/test/parallel/test-stream-base-no-abort.js b/test/parallel/test-stream-base-no-abort.js
index f046a6f7af..2631606547 100644
--- a/test/parallel/test-stream-base-no-abort.js
+++ b/test/parallel/test-stream-base-no-abort.js
@@ -42,8 +42,8 @@ async_wrap.enable();
const checkTLS = common.mustCall(function checkTLS() {
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/ec-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/ec-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/ec-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/ec-cert.pem`)
};
const server = tls.createServer(options, common.noop)
.listen(0, function() {
diff --git a/test/parallel/test-stream-push-strings.js b/test/parallel/test-stream-push-strings.js
index af7132545b..2c2d2ec467 100644
--- a/test/parallel/test-stream-push-strings.js
+++ b/test/parallel/test-stream-push-strings.js
@@ -56,7 +56,7 @@ const results = [];
ms.on('readable', function() {
let chunk;
while (null !== (chunk = ms.read()))
- results.push(chunk + '');
+ results.push(String(chunk));
});
const expect = [ 'first chunksecond to last chunk', 'last chunk' ];
diff --git a/test/parallel/test-stream-readable-flow-recursion.js b/test/parallel/test-stream-readable-flow-recursion.js
index a3264fef7d..4dcec8901f 100644
--- a/test/parallel/test-stream-readable-flow-recursion.js
+++ b/test/parallel/test-stream-readable-flow-recursion.js
@@ -58,11 +58,11 @@ function flow(stream, size, callback) {
callback(chunk);
depth -= 1;
- console.log('flow(' + depth + '): exit');
+ console.log(`flow(${depth}): exit`);
}
flow(stream, 5000, function() {
- console.log('complete (' + depth + ')');
+ console.log(`complete (${depth})`);
});
process.on('exit', function(code) {
diff --git a/test/parallel/test-stream2-base64-single-char-read-end.js b/test/parallel/test-stream2-base64-single-char-read-end.js
index 2e400c2f97..3c946f3b2f 100644
--- a/test/parallel/test-stream2-base64-single-char-read-end.js
+++ b/test/parallel/test-stream2-base64-single-char-read-end.js
@@ -46,7 +46,7 @@ dst._write = function(chunk, enc, cb) {
};
src.on('end', function() {
- assert.strictEqual(Buffer.concat(accum) + '', 'MQ==');
+ assert.strictEqual(String(Buffer.concat(accum)), 'MQ==');
clearTimeout(timeout);
});
diff --git a/test/parallel/test-stream2-readable-empty-buffer-no-eof.js b/test/parallel/test-stream2-readable-empty-buffer-no-eof.js
index 18bfa28196..d2ef827b12 100644
--- a/test/parallel/test-stream2-readable-empty-buffer-no-eof.js
+++ b/test/parallel/test-stream2-readable-empty-buffer-no-eof.js
@@ -75,7 +75,7 @@ function test1() {
function flow() {
let chunk;
while (null !== (chunk = r.read()))
- results.push(chunk + '');
+ results.push(String(chunk));
}
r.on('readable', flow);
r.on('end', function() {
@@ -103,7 +103,7 @@ function test2() {
function flow() {
let chunk;
while (null !== (chunk = r.read()))
- results.push(chunk + '');
+ results.push(String(chunk));
}
r.on('readable', flow);
r.on('end', function() {
diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js
index 6e59d2d178..f9cbfa8d26 100644
--- a/test/parallel/test-stream2-transform.js
+++ b/test/parallel/test-stream2-transform.js
@@ -344,7 +344,7 @@ test('passthrough event emission', function(t) {
t.equal(emits, 1);
t.equal(pt.read(5).toString(), 'foogb');
- t.equal(pt.read(5) + '', 'null');
+ t.equal(String(pt.read(5)), 'null');
console.error('need emit 1');
diff --git a/test/parallel/test-stream2-writable.js b/test/parallel/test-stream2-writable.js
index c983a26c40..c046194d6b 100644
--- a/test/parallel/test-stream2-writable.js
+++ b/test/parallel/test-stream2-writable.js
@@ -228,7 +228,7 @@ test('write callbacks', function(t) {
callbacks._called[i] = chunk;
}];
}).reduce(function(set, x) {
- set['callback-' + x[0]] = x[1];
+ set[`callback-${x[0]}`] = x[1];
return set;
}, {});
callbacks._called = [];
@@ -246,7 +246,7 @@ test('write callbacks', function(t) {
});
chunks.forEach(function(chunk, i) {
- tw.write(chunk, callbacks['callback-' + i]);
+ tw.write(chunk, callbacks[`callback-${i}`]);
});
tw.end();
});
diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js
index af88b809b8..8de0f7ba16 100644
--- a/test/parallel/test-string-decoder.js
+++ b/test/parallel/test-string-decoder.js
@@ -167,7 +167,7 @@ function test(encoding, input, expected, singleSequence) {
function unicodeEscape(str) {
let r = '';
for (let i = 0; i < str.length; i++) {
- r += '\\u' + str.charCodeAt(i).toString(16);
+ r += `\\u${str.charCodeAt(i).toString(16)}`;
}
return r;
}
diff --git a/test/parallel/test-tcp-wrap-listen.js b/test/parallel/test-tcp-wrap-listen.js
index 687d11a911..7502969c96 100644
--- a/test/parallel/test-tcp-wrap-listen.js
+++ b/test/parallel/test-tcp-wrap-listen.js
@@ -40,7 +40,7 @@ server.onconnection = (err, client) => {
assert.strictEqual(returnCode, 0);
client.pendingWrites.push(req);
- console.log('client.writeQueueSize: ' + client.writeQueueSize);
+ console.log(`client.writeQueueSize: ${client.writeQueueSize}`);
// 11 bytes should flush
assert.strictEqual(0, client.writeQueueSize);
@@ -57,7 +57,7 @@ server.onconnection = (err, client) => {
assert.strictEqual(client, client_);
assert.strictEqual(req, req_);
- console.log('client.writeQueueSize: ' + client.writeQueueSize);
+ console.log(`client.writeQueueSize: ${client.writeQueueSize}`);
assert.strictEqual(0, client.writeQueueSize);
maybeCloseClient();
diff --git a/test/parallel/test-timers-ordering.js b/test/parallel/test-timers-ordering.js
index b3388cc9be..06346c6b2f 100644
--- a/test/parallel/test-timers-ordering.js
+++ b/test/parallel/test-timers-ordering.js
@@ -32,15 +32,14 @@ let last_ts = 0;
function f(i) {
if (i <= N) {
// check order
- assert.strictEqual(i, last_i + 1, 'order is broken: ' + i + ' != ' +
- last_i + ' + 1');
+ assert.strictEqual(i, last_i + 1, `order is broken: ${i} != ${last_i} + 1`);
last_i = i;
// check that this iteration is fired at least 1ms later than the previous
const now = Timer.now();
console.log(i, now);
assert(now >= last_ts + 1,
- 'current ts ' + now + ' < prev ts ' + last_ts + ' + 1');
+ `current ts ${now} < prev ts ${last_ts} + 1`);
last_ts = now;
// schedule next iteration
diff --git a/test/parallel/test-tls-0-dns-altname.js b/test/parallel/test-tls-0-dns-altname.js
index ab7141c952..7ac40eeda1 100644
--- a/test/parallel/test-tls-0-dns-altname.js
+++ b/test/parallel/test-tls-0-dns-altname.js
@@ -34,8 +34,8 @@ const tls = require('tls');
const fs = require('fs');
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/0-dns/0-dns-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/0-dns/0-dns-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/0-dns/0-dns-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/0-dns/0-dns-cert.pem`)
}, function(c) {
c.once('data', function() {
c.destroy();
diff --git a/test/parallel/test-tls-alert-handling.js b/test/parallel/test-tls-alert-handling.js
index 699b1acfc4..5268f520f1 100644
--- a/test/parallel/test-tls-alert-handling.js
+++ b/test/parallel/test-tls-alert-handling.js
@@ -16,7 +16,7 @@ const net = require('net');
const fs = require('fs');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-alert.js b/test/parallel/test-tls-alert.js
index d65f26d9ec..d12d45f529 100644
--- a/test/parallel/test-tls-alert.js
+++ b/test/parallel/test-tls-alert.js
@@ -40,7 +40,7 @@ const spawn = require('child_process').spawn;
let success = false;
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-alpn-server-client.js b/test/parallel/test-tls-alpn-server-client.js
index 9199d94679..6dc14d78f2 100644
--- a/test/parallel/test-tls-alpn-server-client.js
+++ b/test/parallel/test-tls-alpn-server-client.js
@@ -17,7 +17,7 @@ const fs = require('fs');
const tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-ca-concat.js b/test/parallel/test-tls-ca-concat.js
index 0c1908049b..81559a420c 100644
--- a/test/parallel/test-tls-ca-concat.js
+++ b/test/parallel/test-tls-ca-concat.js
@@ -12,7 +12,7 @@ const {
connect({
client: {
checkServerIdentity: (servername, cert) => { },
- ca: keys.agent1.cert + '\n' + keys.agent6.ca,
+ ca: `${keys.agent1.cert}\n${keys.agent6.ca}`,
},
server: {
cert: keys.agent6.cert,
diff --git a/test/parallel/test-tls-client-destroy-soon.js b/test/parallel/test-tls-client-destroy-soon.js
index 66e37ca15f..8d1f3e9023 100644
--- a/test/parallel/test-tls-client-destroy-soon.js
+++ b/test/parallel/test-tls-client-destroy-soon.js
@@ -36,8 +36,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
const big = Buffer.alloc(2 * 1024 * 1024, 'Y');
diff --git a/test/parallel/test-tls-client-getephemeralkeyinfo.js b/test/parallel/test-tls-client-getephemeralkeyinfo.js
index 7d68046de9..f3da64ed37 100644
--- a/test/parallel/test-tls-client-getephemeralkeyinfo.js
+++ b/test/parallel/test-tls-client-getephemeralkeyinfo.js
@@ -9,8 +9,8 @@ if (!common.hasCrypto) {
const tls = require('tls');
const fs = require('fs');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`);
let ntests = 0;
let nsuccess = 0;
@@ -18,7 +18,7 @@ let nsuccess = 0;
function loadDHParam(n) {
let path = common.fixturesDir;
if (n !== 'error') path += '/keys';
- return fs.readFileSync(path + '/dh' + n + '.pem');
+ return fs.readFileSync(`${path}/dh${n}.pem`);
}
const cipherlist = {
diff --git a/test/parallel/test-tls-client-mindhsize.js b/test/parallel/test-tls-client-mindhsize.js
index a2b480f51e..0ab0d2bf10 100644
--- a/test/parallel/test-tls-client-mindhsize.js
+++ b/test/parallel/test-tls-client-mindhsize.js
@@ -9,8 +9,8 @@ if (!common.hasCrypto) {
const tls = require('tls');
const fs = require('fs');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`);
let nsuccess = 0;
let nerror = 0;
@@ -18,7 +18,7 @@ let nerror = 0;
function loadDHParam(n) {
let path = common.fixturesDir;
if (n !== 'error') path += '/keys';
- return fs.readFileSync(path + '/dh' + n + '.pem');
+ return fs.readFileSync(`${path}/dh${n}.pem`);
}
function test(size, err, next) {
diff --git a/test/parallel/test-tls-client-resume.js b/test/parallel/test-tls-client-resume.js
index cf7846a06f..aa23f3331b 100644
--- a/test/parallel/test-tls-client-resume.js
+++ b/test/parallel/test-tls-client-resume.js
@@ -36,8 +36,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
// create server
diff --git a/test/parallel/test-tls-client-verify.js b/test/parallel/test-tls-client-verify.js
index 926cf79b9d..bdd5667a5e 100644
--- a/test/parallel/test-tls-client-verify.js
+++ b/test/parallel/test-tls-client-verify.js
@@ -65,7 +65,7 @@ const testCases =
];
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
@@ -105,7 +105,7 @@ function testServers(index, servers, clientOptions, cb) {
const authorized = client.authorized ||
hosterr.test(client.authorizationError);
- console.error('expected: ' + ok + ' authed: ' + authorized);
+ console.error(`expected: ${ok} authed: ${authorized}`);
assert.strictEqual(ok, authorized);
server.close();
diff --git a/test/parallel/test-tls-close-error.js b/test/parallel/test-tls-close-error.js
index 897391c2e0..978f765950 100644
--- a/test/parallel/test-tls-close-error.js
+++ b/test/parallel/test-tls-close-error.js
@@ -12,8 +12,8 @@ const tls = require('tls');
const fs = require('fs');
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
}, function(c) {
}).listen(0, common.mustCall(function() {
const c = tls.connect(this.address().port, common.mustNotCall());
diff --git a/test/parallel/test-tls-close-notify.js b/test/parallel/test-tls-close-notify.js
index 9737c80eff..625909c9c5 100644
--- a/test/parallel/test-tls-close-notify.js
+++ b/test/parallel/test-tls-close-notify.js
@@ -31,8 +31,8 @@ const tls = require('tls');
const fs = require('fs');
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
}, function(c) {
// Send close-notify without shutting down TCP socket
if (c._handle.shutdownSSL() !== 1)
diff --git a/test/parallel/test-tls-cnnic-whitelist.js b/test/parallel/test-tls-cnnic-whitelist.js
index 398fcddf16..a33e631ddf 100644
--- a/test/parallel/test-tls-cnnic-whitelist.js
+++ b/test/parallel/test-tls-cnnic-whitelist.js
@@ -13,7 +13,7 @@ const fs = require('fs');
const path = require('path');
function filenamePEM(n) {
- return path.join(common.fixturesDir, 'keys', n + '.pem');
+ return path.join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-connect-pipe.js b/test/parallel/test-tls-connect-pipe.js
index 464a19ebd3..836471a0c5 100644
--- a/test/parallel/test-tls-connect-pipe.js
+++ b/test/parallel/test-tls-connect-pipe.js
@@ -31,8 +31,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
common.refreshTmpDir();
diff --git a/test/parallel/test-tls-connect-simple.js b/test/parallel/test-tls-connect-simple.js
index 7b04c7a5dc..7e0d1b462b 100644
--- a/test/parallel/test-tls-connect-simple.js
+++ b/test/parallel/test-tls-connect-simple.js
@@ -33,8 +33,8 @@ const fs = require('fs');
let serverConnected = 0;
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = tls.Server(options, common.mustCall(function(socket) {
diff --git a/test/parallel/test-tls-connect-stream-writes.js b/test/parallel/test-tls-connect-stream-writes.js
index 2f4eebf229..637e54f535 100644
--- a/test/parallel/test-tls-connect-stream-writes.js
+++ b/test/parallel/test-tls-connect-stream-writes.js
@@ -12,9 +12,9 @@ const stream = require('stream');
const net = require('net');
const cert_dir = common.fixturesDir;
-const options = { key: fs.readFileSync(cert_dir + '/test_key.pem'),
- cert: fs.readFileSync(cert_dir + '/test_cert.pem'),
- ca: [ fs.readFileSync(cert_dir + '/test_ca.pem') ],
+const options = { key: fs.readFileSync(`${cert_dir}/test_key.pem`),
+ cert: fs.readFileSync(`${cert_dir}/test_cert.pem`),
+ ca: [ fs.readFileSync(`${cert_dir}/test_ca.pem`) ],
ciphers: 'AES256-GCM-SHA384' };
const content = 'hello world';
const recv_bufs = [];
diff --git a/test/parallel/test-tls-delayed-attach-error.js b/test/parallel/test-tls-delayed-attach-error.js
index a4f88fd8a2..35da6d0e42 100644
--- a/test/parallel/test-tls-delayed-attach-error.js
+++ b/test/parallel/test-tls-delayed-attach-error.js
@@ -12,8 +12,8 @@ const net = require('net');
const bonkers = Buffer.alloc(1024, 42);
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = net.createServer(common.mustCall(function(c) {
diff --git a/test/parallel/test-tls-delayed-attach.js b/test/parallel/test-tls-delayed-attach.js
index b8203581e2..fa8baa81f8 100644
--- a/test/parallel/test-tls-delayed-attach.js
+++ b/test/parallel/test-tls-delayed-attach.js
@@ -36,8 +36,8 @@ const sent = 'hello world';
let received = '';
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = net.createServer(function(c) {
diff --git a/test/parallel/test-tls-dhe.js b/test/parallel/test-tls-dhe.js
index cfb1557cba..2f86e82be7 100644
--- a/test/parallel/test-tls-dhe.js
+++ b/test/parallel/test-tls-dhe.js
@@ -38,8 +38,8 @@ const tls = require('tls');
const spawn = require('child_process').spawn;
const fs = require('fs');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`);
let nsuccess = 0;
let ntests = 0;
const ciphers = 'DHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
@@ -51,7 +51,7 @@ common.expectWarning('SecurityWarning',
function loadDHParam(n) {
let path = common.fixturesDir;
if (n !== 'error') path += '/keys';
- return fs.readFileSync(path + '/dh' + n + '.pem');
+ return fs.readFileSync(`${path}/dh${n}.pem`);
}
function test(keylen, expectedCipher, cb) {
@@ -88,7 +88,7 @@ function test(keylen, expectedCipher, cb) {
client.stdout.on('end', function() {
// DHE key length can be checked -brief option in s_client but it
// is only supported in openssl 1.0.2 so we cannot check it.
- const reg = new RegExp('Cipher : ' + expectedCipher);
+ const reg = new RegExp(`Cipher : ${expectedCipher}`);
if (reg.test(out)) {
nsuccess++;
server.close();
diff --git a/test/parallel/test-tls-ecdh-disable.js b/test/parallel/test-tls-ecdh-disable.js
index 011d45173f..732ebe4d1b 100644
--- a/test/parallel/test-tls-ecdh-disable.js
+++ b/test/parallel/test-tls-ecdh-disable.js
@@ -39,8 +39,8 @@ const exec = require('child_process').exec;
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`),
ciphers: 'ECDHE-RSA-RC4-SHA',
ecdhCurve: false
};
@@ -48,8 +48,8 @@ const options = {
const server = tls.createServer(options, common.mustNotCall());
server.listen(0, '127.0.0.1', common.mustCall(function() {
- let cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
- ` -connect 127.0.0.1:${this.address().port}`;
+ let cmd = `"${common.opensslCli}" s_client -cipher ${
+ options.ciphers} -connect 127.0.0.1:${this.address().port}`;
// for the performance and stability issue in s_client on Windows
if (common.isWindows)
diff --git a/test/parallel/test-tls-ecdh.js b/test/parallel/test-tls-ecdh.js
index 9b8662b075..32e77456bd 100644
--- a/test/parallel/test-tls-ecdh.js
+++ b/test/parallel/test-tls-ecdh.js
@@ -39,8 +39,8 @@ const exec = require('child_process').exec;
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`),
ciphers: '-ALL:ECDHE-RSA-AES128-SHA256',
ecdhCurve: 'prime256v1'
};
@@ -52,8 +52,8 @@ const server = tls.createServer(options, common.mustCall(function(conn) {
}));
server.listen(0, '127.0.0.1', common.mustCall(function() {
- let cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
- ` -connect 127.0.0.1:${this.address().port}`;
+ let cmd = `"${common.opensslCli}" s_client -cipher ${
+ options.ciphers} -connect 127.0.0.1:${this.address().port}`;
// for the performance and stability issue in s_client on Windows
if (common.isWindows)
diff --git a/test/parallel/test-tls-env-bad-extra-ca.js b/test/parallel/test-tls-env-bad-extra-ca.js
index c472789659..12e4e3a4d9 100644
--- a/test/parallel/test-tls-env-bad-extra-ca.js
+++ b/test/parallel/test-tls-env-bad-extra-ca.js
@@ -19,7 +19,7 @@ if (process.env.CHILD) {
const env = {
CHILD: 'yes',
- NODE_EXTRA_CA_CERTS: common.fixturesDir + '/no-such-file-exists',
+ NODE_EXTRA_CA_CERTS: `${common.fixturesDir}/no-such-file-exists`,
};
const opts = {
diff --git a/test/parallel/test-tls-env-extra-ca.js b/test/parallel/test-tls-env-extra-ca.js
index 47ced80e25..4580f1579f 100644
--- a/test/parallel/test-tls-env-extra-ca.js
+++ b/test/parallel/test-tls-env-extra-ca.js
@@ -25,8 +25,8 @@ if (process.env.CHILD) {
}
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
};
const server = tls.createServer(options, function(s) {
@@ -36,7 +36,7 @@ const server = tls.createServer(options, function(s) {
const env = {
CHILD: 'yes',
PORT: this.address().port,
- NODE_EXTRA_CA_CERTS: common.fixturesDir + '/keys/ca1-cert.pem',
+ NODE_EXTRA_CA_CERTS: `${common.fixturesDir}/keys/ca1-cert.pem`,
};
fork(__filename, {env: env}).on('exit', common.mustCall(function(status) {
diff --git a/test/parallel/test-tls-fast-writing.js b/test/parallel/test-tls-fast-writing.js
index e0f6062da0..05722d8959 100644
--- a/test/parallel/test-tls-fast-writing.js
+++ b/test/parallel/test-tls-fast-writing.js
@@ -32,9 +32,9 @@ const tls = require('tls');
const fs = require('fs');
const dir = common.fixturesDir;
-const options = { key: fs.readFileSync(dir + '/test_key.pem'),
- cert: fs.readFileSync(dir + '/test_cert.pem'),
- ca: [ fs.readFileSync(dir + '/test_ca.pem') ] };
+const options = { key: fs.readFileSync(`${dir}/test_key.pem`),
+ cert: fs.readFileSync(`${dir}/test_cert.pem`),
+ ca: [ fs.readFileSync(`${dir}/test_ca.pem`) ] };
const server = tls.createServer(options, onconnection);
let gotChunk = false;
diff --git a/test/parallel/test-tls-friendly-error-message.js b/test/parallel/test-tls-friendly-error-message.js
index bba2422bd7..c476fb20fe 100644
--- a/test/parallel/test-tls-friendly-error-message.js
+++ b/test/parallel/test-tls-friendly-error-message.js
@@ -31,8 +31,8 @@ const tls = require('tls');
const fs = require('fs');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`);
tls.createServer({ key: key, cert: cert }, common.mustCall(function(conn) {
conn.end();
diff --git a/test/parallel/test-tls-getcipher.js b/test/parallel/test-tls-getcipher.js
index 0330aa2085..d2c5b9eab4 100644
--- a/test/parallel/test-tls-getcipher.js
+++ b/test/parallel/test-tls-getcipher.js
@@ -33,8 +33,8 @@ const fs = require('fs');
const cipher_list = ['AES128-SHA256', 'AES256-SHA256'];
const cipher_version_pattern = /TLS|SSL/;
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`),
ciphers: cipher_list.join(':'),
honorCipherOrder: true
};
diff --git a/test/parallel/test-tls-getprotocol.js b/test/parallel/test-tls-getprotocol.js
index b8a2c48f89..393b8fb3fe 100644
--- a/test/parallel/test-tls-getprotocol.js
+++ b/test/parallel/test-tls-getprotocol.js
@@ -17,8 +17,8 @@ const clientConfigs = [
];
const serverConfig = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
const server = tls.createServer(serverConfig, common.mustCall(function() {
diff --git a/test/parallel/test-tls-handshake-error.js b/test/parallel/test-tls-handshake-error.js
index ef192ef225..3bd74baa97 100644
--- a/test/parallel/test-tls-handshake-error.js
+++ b/test/parallel/test-tls-handshake-error.js
@@ -12,8 +12,8 @@ const tls = require('tls');
const fs = require('fs');
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
rejectUnauthorized: true
}, function(c) {
}).listen(0, common.mustCall(function() {
diff --git a/test/parallel/test-tls-hello-parser-failure.js b/test/parallel/test-tls-hello-parser-failure.js
index 4d3a1b40fb..a6e272aa2a 100644
--- a/test/parallel/test-tls-hello-parser-failure.js
+++ b/test/parallel/test-tls-hello-parser-failure.js
@@ -35,8 +35,8 @@ const net = require('net');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/test_key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`)
};
const bonkers = Buffer.alloc(1024 * 1024, 42);
diff --git a/test/parallel/test-tls-honorcipherorder.js b/test/parallel/test-tls-honorcipherorder.js
index fdfc303146..a6d51d5dfe 100644
--- a/test/parallel/test-tls-honorcipherorder.js
+++ b/test/parallel/test-tls-honorcipherorder.js
@@ -23,8 +23,8 @@ process.on('exit', function() {
function test(honorCipherOrder, clientCipher, expectedCipher, cb) {
const soptions = {
secureProtocol: SSL_Method,
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`),
ciphers: 'AES256-SHA256:AES128-GCM-SHA256:AES128-SHA256:' +
'ECDHE-RSA-AES128-GCM-SHA256',
honorCipherOrder: !!honorCipherOrder
diff --git a/test/parallel/test-tls-interleave.js b/test/parallel/test-tls-interleave.js
index 1f33a7b097..b978e30d8b 100644
--- a/test/parallel/test-tls-interleave.js
+++ b/test/parallel/test-tls-interleave.js
@@ -33,9 +33,9 @@ const tls = require('tls');
const fs = require('fs');
const dir = common.fixturesDir;
-const options = { key: fs.readFileSync(dir + '/test_key.pem'),
- cert: fs.readFileSync(dir + '/test_cert.pem'),
- ca: [ fs.readFileSync(dir + '/test_ca.pem') ] };
+const options = { key: fs.readFileSync(`${dir}/test_key.pem`),
+ cert: fs.readFileSync(`${dir}/test_cert.pem`),
+ ca: [ fs.readFileSync(`${dir}/test_ca.pem`) ] };
const writes = [
'some server data',
diff --git a/test/parallel/test-tls-invoke-queued.js b/test/parallel/test-tls-invoke-queued.js
index ee9851c135..ca6e3aa506 100644
--- a/test/parallel/test-tls-invoke-queued.js
+++ b/test/parallel/test-tls-invoke-queued.js
@@ -35,8 +35,8 @@ const fs = require('fs');
let received = '';
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
}, function(c) {
c._write('hello ', null, function() {
c._write('world!', null, function() {
diff --git a/test/parallel/test-tls-js-stream.js b/test/parallel/test-tls-js-stream.js
index 4e7cf61870..6553d6862d 100644
--- a/test/parallel/test-tls-js-stream.js
+++ b/test/parallel/test-tls-js-stream.js
@@ -18,8 +18,8 @@ const connected = {
};
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
}, function(c) {
console.log('new client');
connected.server++;
diff --git a/test/parallel/test-tls-junk-closes-server.js b/test/parallel/test-tls-junk-closes-server.js
index 5037758dfb..a1ffb32c24 100644
--- a/test/parallel/test-tls-junk-closes-server.js
+++ b/test/parallel/test-tls-junk-closes-server.js
@@ -32,8 +32,8 @@ const fs = require('fs');
const net = require('net');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
const server = tls.createServer(options, common.mustNotCall());
diff --git a/test/parallel/test-tls-key-mismatch.js b/test/parallel/test-tls-key-mismatch.js
index f741732492..ac261122ea 100644
--- a/test/parallel/test-tls-key-mismatch.js
+++ b/test/parallel/test-tls-key-mismatch.js
@@ -33,8 +33,8 @@ 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'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
assert.throws(function() {
diff --git a/test/parallel/test-tls-max-send-fragment.js b/test/parallel/test-tls-max-send-fragment.js
index eec998f249..86ee1a4f14 100644
--- a/test/parallel/test-tls-max-send-fragment.js
+++ b/test/parallel/test-tls-max-send-fragment.js
@@ -36,8 +36,8 @@ let received = 0;
const maxChunk = 768;
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
}, function(c) {
// Lower and upper limits
assert(!c.setMaxSendFragment(511));
diff --git a/test/parallel/test-tls-multi-key.js b/test/parallel/test-tls-multi-key.js
index aa245c3a1a..6158f7d405 100644
--- a/test/parallel/test-tls-multi-key.js
+++ b/test/parallel/test-tls-multi-key.js
@@ -32,12 +32,12 @@ const fs = require('fs');
const options = {
key: [
- fs.readFileSync(common.fixturesDir + '/keys/ec-key.pem'),
- fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
+ fs.readFileSync(`${common.fixturesDir}/keys/ec-key.pem`),
+ fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
],
cert: [
- fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
- fs.readFileSync(common.fixturesDir + '/keys/ec-cert.pem')
+ fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
+ fs.readFileSync(`${common.fixturesDir}/keys/ec-cert.pem`)
]
};
diff --git a/test/parallel/test-tls-no-rsa-key.js b/test/parallel/test-tls-no-rsa-key.js
index 37d517f4df..60ac0ab148 100644
--- a/test/parallel/test-tls-no-rsa-key.js
+++ b/test/parallel/test-tls-no-rsa-key.js
@@ -32,8 +32,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/ec-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/ec-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/ec-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/ec-cert.pem`)
};
const server = tls.createServer(options, function(conn) {
diff --git a/test/parallel/test-tls-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js
index e7ee788a35..2c2c51eb9b 100644
--- a/test/parallel/test-tls-no-sslv3.js
+++ b/test/parallel/test-tls-no-sslv3.js
@@ -16,14 +16,14 @@ if (common.opensslCli === false) {
return;
}
-const cert = fs.readFileSync(common.fixturesDir + '/test_cert.pem');
-const key = fs.readFileSync(common.fixturesDir + '/test_key.pem');
+const cert = fs.readFileSync(`${common.fixturesDir}/test_cert.pem`);
+const key = fs.readFileSync(`${common.fixturesDir}/test_key.pem`);
const server = tls.createServer({ cert: cert, key: key }, common.mustNotCall());
const errors = [];
let stderr = '';
server.listen(0, '127.0.0.1', function() {
- const address = this.address().address + ':' + this.address().port;
+ const address = `${this.address().address}:${this.address().port}`;
const args = ['s_client',
'-ssl3',
'-connect', address];
diff --git a/test/parallel/test-tls-npn-server-client.js b/test/parallel/test-tls-npn-server-client.js
index ec73bbcc50..8c566d66a6 100644
--- a/test/parallel/test-tls-npn-server-client.js
+++ b/test/parallel/test-tls-npn-server-client.js
@@ -38,7 +38,7 @@ const tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-on-empty-socket.js b/test/parallel/test-tls-on-empty-socket.js
index 84e27c5dd3..38537fd640 100644
--- a/test/parallel/test-tls-on-empty-socket.js
+++ b/test/parallel/test-tls-on-empty-socket.js
@@ -14,8 +14,8 @@ const net = require('net');
let out = '';
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
}, function(c) {
c.end('hello');
}).listen(0, function() {
diff --git a/test/parallel/test-tls-over-http-tunnel.js b/test/parallel/test-tls-over-http-tunnel.js
index cc02c0bbc2..638886e92e 100644
--- a/test/parallel/test-tls-over-http-tunnel.js
+++ b/test/parallel/test-tls-over-http-tunnel.js
@@ -35,8 +35,8 @@ const http = require('http');
let gotRequest = false;
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`);
const options = {
key: key,
diff --git a/test/parallel/test-tls-pause.js b/test/parallel/test-tls-pause.js
index 1160de5954..a08b435f67 100644
--- a/test/parallel/test-tls-pause.js
+++ b/test/parallel/test-tls-pause.js
@@ -69,7 +69,7 @@ server.listen(0, function() {
return process.nextTick(send);
}
sent += bufSize;
- console.error('sent: ' + sent);
+ console.error(`sent: ${sent}`);
resumed = true;
client.resume();
console.error('resumed', client);
@@ -82,7 +82,7 @@ server.listen(0, function() {
console.error('received', received);
console.error('sent', sent);
if (received >= sent) {
- console.error('received: ' + received);
+ console.error(`received: ${received}`);
client.end();
server.close();
}
diff --git a/test/parallel/test-tls-regr-gh-5108.js b/test/parallel/test-tls-regr-gh-5108.js
index 6371bb5213..6f4392007b 100644
--- a/test/parallel/test-tls-regr-gh-5108.js
+++ b/test/parallel/test-tls-regr-gh-5108.js
@@ -11,8 +11,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
diff --git a/test/parallel/test-tls-request-timeout.js b/test/parallel/test-tls-request-timeout.js
index 411c09aa69..c529d972d2 100644
--- a/test/parallel/test-tls-request-timeout.js
+++ b/test/parallel/test-tls-request-timeout.js
@@ -32,8 +32,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = tls.Server(options, common.mustCall(function(socket) {
diff --git a/test/parallel/test-tls-retain-handle-no-abort.js b/test/parallel/test-tls-retain-handle-no-abort.js
index 43b3709fd5..a3a2aebcd6 100644
--- a/test/parallel/test-tls-retain-handle-no-abort.js
+++ b/test/parallel/test-tls-retain-handle-no-abort.js
@@ -14,8 +14,8 @@ const util = require('util');
const sent = 'hello world';
const serverOptions = {
isServer: true,
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
let ssl = null;
diff --git a/test/parallel/test-tls-securepair-fiftharg.js b/test/parallel/test-tls-securepair-fiftharg.js
index c79b5cbede..2b69ce88f4 100644
--- a/test/parallel/test-tls-securepair-fiftharg.js
+++ b/test/parallel/test-tls-securepair-fiftharg.js
@@ -11,8 +11,8 @@ const fs = require('fs');
const tls = require('tls');
const sslcontext = tls.createSecureContext({
- cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'),
- key: fs.readFileSync(common.fixturesDir + '/test_key.pem')
+ cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
+ key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
});
let catchedServername;
@@ -23,7 +23,7 @@ const pair = tls.createSecurePair(sslcontext, true, false, false, {
});
// captured traffic from browser's request to https://www.google.com
-const sslHello = fs.readFileSync(common.fixturesDir + '/google_ssl_hello.bin');
+const sslHello = fs.readFileSync(`${common.fixturesDir}/google_ssl_hello.bin`);
pair.encrypted.write(sslHello);
diff --git a/test/parallel/test-tls-securepair-server.js b/test/parallel/test-tls-securepair-server.js
index ea6c8e98a9..00e8cd591f 100644
--- a/test/parallel/test-tls-securepair-server.js
+++ b/test/parallel/test-tls-securepair-server.js
@@ -44,11 +44,11 @@ const key = fs.readFileSync(join(common.fixturesDir, 'agent.key')).toString();
const cert = fs.readFileSync(join(common.fixturesDir, 'agent.crt')).toString();
function log(a) {
- console.error('***server*** ' + a);
+ console.error(`***server*** ${a}`);
}
const server = net.createServer(common.mustCall(function(socket) {
- log('connection fd=' + socket.fd);
+ log(`connection fd=${socket.fd}`);
const sslcontext = tls.createSecureContext({key: key, cert: cert});
sslcontext.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA');
@@ -70,7 +70,7 @@ const server = net.createServer(common.mustCall(function(socket) {
});
pair.cleartext.on('data', function(data) {
- log('read bytes ' + data.length);
+ log(`read bytes ${data.length}`);
pair.cleartext.write(data);
});
diff --git a/test/parallel/test-tls-server-connection-server.js b/test/parallel/test-tls-server-connection-server.js
index e33c80be07..1c54eb635a 100644
--- a/test/parallel/test-tls-server-connection-server.js
+++ b/test/parallel/test-tls-server-connection-server.js
@@ -11,8 +11,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = tls.createServer(options, function(s) {
diff --git a/test/parallel/test-tls-server-verify.js b/test/parallel/test-tls-server-verify.js
index a80475bb65..2d7323dc5a 100644
--- a/test/parallel/test-tls-server-verify.js
+++ b/test/parallel/test-tls-server-verify.js
@@ -134,7 +134,7 @@ const spawn = require('child_process').spawn;
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
@@ -154,13 +154,13 @@ function runClient(prefix, port, options, cb) {
// - Certificate, but not signed by CA.
// - Certificate signed by CA.
- const args = ['s_client', '-connect', '127.0.0.1:' + port];
+ const args = ['s_client', '-connect', `127.0.0.1:${port}`];
// for the performance issue in s_client on Windows
if (common.isWindows)
args.push('-no_rand_screen');
- console.log(prefix + ' connecting with', options.name);
+ console.log(`${prefix} connecting with`, options.name);
switch (options.name) {
case 'agent1':
@@ -201,7 +201,7 @@ function runClient(prefix, port, options, cb) {
break;
default:
- throw new Error(prefix + 'Unknown agent name');
+ throw new Error(`${prefix}Unknown agent name`);
}
// To test use: openssl s_client -connect localhost:8000
@@ -218,7 +218,7 @@ function runClient(prefix, port, options, cb) {
out += d;
if (!goodbye && /_unauthed/g.test(out)) {
- console.error(prefix + ' * unauthed');
+ console.error(`${prefix} * unauthed`);
goodbye = true;
client.kill();
authed = false;
@@ -226,7 +226,7 @@ function runClient(prefix, port, options, cb) {
}
if (!goodbye && /_authed/g.test(out)) {
- console.error(prefix + ' * authed');
+ console.error(`${prefix} * authed`);
goodbye = true;
client.kill();
authed = true;
@@ -237,17 +237,21 @@ function runClient(prefix, port, options, cb) {
//client.stdout.pipe(process.stdout);
client.on('exit', function(code) {
- //assert.strictEqual(0, code, prefix + options.name +
- // ": s_client exited with error code " + code);
+ //assert.strictEqual(
+ // 0, code,
+ // `${prefix}${options.name}: s_client exited with error code ${code}`);
if (options.shouldReject) {
- assert.strictEqual(true, rejected, prefix + options.name +
- ' NOT rejected, but should have been');
+ assert.strictEqual(
+ true, rejected,
+ `${prefix}${options.name} NOT rejected, but should have been`);
} else {
- assert.strictEqual(false, rejected, prefix + options.name +
- ' rejected, but should NOT have been');
- assert.strictEqual(options.shouldAuth, authed, prefix +
- options.name + ' authed is ' + authed +
- ' but should have been ' + options.shouldAuth);
+ assert.strictEqual(
+ false, rejected,
+ `${prefix}${options.name} rejected, but should NOT have been`);
+ assert.strictEqual(
+ options.shouldAuth, authed,
+ `${prefix}${options.name} authed is ${authed} but should have been ${
+ options.shouldAuth}`);
}
cb();
@@ -258,11 +262,11 @@ function runClient(prefix, port, options, cb) {
// Run the tests
let successfulTests = 0;
function runTest(port, testIndex) {
- const prefix = testIndex + ' ';
+ const prefix = `${testIndex} `;
const tcase = testCases[testIndex];
if (!tcase) return;
- console.error(prefix + "Running '%s'", tcase.title);
+ console.error(`${prefix}Running '%s'`, tcase.title);
const cas = tcase.CAs.map(loadPEM);
@@ -297,7 +301,7 @@ function runTest(port, testIndex) {
if (tcase.renegotiate && !renegotiated) {
renegotiated = true;
setTimeout(function() {
- console.error(prefix + '- connected, renegotiating');
+ console.error(`${prefix}- connected, renegotiating`);
c.write('\n_renegotiating\n');
return c.renegotiate({
requestCert: true,
@@ -312,11 +316,11 @@ function runTest(port, testIndex) {
}
if (c.authorized) {
- console.error(prefix + '- authed connection: ' +
- c.getPeerCertificate().subject.CN);
+ console.error(`${prefix}- authed connection: ${
+ c.getPeerCertificate().subject.CN}`);
c.write('\n_authed\n');
} else {
- console.error(prefix + '- unauthed connection: %s', c.authorizationError);
+ console.error(`${prefix}- unauthed connection: %s`, c.authorizationError);
c.write('\n_unauthed\n');
}
});
@@ -324,7 +328,7 @@ function runTest(port, testIndex) {
function runNextClient(clientIndex) {
const options = tcase.clients[clientIndex];
if (options) {
- runClient(prefix + clientIndex + ' ', port, options, function() {
+ runClient(`${prefix}${clientIndex} `, port, options, function() {
runNextClient(clientIndex + 1);
});
} else {
@@ -337,14 +341,14 @@ function runTest(port, testIndex) {
server.listen(port, function() {
port = server.address().port;
if (tcase.debug) {
- console.error(prefix + 'TLS server running on port ' + port);
+ console.error(`${prefix}TLS server running on port ${port}`);
} else {
if (tcase.renegotiate) {
runNextClient(0);
} else {
let clientsCompleted = 0;
for (let i = 0; i < tcase.clients.length; i++) {
- runClient(prefix + i + ' ', port, tcase.clients[i], function() {
+ runClient(`${prefix}${i} `, port, tcase.clients[i], function() {
clientsCompleted++;
if (clientsCompleted === tcase.clients.length) {
server.close();
diff --git a/test/parallel/test-tls-set-ciphers.js b/test/parallel/test-tls-set-ciphers.js
index 720c051589..4b7923891b 100644
--- a/test/parallel/test-tls-set-ciphers.js
+++ b/test/parallel/test-tls-set-ciphers.js
@@ -38,8 +38,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`),
ciphers: 'DES-CBC3-SHA'
};
@@ -55,8 +55,8 @@ const server = tls.createServer(options, common.mustCall(function(conn) {
}));
server.listen(0, '127.0.0.1', function() {
- let cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
- ` -connect 127.0.0.1:${this.address().port}`;
+ let cmd = `"${common.opensslCli}" s_client -cipher ${
+ options.ciphers} -connect 127.0.0.1:${this.address().port}`;
// for the performance and stability issue in s_client on Windows
if (common.isWindows)
diff --git a/test/parallel/test-tls-set-encoding.js b/test/parallel/test-tls-set-encoding.js
index 079d3f2c01..7023132d73 100644
--- a/test/parallel/test-tls-set-encoding.js
+++ b/test/parallel/test-tls-set-encoding.js
@@ -33,8 +33,8 @@ const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
// Contains a UTF8 only character
diff --git a/test/parallel/test-tls-sni-option.js b/test/parallel/test-tls-sni-option.js
index 24050a99df..9a4398063b 100644
--- a/test/parallel/test-tls-sni-option.js
+++ b/test/parallel/test-tls-sni-option.js
@@ -37,7 +37,7 @@ if (!common.hasCrypto) {
const tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-sni-server-client.js b/test/parallel/test-tls-sni-server-client.js
index 158dcf8397..de8314eea9 100644
--- a/test/parallel/test-tls-sni-server-client.js
+++ b/test/parallel/test-tls-sni-server-client.js
@@ -37,7 +37,7 @@ if (!common.hasCrypto) {
const tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-socket-close.js b/test/parallel/test-tls-socket-close.js
index 617062a4f2..a5d7410f49 100644
--- a/test/parallel/test-tls-socket-close.js
+++ b/test/parallel/test-tls-socket-close.js
@@ -10,8 +10,8 @@ const tls = require('tls');
const fs = require('fs');
const net = require('net');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`);
let tlsSocket;
// tls server
diff --git a/test/parallel/test-tls-socket-destroy.js b/test/parallel/test-tls-socket-destroy.js
index 27651f8ec7..0a72ac6232 100644
--- a/test/parallel/test-tls-socket-destroy.js
+++ b/test/parallel/test-tls-socket-destroy.js
@@ -11,8 +11,8 @@ const fs = require('fs');
const net = require('net');
const tls = require('tls');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`);
const secureContext = tls.createSecureContext({ key, cert });
const server = net.createServer(common.mustCall((conn) => {
diff --git a/test/parallel/test-tls-startcom-wosign-whitelist.js b/test/parallel/test-tls-startcom-wosign-whitelist.js
index fd20e0d8e9..21dbb55c15 100644
--- a/test/parallel/test-tls-startcom-wosign-whitelist.js
+++ b/test/parallel/test-tls-startcom-wosign-whitelist.js
@@ -13,7 +13,7 @@ const path = require('path');
let finished = 0;
function filenamePEM(n) {
- return path.join(common.fixturesDir, 'keys', n + '.pem');
+ return path.join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-starttls-server.js b/test/parallel/test-tls-starttls-server.js
index ca6a00b25d..d588fee34d 100644
--- a/test/parallel/test-tls-starttls-server.js
+++ b/test/parallel/test-tls-starttls-server.js
@@ -15,8 +15,8 @@ const fs = require('fs');
const net = require('net');
const tls = require('tls');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`);
const server = net.createServer(common.mustCall((s) => {
const tlsSocket = new tls.TLSSocket(s, {
diff --git a/test/parallel/test-tls-ticket.js b/test/parallel/test-tls-ticket.js
index 5907719aeb..b2541e06ab 100644
--- a/test/parallel/test-tls-ticket.js
+++ b/test/parallel/test-tls-ticket.js
@@ -45,8 +45,8 @@ function createServer() {
let previousKey = null;
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
ticketKeys: keys
}, function(c) {
serverLog.push(id);
diff --git a/test/parallel/test-tls-timeout-server-2.js b/test/parallel/test-tls-timeout-server-2.js
index 362b83ca46..bf6dcc385b 100644
--- a/test/parallel/test-tls-timeout-server-2.js
+++ b/test/parallel/test-tls-timeout-server-2.js
@@ -32,8 +32,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = tls.createServer(options, common.mustCall(function(cleartext) {
diff --git a/test/parallel/test-tls-timeout-server.js b/test/parallel/test-tls-timeout-server.js
index c676cccacb..b43bb169f3 100644
--- a/test/parallel/test-tls-timeout-server.js
+++ b/test/parallel/test-tls-timeout-server.js
@@ -32,8 +32,8 @@ const net = require('net');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
handshakeTimeout: 50
};
diff --git a/test/parallel/test-tls-two-cas-one-string.js b/test/parallel/test-tls-two-cas-one-string.js
index 3d4703ce9d..35d0a01f05 100644
--- a/test/parallel/test-tls-two-cas-one-string.js
+++ b/test/parallel/test-tls-two-cas-one-string.js
@@ -35,5 +35,5 @@ function test(ca, next) {
}
const array = [ca1, ca2];
-const string = ca1 + '\n' + ca2;
+const string = `${ca1}\n${ca2}`;
test(array, () => test(string, common.noop));
diff --git a/test/parallel/test-tls-wrap-timeout.js b/test/parallel/test-tls-wrap-timeout.js
index d66e1f2d68..64fbcc7fc7 100644
--- a/test/parallel/test-tls-wrap-timeout.js
+++ b/test/parallel/test-tls-wrap-timeout.js
@@ -12,8 +12,8 @@ const net = require('net');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = tls.createServer(options, common.mustCall((c) => {
diff --git a/test/parallel/test-url-format.js b/test/parallel/test-url-format.js
index 077ced5a07..af5632d0b6 100644
--- a/test/parallel/test-url-format.js
+++ b/test/parallel/test-url-format.js
@@ -251,10 +251,8 @@ for (const u in formatTests) {
const actual = url.format(u);
const actualObj = url.format(formatTests[u]);
assert.strictEqual(actual, expect,
- 'wonky format(' + u + ') == ' + expect +
- '\nactual:' + actual);
+ `wonky format(${u}) == ${expect}\nactual:${actual}`);
assert.strictEqual(actualObj, expect,
- 'wonky format(' + JSON.stringify(formatTests[u]) +
- ') == ' + expect +
- '\nactual: ' + actualObj);
+ `wonky format(${JSON.stringify(formatTests[u])}) == ${
+ expect}\nactual: ${actualObj}`);
}
diff --git a/test/parallel/test-url-parse-format.js b/test/parallel/test-url-parse-format.js
index 7da6a7167b..0e12fe5251 100644
--- a/test/parallel/test-url-parse-format.js
+++ b/test/parallel/test-url-parse-format.js
@@ -919,5 +919,5 @@ for (const u in parseTests) {
actual = url.format(parseTests[u]);
assert.strictEqual(actual, expected,
- 'format(' + u + ') == ' + u + '\nactual:' + actual);
+ `format(${u}) == ${u}\nactual:${actual}`);
}
diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js
index d44bb8b870..c8ee5f72ed 100644
--- a/test/parallel/test-util-inspect.js
+++ b/test/parallel/test-util-inspect.js
@@ -514,8 +514,7 @@ assert.doesNotThrow(() => {
const withoutColor = util.inspect(input, false, 0, false);
const withColor = util.inspect(input, false, 0, true);
- const expect = '\u001b[' + color[0] + 'm' + withoutColor +
- '\u001b[' + color[1] + 'm';
+ const expect = `\u001b[${color[0]}m${withoutColor}\u001b[${color[1]}m`;
assert.strictEqual(
withColor,
expect,
diff --git a/test/parallel/test-vm-cached-data.js b/test/parallel/test-vm-cached-data.js
index f18bf9f540..59cdca9c99 100644
--- a/test/parallel/test-vm-cached-data.js
+++ b/test/parallel/test-vm-cached-data.js
@@ -32,7 +32,7 @@ function produce(source, count) {
console.log(data);
`, source]);
- assert.strictEqual(out.status, 0, out.stderr + '');
+ assert.strictEqual(out.status, 0, String(out.stderr));
return Buffer.from(out.stdout.toString(), 'base64');
}
diff --git a/test/parallel/test-vm-create-context-accessors.js b/test/parallel/test-vm-create-context-accessors.js
index 291e27e8ae..39fc5c4eec 100644
--- a/test/parallel/test-vm-create-context-accessors.js
+++ b/test/parallel/test-vm-create-context-accessors.js
@@ -38,7 +38,7 @@ Object.defineProperty(ctx, 'setter', {
val = _val;
},
get: function() {
- return 'ok=' + val;
+ return `ok=${val}`;
}
});
diff --git a/test/parallel/test-vm-debug-context.js b/test/parallel/test-vm-debug-context.js
index bc87e4d619..b558906dca 100644
--- a/test/parallel/test-vm-debug-context.js
+++ b/test/parallel/test-vm-debug-context.js
@@ -77,7 +77,7 @@ assert.strictEqual(vm.runInDebugContext(undefined), undefined);
// Can set listeners and breakpoints on a single line file
{
const Debug = vm.runInDebugContext('Debug');
- const fn = require(common.fixturesDir + '/exports-function-with-param');
+ const fn = require(`${common.fixturesDir}/exports-function-with-param`);
let called = false;
Debug.setListener(function(event, state, data) {
@@ -94,7 +94,7 @@ assert.strictEqual(vm.runInDebugContext(undefined), undefined);
// See https://github.com/nodejs/node/issues/1190, fatal errors should not
// crash the process.
-const script = common.fixturesDir + '/vm-run-in-debug-context.js';
+const script = `${common.fixturesDir}/vm-run-in-debug-context.js`;
let proc = spawn(process.execPath, [script]);
const data = [];
proc.stdout.on('data', common.mustNotCall());
diff --git a/test/parallel/test-vm-syntax-error-stderr.js b/test/parallel/test-vm-syntax-error-stderr.js
index af0df0202f..805bea0f87 100644
--- a/test/parallel/test-vm-syntax-error-stderr.js
+++ b/test/parallel/test-vm-syntax-error-stderr.js
@@ -13,7 +13,7 @@ const p = child_process.spawn(process.execPath, [
]);
p.stdout.on('data', function(data) {
- assert.fail('Unexpected stdout data: ' + data);
+ assert.fail(`Unexpected stdout data: ${data}`);
});
let output = '';
diff --git a/test/parallel/test-zlib-convenience-methods.js b/test/parallel/test-zlib-convenience-methods.js
index 78bb105906..5612575d8e 100644
--- a/test/parallel/test-zlib-convenience-methods.js
+++ b/test/parallel/test-zlib-convenience-methods.js
@@ -66,8 +66,8 @@ for (const [type, expect] of [
}));
{
- const compressed = zlib[method[0] + 'Sync'](expect, opts);
- const decompressed = zlib[method[1] + 'Sync'](compressed, opts);
+ const compressed = zlib[`${method[0]}Sync`](expect, opts);
+ const decompressed = zlib[`${method[1]}Sync`](compressed, opts);
assert.strictEqual(decompressed.toString(), expectStr,
`Should get original string after ${method[0]}Sync/` +
`${method[1]}Sync ${type} with options.`);
@@ -75,8 +75,8 @@ for (const [type, expect] of [
{
- const compressed = zlib[method[0] + 'Sync'](expect);
- const decompressed = zlib[method[1] + 'Sync'](compressed);
+ const compressed = zlib[`${method[0]}Sync`](expect);
+ const decompressed = zlib[`${method[1]}Sync`](compressed);
assert.strictEqual(decompressed.toString(), expectStr,
`Should get original string after ${method[0]}Sync/` +
`${method[1]}Sync ${type} without options.`);
diff --git a/test/parallel/test-zlib-deflate-constructors.js b/test/parallel/test-zlib-deflate-constructors.js
index d34bb869e3..01930b2720 100644
--- a/test/parallel/test-zlib-deflate-constructors.js
+++ b/test/parallel/test-zlib-deflate-constructors.js
@@ -88,7 +88,7 @@ assert.doesNotThrow(
// Throws if opt.strategy is the wrong type.
assert.throws(
- () => { new zlib.Deflate({strategy: '' + zlib.constants.Z_RLE }); },
+ () => { new zlib.Deflate({ strategy: String(zlib.constants.Z_RLE) }); },
/^TypeError: Invalid strategy: 3$/
);
diff --git a/test/parallel/test-zlib-from-gzip.js b/test/parallel/test-zlib-from-gzip.js
index 97070dcba4..a69df87a97 100644
--- a/test/parallel/test-zlib-from-gzip.js
+++ b/test/parallel/test-zlib-from-gzip.js
@@ -46,6 +46,6 @@ out.on('close', function() {
const actual = fs.readFileSync(outputFile);
assert.strictEqual(actual.length, expect.length, 'length should match');
for (let i = 0, l = actual.length; i < l; i++) {
- assert.strictEqual(actual[i], expect[i], 'byte[' + i + ']');
+ assert.strictEqual(actual[i], expect[i], `byte[${i}]`);
}
});
diff --git a/test/parallel/test-zlib-invalid-input.js b/test/parallel/test-zlib-invalid-input.js
index 19be116934..f6d3a85b95 100644
--- a/test/parallel/test-zlib-invalid-input.js
+++ b/test/parallel/test-zlib-invalid-input.js
@@ -47,14 +47,14 @@ const unzips = [ zlib.Unzip(),
zlib.InflateRaw() ];
const hadError = [];
unzips.forEach(function(uz, i) {
- console.error('Error for ' + uz.constructor.name);
+ console.error(`Error for ${uz.constructor.name}`);
uz.on('error', function(er) {
console.error('Error event', er);
hadError[i] = true;
});
uz.on('end', function(er) {
- throw new Error('end event should not be emitted ' + uz.constructor.name);
+ throw new Error(`end event should not be emitted ${uz.constructor.name}`);
});
// this will trigger error event
diff --git a/test/parallel/test-zlib.js b/test/parallel/test-zlib.js
index 5ca11a7dac..75a2794a20 100644
--- a/test/parallel/test-zlib.js
+++ b/test/parallel/test-zlib.js
@@ -184,10 +184,8 @@ Object.keys(tests).forEach(function(file) {
// verify that the same exact buffer comes out the other end.
buf.on('data', function(c) {
- const msg = file + ' ' +
- chunkSize + ' ' +
- JSON.stringify(opts) + ' ' +
- Def.name + ' -> ' + Inf.name;
+ const msg = `${file} ${chunkSize} ${
+ JSON.stringify(opts)} ${Def.name} -> ${Inf.name}`;
let ok = true;
const testNum = ++done;
let i;
@@ -199,17 +197,17 @@ Object.keys(tests).forEach(function(file) {
}
}
if (ok) {
- console.log('ok ' + (testNum) + ' ' + msg);
+ console.log(`ok ${testNum} ${msg}`);
} else {
- console.log('not ok ' + (testNum) + ' ' + msg);
+ console.log(`not ok ${testNum} msg`);
console.log(' ...');
- console.log(' testfile: ' + file);
- console.log(' type: ' + Def.name + ' -> ' + Inf.name);
- console.log(' position: ' + i);
- console.log(' options: ' + JSON.stringify(opts));
- console.log(' expect: ' + test[i]);
- console.log(' actual: ' + c[i]);
- console.log(' chunkSize: ' + chunkSize);
+ console.log(` testfile: ${file}`);
+ console.log(` type: ${Def.name} -> ${Inf.name}`);
+ console.log(` position: ${i}`);
+ console.log(` options: ${JSON.stringify(opts)}`);
+ console.log(` expect: ${test[i]}`);
+ console.log(` actual: ${c[i]}`);
+ console.log(` chunkSize: ${chunkSize}`);
console.log(' ---');
}
});
@@ -227,7 +225,7 @@ Object.keys(tests).forEach(function(file) {
});
process.on('exit', function(code) {
- console.log('1..' + done);
- assert.strictEqual(done, total, (total - done) + ' tests left unfinished');
+ console.log(`1..${done}`);
+ assert.strictEqual(done, total, `${total - done} tests left unfinished`);
assert.strictEqual(failures, 0, 'some test failures');
});
diff --git a/test/pseudo-tty/no_dropped_stdio.js b/test/pseudo-tty/no_dropped_stdio.js
index f7d9625c62..6aa721df35 100644
--- a/test/pseudo-tty/no_dropped_stdio.js
+++ b/test/pseudo-tty/no_dropped_stdio.js
@@ -6,10 +6,10 @@ const common = require('../common');
// 1000 bytes wrapped at 50 columns
// \n turns into a double-byte character
// (48 + {2}) * 20 = 1000
-let out = ('o'.repeat(48) + '\n').repeat(20);
+let out = `${'o'.repeat(48)}\n`.repeat(20);
// Add the remaining 24 bytes and terminate with an 'O'.
// This results in 1025 bytes, just enough to overflow the 1kb OS X TTY buffer.
-out += 'o'.repeat(24) + 'O';
+out += `${'o'.repeat(24)}O`;
// In AIX, the child exits even before the python parent
// can setup the readloop. Provide a reasonable delay.
diff --git a/test/pseudo-tty/no_interleaved_stdio.js b/test/pseudo-tty/no_interleaved_stdio.js
index ba3989f938..3f1e7b5fb1 100644
--- a/test/pseudo-tty/no_interleaved_stdio.js
+++ b/test/pseudo-tty/no_interleaved_stdio.js
@@ -6,10 +6,10 @@ const common = require('../common');
// 1000 bytes wrapped at 50 columns
// \n turns into a double-byte character
// (48 + {2}) * 20 = 1000
-let out = ('o'.repeat(48) + '\n').repeat(20);
+let out = `${'o'.repeat(48)}\n`.repeat(20);
// Add the remaining 24 bytes and terminate with an 'O'.
// This results in 1025 bytes, just enough to overflow the 1kb OS X TTY buffer.
-out += 'o'.repeat(24) + 'O';
+out += `${'o'.repeat(24)}O`;
const err = '__This is some stderr__';
diff --git a/test/pummel/test-abort-fatal-error.js b/test/pummel/test-abort-fatal-error.js
index 7b8a1d07ca..6208a13261 100644
--- a/test/pummel/test-abort-fatal-error.js
+++ b/test/pummel/test-abort-fatal-error.js
@@ -30,7 +30,7 @@ if (common.isWindows) {
const exec = require('child_process').exec;
-let cmdline = 'ulimit -c 0; ' + process.execPath;
+let cmdline = `ulimit -c 0; ${process.execPath}`;
cmdline += ' --max-old-space-size=4 --max-semi-space-size=1';
cmdline += ' -e "a = []; for (i = 0; i < 1e9; i++) { a.push({}) }"';
diff --git a/test/pummel/test-child-process-spawn-loop.js b/test/pummel/test-child-process-spawn-loop.js
index 355fa70728..fdff82a6e4 100644
--- a/test/pummel/test-child-process-spawn-loop.js
+++ b/test/pummel/test-child-process-spawn-loop.js
@@ -30,7 +30,7 @@ const N = 40;
let finished = false;
function doSpawn(i) {
- const child = spawn('python', ['-c', 'print ' + SIZE + ' * "C"']);
+ const child = spawn('python', ['-c', `print ${SIZE} * "C"`]);
let count = 0;
child.stdout.setEncoding('ascii');
@@ -39,7 +39,7 @@ function doSpawn(i) {
});
child.stderr.on('data', (chunk) => {
- console.log('stderr: ' + chunk);
+ console.log(`stderr: ${chunk}`);
});
child.on('close', () => {
diff --git a/test/pummel/test-dtrace-jsstack.js b/test/pummel/test-dtrace-jsstack.js
index 2c8611d11d..2f2506031d 100644
--- a/test/pummel/test-dtrace-jsstack.js
+++ b/test/pummel/test-dtrace-jsstack.js
@@ -40,7 +40,7 @@ const stalloogle = (str) => {
};
const bagnoogle = (arg0, arg1) => {
- stalloogle(arg0 + ' is ' + arg1 + ' except that it is read-only');
+ stalloogle(`${arg0} is ${arg1} except that it is read-only`);
};
let done = false;
@@ -59,13 +59,13 @@ const spawn = require('child_process').spawn;
* when we call getloadavg() -- with the implicit assumption that our
* deepest function is the only caller of os.loadavg().
*/
-const dtrace = spawn('dtrace', [ '-qwn', 'syscall::getloadavg:entry/pid == ' +
- process.pid + '/{ustack(100, 8192); exit(0); }' ]);
+const dtrace = spawn('dtrace', [ '-qwn', `syscall::getloadavg:entry/pid == ${
+ process.pid}/{ustack(100, 8192); exit(0); }` ]);
let output = '';
dtrace.stderr.on('data', function(data) {
- console.log('dtrace: ' + data);
+ console.log(`dtrace: ${data}`);
});
dtrace.stdout.on('data', function(data) {
@@ -74,7 +74,7 @@ dtrace.stdout.on('data', function(data) {
dtrace.on('exit', function(code) {
if (code !== 0) {
- console.error('dtrace exited with code ' + code);
+ console.error(`dtrace exited with code ${code}`);
process.exit(code);
}
@@ -92,12 +92,12 @@ dtrace.on('exit', function(code) {
const frame = line.substr(line.indexOf(sentinel) + sentinel.length);
const top = frames.shift();
- assert.strictEqual(frame.indexOf(top), 0, 'unexpected frame where ' +
- top + ' was expected');
+ assert.strictEqual(frame.indexOf(top), 0,
+ `unexpected frame where ${top} was expected`);
}
assert.strictEqual(frames.length, 0,
- 'did not find expected frame ' + frames[0]);
+ `did not find expected frame ${frames[0]}`);
process.exit(0);
});
diff --git a/test/pummel/test-exec.js b/test/pummel/test-exec.js
index 8047a2dc15..29852528ee 100644
--- a/test/pummel/test-exec.js
+++ b/test/pummel/test-exec.js
@@ -40,13 +40,13 @@ let error_count = 0;
exec(
- '"' + process.execPath + '" -p -e process.versions',
+ `"${process.execPath}" -p -e process.versions`,
function(err, stdout, stderr) {
if (err) {
error_count++;
- console.log('error!: ' + err.code);
- console.log('stdout: ' + JSON.stringify(stdout));
- console.log('stderr: ' + JSON.stringify(stderr));
+ console.log(`error!: ${err.code}`);
+ console.log(`stdout: ${JSON.stringify(stdout)}`);
+ console.log(`stderr: ${JSON.stringify(stderr)}`);
assert.strictEqual(false, err.killed);
} else {
success_count++;
@@ -64,9 +64,9 @@ exec('thisisnotavalidcommand', function(err, stdout, stderr) {
assert.notStrictEqual(err.code, 0);
assert.strictEqual(false, err.killed);
assert.strictEqual(null, err.signal);
- console.log('error code: ' + err.code);
- console.log('stdout: ' + JSON.stringify(stdout));
- console.log('stderr: ' + JSON.stringify(stderr));
+ console.log(`error code: ${err.code}`);
+ console.log(`stdout: ${JSON.stringify(stdout)}`);
+ console.log(`stderr: ${JSON.stringify(stderr)}`);
} else {
success_count++;
console.dir(stdout);
diff --git a/test/pummel/test-fs-watch-file.js b/test/pummel/test-fs-watch-file.js
index 2e23a93c62..04cfec6b43 100644
--- a/test/pummel/test-fs-watch-file.js
+++ b/test/pummel/test-fs-watch-file.js
@@ -141,7 +141,7 @@ assert.doesNotThrow(
function a() {
++watchSeenFour;
assert.strictEqual(1, watchSeenFour);
- fs.unwatchFile('.' + path.sep + filenameFour, a);
+ fs.unwatchFile(`.${path.sep}${filenameFour}`, a);
}
fs.watchFile(filenameFour, a);
}
diff --git a/test/pummel/test-http-client-reconnect-bug.js b/test/pummel/test-http-client-reconnect-bug.js
index 735c91c4a4..656943ec86 100644
--- a/test/pummel/test-http-client-reconnect-bug.js
+++ b/test/pummel/test-http-client-reconnect-bug.js
@@ -37,7 +37,7 @@ server.on('listening', common.mustCall(function() {
const request = client.request('GET', '/', {'host': 'localhost'});
request.end();
request.on('response', function(response) {
- console.log('STATUS: ' + response.statusCode);
+ console.log(`STATUS: ${response.statusCode}`);
});
}));
diff --git a/test/pummel/test-https-ci-reneg-attack.js b/test/pummel/test-https-ci-reneg-attack.js
index 8adaf586f3..6cc8c51fe2 100644
--- a/test/pummel/test-https-ci-reneg-attack.js
+++ b/test/pummel/test-https-ci-reneg-attack.js
@@ -53,8 +53,8 @@ const LIMITS = [0, 1, 2, 3, 5, 10, 16];
function test(next) {
const options = {
- cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'),
- key: fs.readFileSync(common.fixturesDir + '/test_key.pem')
+ cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
+ key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
};
let seenError = false;
@@ -62,7 +62,7 @@ function test(next) {
const server = https.createServer(options, function(req, res) {
const conn = req.connection;
conn.on('error', function(err) {
- console.error('Caught exception: ' + err);
+ console.error(`Caught exception: ${err}`);
assert(/TLS session renegotiation attack/.test(err));
conn.destroy();
seenError = true;
@@ -71,7 +71,7 @@ function test(next) {
});
server.listen(common.PORT, function() {
- const args = ('s_client -connect 127.0.0.1:' + common.PORT).split(' ');
+ const args = (`s_client -connect 127.0.0.1:${common.PORT}`).split(' ');
const child = spawn(common.opensslCli, args);
//child.stdout.pipe(process.stdout);
@@ -86,9 +86,9 @@ function test(next) {
child.stderr.on('data', function(data) {
if (seenError) return;
- handshakes += (('' + data).match(/verify return:1/g) || []).length;
+ handshakes += ((String(data)).match(/verify return:1/g) || []).length;
if (handshakes === 2) spam();
- renegs += (('' + data).match(/RENEGOTIATING/g) || []).length;
+ renegs += ((String(data)).match(/RENEGOTIATING/g) || []).length;
});
child.on('exit', function() {
diff --git a/test/pummel/test-https-large-response.js b/test/pummel/test-https-large-response.js
index 2064851136..17038bf7bd 100644
--- a/test/pummel/test-https-large-response.js
+++ b/test/pummel/test-https-large-response.js
@@ -32,8 +32,8 @@ if (!common.hasCrypto) {
const https = require('https');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
process.stdout.write('build body...');
diff --git a/test/pummel/test-net-pause.js b/test/pummel/test-net-pause.js
index ce8aae49eb..c25f8a0bc1 100644
--- a/test/pummel/test-net-pause.js
+++ b/test/pummel/test-net-pause.js
@@ -52,21 +52,21 @@ server.on('listening', function() {
setTimeout(function() {
chars_recved = recv.length;
- console.log('pause at: ' + chars_recved);
+ console.log(`pause at: ${chars_recved}`);
assert.strictEqual(true, chars_recved > 1);
client.pause();
setTimeout(function() {
- console.log('resume at: ' + chars_recved);
+ console.log(`resume at: ${chars_recved}`);
assert.strictEqual(chars_recved, recv.length);
client.resume();
setTimeout(function() {
chars_recved = recv.length;
- console.log('pause at: ' + chars_recved);
+ console.log(`pause at: ${chars_recved}`);
client.pause();
setTimeout(function() {
- console.log('resume at: ' + chars_recved);
+ console.log(`resume at: ${chars_recved}`);
assert.strictEqual(chars_recved, recv.length);
client.resume();
diff --git a/test/pummel/test-net-pingpong.js b/test/pummel/test-net-pingpong.js
index e862aaa7a5..d88b4f638a 100644
--- a/test/pummel/test-net-pingpong.js
+++ b/test/pummel/test-net-pingpong.js
@@ -40,7 +40,7 @@ function pingPongTest(port, host, on_complete) {
} else if (host == null || host === 'localhost') {
assert(address === '127.0.0.1' || address === '::ffff:127.0.0.1');
} else {
- console.log('host = ' + host + ', remoteAddress = ' + address);
+ console.log(`host = ${host}, remoteAddress = ${address}`);
assert.strictEqual(address, '::1');
}
@@ -49,7 +49,7 @@ function pingPongTest(port, host, on_complete) {
socket.timeout = 0;
socket.on('data', function(data) {
- console.log('server got: ' + JSON.stringify(data));
+ console.log(`server got: ${JSON.stringify(data)}`);
assert.strictEqual('open', socket.readyState);
assert.strictEqual(true, count <= N);
if (/PING/.exec(data)) {
@@ -80,7 +80,7 @@ function pingPongTest(port, host, on_complete) {
});
client.on('data', function(data) {
- console.log('client got: ' + data);
+ console.log(`client got: ${data}`);
assert.strictEqual('PONG', data);
count += 1;
diff --git a/test/pummel/test-net-throttle.js b/test/pummel/test-net-throttle.js
index bc67abda0a..c273853362 100644
--- a/test/pummel/test-net-throttle.js
+++ b/test/pummel/test-net-throttle.js
@@ -32,13 +32,13 @@ let npauses = 0;
console.log('build big string');
const body = 'C'.repeat(N);
-console.log('start server on port ' + common.PORT);
+console.log(`start server on port ${common.PORT}`);
const server = net.createServer(function(connection) {
connection.write(body.slice(0, part_N));
connection.write(body.slice(part_N, 2 * part_N));
assert.strictEqual(false, connection.write(body.slice(2 * part_N, N)));
- console.log('bufferSize: ' + connection.bufferSize, 'expecting', N);
+ console.log(`bufferSize: ${connection.bufferSize}`, 'expecting', N);
assert.ok(0 <= connection.bufferSize &&
connection._writableState.length <= N);
connection.end();
@@ -50,7 +50,7 @@ server.listen(common.PORT, function() {
client.setEncoding('ascii');
client.on('data', function(d) {
chars_recved += d.length;
- console.log('got ' + chars_recved);
+ console.log(`got ${chars_recved}`);
if (!paused) {
client.pause();
npauses += 1;
diff --git a/test/pummel/test-net-timeout.js b/test/pummel/test-net-timeout.js
index 15e070c979..c170be6306 100644
--- a/test/pummel/test-net-timeout.js
+++ b/test/pummel/test-net-timeout.js
@@ -55,7 +55,7 @@ const echo_server = net.createServer(function(socket) {
});
echo_server.listen(common.PORT, function() {
- console.log('server listening at ' + common.PORT);
+ console.log(`server listening at ${common.PORT}`);
const client = net.createConnection(common.PORT);
client.setEncoding('UTF8');
@@ -74,7 +74,7 @@ echo_server.listen(common.PORT, function() {
}, 500);
if (exchanges === 5) {
- console.log('wait for timeout - should come in ' + timeout + ' ms');
+ console.log(`wait for timeout - should come in ${timeout} ms`);
starttime = new Date();
console.dir(starttime);
}
@@ -101,7 +101,7 @@ process.on('exit', function() {
assert.ok(timeouttime != null);
const diff = timeouttime - starttime;
- console.log('diff = ' + diff);
+ console.log(`diff = ${diff}`);
assert.ok(timeout < diff);
diff --git a/test/pummel/test-net-timeout2.js b/test/pummel/test-net-timeout2.js
index f66acff4fb..93fbe7bfab 100644
--- a/test/pummel/test-net-timeout2.js
+++ b/test/pummel/test-net-timeout2.js
@@ -42,7 +42,7 @@ const server = net.createServer(function(socket) {
}
if (socket.writable) {
- socket.write(Date.now() + '\n');
+ socket.write(`${Date.now()}\n`);
}
}, 1000);
});
diff --git a/test/pummel/test-net-write-callbacks.js b/test/pummel/test-net-write-callbacks.js
index 6d8ab0b0ff..7c3df30f58 100644
--- a/test/pummel/test-net-write-callbacks.js
+++ b/test/pummel/test-net-write-callbacks.js
@@ -44,11 +44,11 @@ function makeCallback(c) {
let called = false;
return function() {
if (called)
- throw new Error('called callback #' + c + ' more than once');
+ throw new Error(`called callback #${c} more than once`);
called = true;
if (c < lastCalled)
- throw new Error('callbacks out of order. last=' + lastCalled +
- ' current=' + c);
+ throw new Error(
+ `callbacks out of order. last=${lastCalled} current=${c}`);
lastCalled = c;
cbcount++;
};
diff --git a/test/pummel/test-regress-GH-814_2.js b/test/pummel/test-regress-GH-814_2.js
index c272196846..5161fdb270 100644
--- a/test/pummel/test-regress-GH-814_2.js
+++ b/test/pummel/test-regress-GH-814_2.js
@@ -28,7 +28,7 @@ const assert = require('assert');
const fs = require('fs');
const testFileName = require('path').join(common.tmpDir, 'GH-814_test.txt');
const testFD = fs.openSync(testFileName, 'w');
-console.error(testFileName + '\n');
+console.error(`${testFileName}\n`);
const tailProc = require('child_process').spawn('tail', ['-f', testFileName]);
diff --git a/test/pummel/test-regress-GH-892.js b/test/pummel/test-regress-GH-892.js
index c6f52a676a..1a7e3ad1cb 100644
--- a/test/pummel/test-regress-GH-892.js
+++ b/test/pummel/test-regress-GH-892.js
@@ -81,8 +81,8 @@ function makeRequest() {
const serverOptions = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
let uploadCount = 0;
diff --git a/test/pummel/test-timers.js b/test/pummel/test-timers.js
index 44dcf0be14..7e0492a642 100644
--- a/test/pummel/test-timers.js
+++ b/test/pummel/test-timers.js
@@ -38,7 +38,7 @@ setTimeout(common.mustCall(function() {
const diff = endtime - starttime;
assert.ok(diff > 0);
- console.error('diff: ' + diff);
+ console.error(`diff: ${diff}`);
assert.strictEqual(true, 1000 - WINDOW < diff && diff < 1000 + WINDOW);
}), 1000);
@@ -53,7 +53,7 @@ setInterval(function() {
const diff = endtime - starttime;
assert.ok(diff > 0);
- console.error('diff: ' + diff);
+ console.error(`diff: ${diff}`);
const t = interval_count * 1000;
diff --git a/test/pummel/test-tls-ci-reneg-attack.js b/test/pummel/test-tls-ci-reneg-attack.js
index 0eda7d8449..4bbaacebf4 100644
--- a/test/pummel/test-tls-ci-reneg-attack.js
+++ b/test/pummel/test-tls-ci-reneg-attack.js
@@ -52,15 +52,15 @@ const LIMITS = [0, 1, 2, 3, 5, 10, 16];
function test(next) {
const options = {
- cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'),
- key: fs.readFileSync(common.fixturesDir + '/test_key.pem')
+ cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
+ key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
};
let seenError = false;
const server = tls.createServer(options, function(conn) {
conn.on('error', function(err) {
- console.error('Caught exception: ' + err);
+ console.error(`Caught exception: ${err}`);
assert(/TLS session renegotiation attack/.test(err));
conn.destroy();
seenError = true;
@@ -69,7 +69,7 @@ function test(next) {
});
server.listen(common.PORT, function() {
- const args = ('s_client -connect 127.0.0.1:' + common.PORT).split(' ');
+ const args = (`s_client -connect 127.0.0.1:${common.PORT}`).split(' ');
const child = spawn(common.opensslCli, args);
//child.stdout.pipe(process.stdout);
@@ -84,9 +84,9 @@ function test(next) {
child.stderr.on('data', function(data) {
if (seenError) return;
- handshakes += (('' + data).match(/verify return:1/g) || []).length;
+ handshakes += ((String(data)).match(/verify return:1/g) || []).length;
if (handshakes === 2) spam();
- renegs += (('' + data).match(/RENEGOTIATING/g) || []).length;
+ renegs += ((String(data)).match(/RENEGOTIATING/g) || []).length;
});
child.on('exit', function() {
diff --git a/test/pummel/test-tls-connect-memleak.js b/test/pummel/test-tls-connect-memleak.js
index d445f39fb6..d4797e1940 100644
--- a/test/pummel/test-tls-connect-memleak.js
+++ b/test/pummel/test-tls-connect-memleak.js
@@ -40,8 +40,8 @@ assert.strictEqual(
);
tls.createServer({
- cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'),
- key: fs.readFileSync(common.fixturesDir + '/test_key.pem')
+ cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
+ key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
}).listen(common.PORT);
{
diff --git a/test/pummel/test-tls-securepair-client.js b/test/pummel/test-tls-securepair-client.js
index 93e774a44a..32e6252c2e 100644
--- a/test/pummel/test-tls-securepair-client.js
+++ b/test/pummel/test-tls-securepair-client.js
@@ -166,15 +166,15 @@ function test(keyfn, certfn, check, next) {
});
pair.encrypted.on('error', function(err) {
- console.log('encrypted error: ' + err);
+ console.log(`encrypted error: ${err}`);
});
s.on('error', function(err) {
- console.log('socket error: ' + err);
+ console.log(`socket error: ${err}`);
});
pair.on('error', function(err) {
- console.log('secure error: ' + err);
+ console.log(`secure error: ${err}`);
});
}
diff --git a/test/pummel/test-tls-server-large-request.js b/test/pummel/test-tls-server-large-request.js
index a88ee5870e..021fb7913b 100644
--- a/test/pummel/test-tls-server-large-request.js
+++ b/test/pummel/test-tls-server-large-request.js
@@ -36,8 +36,8 @@ const util = require('util');
const request = Buffer.from('ABCD'.repeat(1024 * 256 - 1)); // 1mb
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
function Mediator() {
diff --git a/test/pummel/test-tls-session-timeout.js b/test/pummel/test-tls-session-timeout.js
index 5807ae8a94..1bb3592042 100644
--- a/test/pummel/test-tls-session-timeout.js
+++ b/test/pummel/test-tls-session-timeout.js
@@ -81,7 +81,7 @@ function doTest() {
function Client(cb) {
const flags = [
's_client',
- '-connect', 'localhost:' + common.PORT,
+ '-connect', `localhost:${common.PORT}`,
'-sess_in', sessionFileName,
'-sess_out', sessionFileName
];
diff --git a/test/pummel/test-tls-throttle.js b/test/pummel/test-tls-throttle.js
index 55dcdd258a..a9e2442ef2 100644
--- a/test/pummel/test-tls-throttle.js
+++ b/test/pummel/test-tls-throttle.js
@@ -38,8 +38,8 @@ const body = 'hello world\n'.repeat(1024 * 1024);
process.stdout.write('done\n');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
const server = tls.Server(options, common.mustCall(function(socket) {
diff --git a/test/sequential/test-child-process-execsync.js b/test/sequential/test-child-process-execsync.js
index 4c8dd0d0a4..4dc11253c9 100644
--- a/test/sequential/test-child-process-execsync.js
+++ b/test/sequential/test-child-process-execsync.js
@@ -66,7 +66,7 @@ assert.throws(function() {
}, /Command failed: iamabadcommand/);
const msg = 'foobar';
-const msgBuf = Buffer.from(msg + '\n');
+const msgBuf = Buffer.from(`${msg}\n`);
// console.log ends every line with just '\n', even on Windows.
@@ -79,7 +79,7 @@ assert.deepStrictEqual(ret, msgBuf, 'execSync result buffer should match');
ret = execSync(cmd, { encoding: 'utf8' });
-assert.strictEqual(ret, msg + '\n', 'execSync encoding result should match');
+assert.strictEqual(ret, `${msg}\n`, 'execSync encoding result should match');
const args = [
'-e',
@@ -91,7 +91,7 @@ assert.deepStrictEqual(ret, msgBuf);
ret = execFileSync(process.execPath, args, { encoding: 'utf8' });
-assert.strictEqual(ret, msg + '\n',
+assert.strictEqual(ret, `${msg}\n`,
'execFileSync encoding result should match');
// Verify that the cwd option works - GH #7824
diff --git a/test/sequential/test-deprecation-flags.js b/test/sequential/test-deprecation-flags.js
index 156156298f..6bf128ef2c 100644
--- a/test/sequential/test-deprecation-flags.js
+++ b/test/sequential/test-deprecation-flags.js
@@ -23,17 +23,17 @@
const common = require('../common');
const assert = require('assert');
const execFile = require('child_process').execFile;
-const depmod = require.resolve(common.fixturesDir + '/deprecated.js');
+const depmod = require.resolve(`${common.fixturesDir}/deprecated.js`);
const node = process.execPath;
const depUserlandFunction =
- require.resolve(common.fixturesDir + '/deprecated-userland-function.js');
+ require.resolve(`${common.fixturesDir}/deprecated-userland-function.js`);
const depUserlandClass =
- require.resolve(common.fixturesDir + '/deprecated-userland-class.js');
+ require.resolve(`${common.fixturesDir}/deprecated-userland-class.js`);
const depUserlandSubClass =
- require.resolve(common.fixturesDir + '/deprecated-userland-subclass.js');
+ require.resolve(`${common.fixturesDir}/deprecated-userland-subclass.js`);
const normal = [depmod];
const noDep = ['--no-deprecation', depmod];
diff --git a/test/sequential/test-dgram-pingpong.js b/test/sequential/test-dgram-pingpong.js
index 5760024c0c..c97b7872de 100644
--- a/test/sequential/test-dgram-pingpong.js
+++ b/test/sequential/test-dgram-pingpong.js
@@ -15,7 +15,7 @@ function pingPongTest(port, host) {
});
server.on('listening', function() {
- console.log('server listening on ' + port);
+ console.log(`server listening on ${port}`);
const client = dgram.createSocket('udp4');
@@ -30,7 +30,7 @@ function pingPongTest(port, host) {
throw e;
});
- console.log('Client sending to ' + port);
+ console.log(`Client sending to ${port}`);
function clientSend() {
client.send('PING', 0, 4, port, 'localhost');
diff --git a/test/sequential/test-domain-abort-on-uncaught.js b/test/sequential/test-domain-abort-on-uncaught.js
index b3fd99616e..1ee48666e1 100644
--- a/test/sequential/test-domain-abort-on-uncaught.js
+++ b/test/sequential/test-domain-abort-on-uncaught.js
@@ -245,9 +245,10 @@ if (process.argv[2] === 'child') {
const child = child_process.exec(testCmd);
child.on('exit', function onExit(code, signal) {
- assert.strictEqual(code, 0, 'Test at index ' + testIndex +
- ' should have exited with exit code 0 but instead exited with code ' +
- code + ' and signal ' + signal);
+ assert.strictEqual(
+ code, 0, `Test at index ${testIndex
+ } should have exited with exit code 0 but instead exited with code ${
+ code} and signal ${signal}`);
});
});
}
diff --git a/test/sequential/test-https-set-timeout-server.js b/test/sequential/test-https-set-timeout-server.js
index f6dc5fb62f..92619b5b82 100644
--- a/test/sequential/test-https-set-timeout-server.js
+++ b/test/sequential/test-https-set-timeout-server.js
@@ -35,8 +35,8 @@ const fs = require('fs');
const tests = [];
const serverOptions = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
function test(fn) {
diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js
index 0e476bfbad..9d3a1f772c 100644
--- a/test/sequential/test-module-loading.js
+++ b/test/sequential/test-module-loading.js
@@ -189,25 +189,25 @@ try {
require.extensions['.reg'] = require.extensions['.js'];
require.extensions['.reg2'] = require.extensions['.js'];
- assert.strictEqual(require(loadOrder + 'file1').file1, 'file1', msg);
- assert.strictEqual(require(loadOrder + 'file2').file2, 'file2.js', msg);
+ assert.strictEqual(require(`${loadOrder}file1`).file1, 'file1', msg);
+ assert.strictEqual(require(`${loadOrder}file2`).file2, 'file2.js', msg);
try {
- require(loadOrder + 'file3');
+ require(`${loadOrder}file3`);
} catch (e) {
// Not a real .node module, but we know we require'd the right thing.
assert.ok(e.message.replace(/\\/g, '/').match(/file3\.node/));
}
- assert.strictEqual(require(loadOrder + 'file4').file4, 'file4.reg', msg);
- assert.strictEqual(require(loadOrder + 'file5').file5, 'file5.reg2', msg);
- assert.strictEqual(require(loadOrder + 'file6').file6, 'file6/index.js', msg);
+ assert.strictEqual(require(`${loadOrder}file4`).file4, 'file4.reg', msg);
+ assert.strictEqual(require(`${loadOrder}file5`).file5, 'file5.reg2', msg);
+ assert.strictEqual(require(`${loadOrder}file6`).file6, 'file6/index.js', msg);
try {
- require(loadOrder + 'file7');
+ require(`${loadOrder}file7`);
} catch (e) {
assert.ok(e.message.replace(/\\/g, '/').match(/file7\/index\.node/));
}
- assert.strictEqual(require(loadOrder + 'file8').file8, 'file8/index.reg',
+ assert.strictEqual(require(`${loadOrder}file8`).file8, 'file8/index.reg',
msg);
- assert.strictEqual(require(loadOrder + 'file9').file9, 'file9/index.reg2',
+ assert.strictEqual(require(`${loadOrder}file9`).file9, 'file9/index.reg2',
msg);
}
diff --git a/test/sequential/test-net-GH-5504.js b/test/sequential/test-net-GH-5504.js
index 9c60b6f568..0c4d9bc694 100644
--- a/test/sequential/test-net-GH-5504.js
+++ b/test/sequential/test-net-GH-5504.js
@@ -92,7 +92,7 @@ function parent() {
inp.on('data', function(c) {
c = c.trim();
if (!c) return;
- out.write(w + c.split('\n').join('\n' + w) + '\n');
+ out.write(`${w}${c.split('\n').join(`\n${w}`)}\n`);
});
}
}
diff --git a/test/sequential/test-process-warnings.js b/test/sequential/test-process-warnings.js
index 83952a2933..0ab8652f56 100644
--- a/test/sequential/test-process-warnings.js
+++ b/test/sequential/test-process-warnings.js
@@ -3,7 +3,7 @@
const common = require('../common');
const assert = require('assert');
const execFile = require('child_process').execFile;
-const warnmod = require.resolve(common.fixturesDir + '/warnings.js');
+const warnmod = require.resolve(`${common.fixturesDir}/warnings.js`);
const node = process.execPath;
const normal = [warnmod];
diff --git a/test/sequential/test-regress-GH-1697.js b/test/sequential/test-regress-GH-1697.js
index 00117c5286..9d2555705a 100644
--- a/test/sequential/test-regress-GH-1697.js
+++ b/test/sequential/test-regress-GH-1697.js
@@ -29,7 +29,7 @@ if (process.argv[2] === 'server') {
const server = net.createServer(function(conn) {
conn.on('data', function(data) {
- console.log('server received ' + data.length + ' bytes');
+ console.log(`server received ${data.length} bytes`);
});
conn.on('close', function() {
diff --git a/test/sequential/test-regress-GH-4015.js b/test/sequential/test-regress-GH-4015.js
index 12b238bfb4..10857ea6ce 100644
--- a/test/sequential/test-regress-GH-4015.js
+++ b/test/sequential/test-regress-GH-4015.js
@@ -24,8 +24,8 @@ const common = require('../common');
const assert = require('assert');
const exec = require('child_process').exec;
-const cmd = '"' + process.execPath + '" ' +
- '"' + common.fixturesDir + '/test-regress-GH-4015.js"';
+const cmd =
+ `"${process.execPath}" "${common.fixturesDir}/test-regress-GH-4015.js"`;
exec(cmd, function(err, stdout, stderr) {
assert(/RangeError: Maximum call stack size exceeded/.test(stderr));
diff --git a/test/sequential/test-regress-GH-784.js b/test/sequential/test-regress-GH-784.js
index 7176d07ae2..7abc622dbe 100644
--- a/test/sequential/test-regress-GH-784.js
+++ b/test/sequential/test-regress-GH-784.js
@@ -69,7 +69,7 @@ const responses = [];
function afterPing(result) {
responses.push(result);
- console.error('afterPing. responses.length = ' + responses.length);
+ console.error(`afterPing. responses.length = ${responses.length}`);
switch (responses.length) {
case 2:
assert.ok(/ECONNREFUSED/.test(responses[0]));
@@ -130,7 +130,7 @@ function ping() {
let hadError = false;
req.on('error', function(error) {
- console.log('Error making ping req: ' + error);
+ console.log(`Error making ping req: ${error}`);
hadError = true;
assert.ok(!gotEnd);
afterPing(error.message);
diff --git a/test/sequential/test-regress-GH-877.js b/test/sequential/test-regress-GH-877.js
index 014f3b716f..1d09c0007b 100644
--- a/test/sequential/test-regress-GH-877.js
+++ b/test/sequential/test-regress-GH-877.js
@@ -54,9 +54,10 @@ server.listen(common.PORT, '127.0.0.1', function() {
assert.strictEqual(req.agent, agent);
- console.log('Socket: ' + agent.sockets[addrString].length + '/' +
- agent.maxSockets + ' queued: ' + (agent.requests[addrString] ?
- agent.requests[addrString].length : 0));
+ console.log(
+ `Socket: ${agent.sockets[addrString].length}/${
+ agent.maxSockets} queued: ${
+ agent.requests[addrString] ? agent.requests[addrString].length : 0}`);
const agentRequests = agent.requests[addrString] ?
agent.requests[addrString].length : 0;
diff --git a/test/sequential/test-repl-timeout-throw.js b/test/sequential/test-repl-timeout-throw.js
index 6966419556..aa933394b4 100644
--- a/test/sequential/test-repl-timeout-throw.js
+++ b/test/sequential/test-repl-timeout-throw.js
@@ -31,7 +31,7 @@ child.stdout.once('data', function() {
setTimeout(fsTest, 50);
function fsTest() {
const f = JSON.stringify(__filename);
- child.stdin.write('fs.readFile(' + f + ', thrower);\n');
+ child.stdin.write(`fs.readFile(${f}, thrower);\n`);
setTimeout(eeTest, 50);
}
diff --git a/test/sequential/test-require-cache-without-stat.js b/test/sequential/test-require-cache-without-stat.js
index 33a523c287..2c220d44cd 100644
--- a/test/sequential/test-require-cache-without-stat.js
+++ b/test/sequential/test-require-cache-without-stat.js
@@ -46,7 +46,7 @@ fs.stat = function() {
};
// Load the module 'a' and 'http' once. It should become cached.
-require(common.fixturesDir + '/a');
+require(`${common.fixturesDir}/a`);
require('../fixtures/a.js');
require('./../fixtures/a.js');
require('http');
@@ -57,7 +57,7 @@ const counterBefore = counter;
// Now load the module a bunch of times with equivalent paths.
// stat should not be called.
for (let i = 0; i < 100; i++) {
- require(common.fixturesDir + '/a');
+ require(`${common.fixturesDir}/a`);
require('../fixtures/a.js');
require('./../fixtures/a.js');
}
diff --git a/test/sequential/test-stream2-stderr-sync.js b/test/sequential/test-stream2-stderr-sync.js
index 9822d2908e..c5295c0a2f 100644
--- a/test/sequential/test-stream2-stderr-sync.js
+++ b/test/sequential/test-stream2-stderr-sync.js
@@ -29,7 +29,7 @@ function parent() {
const assert = require('assert');
let i = 0;
children.forEach(function(_, c) {
- const child = spawn(process.execPath, [__filename, '' + c]);
+ const child = spawn(process.execPath, [__filename, String(c)]);
let err = '';
child.stderr.on('data', function(c) {
@@ -37,10 +37,10 @@ function parent() {
});
child.on('close', function() {
- assert.strictEqual(err, 'child ' + c + '\nfoo\nbar\nbaz\n');
+ assert.strictEqual(err, `child ${c}\nfoo\nbar\nbaz\n`);
console.log('ok %d child #%d', ++i, c);
if (i === children.length)
- console.log('1..' + i);
+ console.log(`1..${i}`);
});
});
}