Repository: nodejs/node
Pull request: test: remove unnecessary assert requiring from tests

@anonrig as per https://github.com/nodejs/node/pull/56983#discussion_r1948279168 🙂 


Changed files:
filename: test/node-api/test_uv_threadpool_size/node-options.js
patch: @@ -16,7 +16,7 @@ const filePath = path.join(__dirname, `./build/${common.buildType}/test_uv_threa
 const code = `
    const { test } = require(${JSON.stringify(filePath)});
    const size = parseInt(process.env.UV_THREADPOOL_SIZE, 10);
-   require('assert').strictEqual(size, 4);
+   assert.strictEqual(size, 4);
    test(size);
  `.trim();
 const child = spawnSync(

filename: test/parallel/test-dotenv-edge-cases.js
patch: @@ -14,7 +14,6 @@ const noFinalNewlineSingleQuotesEnvFilePath = '../fixtures/dotenv/no-final-newli
 describe('.env supports edge cases', () => {
   it('supports multiple declarations, including optional ones', async () => {
     const code = `
-      const assert = require('assert');
       assert.strictEqual(process.env.BASIC, 'basic');
       assert.strictEqual(process.env.NODE_NO_WARNINGS, '1');
     `.trim();
@@ -41,7 +40,7 @@ describe('.env supports edge cases', () => {
 
   it('supports absolute paths', async () => {
     const code = `
-      require('assert').strictEqual(process.env.BASIC, 'basic');
+      assert.strictEqual(process.env.BASIC, 'basic');
     `.trim();
     const child = await common.spawnPromisified(
       process.execPath,
@@ -53,7 +52,7 @@ describe('.env supports edge cases', () => {
 
   it('supports a space instead of \'=\' for the flag ', async () => {
     const code = `
-      require('assert').strictEqual(process.env.BASIC, 'basic');
+      assert.strictEqual(process.env.BASIC, 'basic');
     `.trim();
     const child = await common.spawnPromisified(
       process.execPath,
@@ -66,7 +65,7 @@ describe('.env supports edge cases', () => {
 
   it('should handle non-existent .env file', async () => {
     const code = `
-      require('assert').strictEqual(1, 1)
+      assert.strictEqual(1, 1)
     `.trim();
     const child = await common.spawnPromisified(
       process.execPath,
@@ -79,7 +78,7 @@ describe('.env supports edge cases', () => {
 
   it('should handle non-existent optional .env file', async () => {
     const code = `
-      require('assert').strictEqual(1,1);
+      assert.strictEqual(1,1);
     `.trim();
     const child = await common.spawnPromisified(
       process.execPath,
@@ -92,8 +91,8 @@ describe('.env supports edge cases', () => {
 
   it('should not override existing environment variables but introduce new vars', async () => {
     const code = `
-      require('assert').strictEqual(process.env.BASIC, 'existing');
-      require('assert').strictEqual(process.env.AFTER_LINE, 'after_line');
+      assert.strictEqual(process.env.BASIC, 'existing');
+      assert.strictEqual(process.env.AFTER_LINE, 'after_line');
     `.trim();
     const child = await common.spawnPromisified(
       process.execPath,
@@ -124,8 +123,8 @@ describe('.env supports edge cases', () => {
     // Ref: https://github.com/nodejs/node/issues/52466
     const code = `
       process.loadEnvFile('./eof-without-value.env');
-      require('assert').strictEqual(process.env.BASIC, 'value');
-      require('assert').strictEqual(process.env.EMPTY, '');
+      assert.strictEqual(process.env.BASIC, 'value');
+      assert.strictEqual(process.env.EMPTY, '');
     `.trim();
     const child = await common.spawnPromisified(
       process.execPath,
@@ -160,7 +159,7 @@ describe('.env supports edge cases', () => {
     const child = await common.spawnPromisified(
       process.execPath,
       [
-        '--eval', `require('assert').strictEqual(process.env.BASIC, undefined);`,
+        '--eval', `assert.strictEqual(process.env.BASIC, undefined);`,
         '--', '--env-file', validEnvFilePath,
       ],
       { cwd: __dirname },
@@ -172,7 +171,7 @@ describe('.env supports edge cases', () => {
 
   it('should handle file without a final newline', async () => {
     const code = `
-      require('assert').strictEqual(process.env.BASIC, 'basic');
+      assert.strictEqual(process.env.BASIC, 'basic');
     `.trim();
     const child = await common.spawnPromisified(
       process.execPath,