diff --git a/test/parallel/test-fs-cp-async-dereference-force-false-silent-fail.mjs b/test/parallel/test-fs-cp-async-dereference-force-false-silent-fail.mjs deleted file mode 100644 index 0c92b3eb627..00000000000 --- a/test/parallel/test-fs-cp-async-dereference-force-false-silent-fail.mjs +++ /dev/null @@ -1,25 +0,0 @@ -// This tests that it does not fail if the same directory is copied to dest -// twice, when dereference is true, and force is false (fails silently). - -import { mustCall, mustNotMutateObjectDeep } from '../common/index.mjs'; -import assert from 'node:assert'; -import { cp, cpSync, lstatSync } from 'node:fs'; -import { join } from 'node:path'; -import { nextdir } from '../common/fs.js'; -import tmpdir from '../common/tmpdir.js'; -import fixtures from '../common/fixtures.js'; - -tmpdir.refresh(); - -const src = fixtures.path('copy/kitchen-sink'); -const dest = nextdir(); -const destFile = join(dest, 'a/b/README2.md'); -cpSync(src, dest, mustNotMutateObjectDeep({ dereference: true, recursive: true })); -cp(src, dest, { - dereference: true, - recursive: true -}, mustCall((err) => { - assert.strictEqual(err, null); - const stat = lstatSync(destFile); - assert(stat.isFile()); -})); diff --git a/test/parallel/test-http-keepalive-client.js b/test/parallel/test-http-keepalive-client.js deleted file mode 100644 index 8482d320268..00000000000 --- a/test/parallel/test-http-keepalive-client.js +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; -const common = require('../common'); -const assert = require('assert'); - -const http = require('http'); - - -let serverSocket = null; -const server = http.createServer(common.mustCallAtLeast((req, res) => { - // They should all come in on the same server socket. - if (serverSocket) { - assert.strictEqual(req.socket, serverSocket); - } else { - serverSocket = req.socket; - } - - res.end(req.url); -})); -server.listen(0, function() { - makeRequest(expectRequests); -}); - -const agent = new http.Agent({ keepAlive: true }); - - -let clientSocket = null; -const expectRequests = 10; -let actualRequests = 0; - - -function makeRequest(n) { - if (n === 0) { - server.close(); - agent.destroy(); - return; - } - - const req = http.request({ - port: server.address().port, - agent: agent, - path: `/${n}` - }); - - req.end(); - - req.on('socket', common.mustCall((sock) => { - if (clientSocket) { - assert.strictEqual(sock, clientSocket); - } else { - clientSocket = sock; - } - })); - - req.on('response', common.mustCall((res) => { - let data = ''; - res.setEncoding('utf8'); - res.on('data', function(c) { - data += c; - }); - res.on('end', common.mustCall(() => { - assert.strictEqual(data, `/${n}`); - setTimeout(function() { - actualRequests++; - makeRequest(n - 1); - }, 1); - })); - })); -} - -process.on('exit', function() { - assert.strictEqual(actualRequests, expectRequests); - console.log('ok'); -}); diff --git a/test/parallel/test-net-connect-buffer2.js b/test/parallel/test-net-connect-buffer2.js deleted file mode 100644 index 933141bc872..00000000000 --- a/test/parallel/test-net-connect-buffer2.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict'; -const common = require('../common'); -const assert = require('assert'); -const net = require('net'); - -const tcp = net.Server(common.mustCall((s) => { - tcp.close(); - - let buf = ''; - s.setEncoding('utf8'); - s.on('data', function(d) { - buf += d; - }); - - s.on('end', common.mustCall(function() { - console.error('SERVER: end', buf); - assert.strictEqual(buf, "L'État, c'est moi"); - s.end(); - })); -})); - -tcp.listen(0, common.mustCall(function() { - const socket = net.Stream({ highWaterMark: 0 }); - - let connected = false; - assert.strictEqual(socket.pending, true); - socket.connect(this.address().port, common.mustCall(() => connected = true)); - - assert.strictEqual(socket.pending, true); - assert.strictEqual(socket.connecting, true); - assert.strictEqual(socket.readyState, 'opening'); - - // Write a string that contains a multi-byte character sequence to test that - // `bytesWritten` is incremented with the # of bytes, not # of characters. - const a = "L'État, c'est "; - const b = 'moi'; - - // We're still connecting at this point so the datagram is first pushed onto - // the connect queue. Make sure that it's not added to `bytesWritten` again - // when the actual write happens. - const r = socket.write(a, common.mustCall((er) => { - console.error('write cb'); - assert.ok(connected); - assert.strictEqual(socket.bytesWritten, Buffer.from(a + b).length); - assert.strictEqual(socket.pending, false); - })); - socket.on('close', common.mustCall(() => { - assert.strictEqual(socket.pending, true); - })); - - assert.strictEqual(socket.bytesWritten, Buffer.from(a).length); - assert.strictEqual(r, false); - socket.end(b); - - assert.strictEqual(socket.readyState, 'opening'); -})); diff --git a/test/parallel/test-net-connect-reset-after-destroy.js b/test/parallel/test-net-connect-reset-after-destroy.js deleted file mode 100644 index 89e459229ab..00000000000 --- a/test/parallel/test-net-connect-reset-after-destroy.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; -const common = require('../common'); -const net = require('net'); -const assert = require('assert'); - -const server = net.createServer(); -server.listen(0, common.mustCall(function() { - const port = server.address().port; - const conn = net.createConnection(port); - server.on('connection', (socket) => { - socket.on('error', common.expectsError({ - code: 'ECONNRESET', - message: 'read ECONNRESET', - name: 'Error' - })); - }); - - conn.on('connect', common.mustCall(function() { - assert.strictEqual(conn, conn.resetAndDestroy().destroy()); - conn.on('error', common.mustNotCall()); - - conn.write(Buffer.from('fzfzfzfzfz'), common.expectsError({ - code: 'ERR_STREAM_DESTROYED', - message: 'Cannot call write after a stream was destroyed', - name: 'Error' - })); - server.close(); - })); -})); diff --git a/test/parallel/test-testpy-env-var-via-comment.js b/test/parallel/test-testpy-env-var-via-comment.js deleted file mode 100644 index fea2e788e17..00000000000 --- a/test/parallel/test-testpy-env-var-via-comment.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -// Env: A_SET_ENV_VAR=A_SET_ENV_VAR_VALUE B_SET_ENV_VAR=B_SET_ENV_VAR_VALUE -// Flags: --test-isolation=none --expose-internals - -require('../common'); -const assert = require('node:assert'); -const { describe, it } = require('node:test'); - - -// This test verifies that the Python test runner can set environment variables -// via comments in the test file, similar to how we set flags via comments. -// Ref: https://github.com/nodejs/node/issues/58179 -describe('testpy env var via comment', () => { - it('should set env var A_SET_ENV_VAR', () => { - assert.strictEqual(process.env.A_SET_ENV_VAR, 'A_SET_ENV_VAR_VALUE'); - }); - it('should set env var B_SET_ENV_VAR', () => { - assert.strictEqual(process.env.B_SET_ENV_VAR, 'B_SET_ENV_VAR_VALUE'); - }); - - it('should interop with flags', () => { - const flag = require('internal/options').getOptionValue('--test-isolation'); - assert.strictEqual(flag, 'none'); - }); -}); diff --git a/test/parallel/test-vm-global-non-writable-properties.js b/test/parallel/test-vm-global-non-writable-properties.js deleted file mode 100644 index 2a2f70ff7ed..00000000000 --- a/test/parallel/test-vm-global-non-writable-properties.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; -// https://github.com/nodejs/node/issues/10223 - -require('../common'); -const assert = require('assert'); -const vm = require('vm'); - -const ctx = vm.createContext(); -vm.runInContext('Object.defineProperty(this, "x", { value: 42 })', ctx); -assert.strictEqual(vm.runInContext('x', ctx), 42); -vm.runInContext('x = 0', ctx); // Does not throw but x... -assert.strictEqual(vm.runInContext('x', ctx), 42); // ...should be unaltered. -assert.throws(() => vm.runInContext('"use strict"; x = 0', ctx), - /Cannot assign to read only property 'x'/); -assert.strictEqual(vm.runInContext('x', ctx), 42); diff --git a/test/pummel/test-buffer-large-size-slowbuffer.js b/test/pummel/test-buffer-large-size-slowbuffer.js deleted file mode 100644 index c4302f7e61b..00000000000 --- a/test/pummel/test-buffer-large-size-slowbuffer.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; -const common = require('../common'); - -// Buffer with size > INT32_MAX -common.skipIf32Bits(); - -const assert = require('node:assert'); -const { Buffer } = require('node:buffer'); - -const size = 2 ** 31; - -let largeBuffer; - -// Test slow Buffer with size larger than integer range -try { - largeBuffer = Buffer.allocUnsafeSlow(size); -} catch (e) { - if ( - e.code === 'ERR_MEMORY_ALLOCATION_FAILED' || - /Array buffer allocation failed/.test(e.message) - ) { - common.skip('insufficient space for slow Buffer allocation'); - } - - throw e; -} - -assert.throws(() => largeBuffer.toString('utf8'), { - code: 'ERR_STRING_TOO_LONG', -});