| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9346570 commit 1d5e5e8
17 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,14 +26,17 @@ assert.strictEqual(atob({ toString: () => '' }), ''); | |||
| 26 | 26 | assert.strictEqual(atob({ [Symbol.toPrimitive]: () => '' }), ''); | |
| 27 | 27 | ||
| 28 | 28 | assert.throws(() => atob(Symbol()), /TypeError/); | |
| 29 | - [ | ||
| 29 | + const testCases = [ | ||
| 30 | 30 | undefined, false, () => {}, {}, [1], | |
| 31 | 31 | 0, 1, 0n, 1n, -Infinity, | |
| 32 | 32 | 'a', 'a\n\n\n', '\ra\r\r', ' a ', '\t\t\ta', 'a\f\f\f', '\ta\r \n\f', | |
| 33 | - ].forEach((value) => | ||
| 34 | - // See #2 - https://html.spec.whatwg.org/multipage/webappapis.html#dom-atob | ||
| 33 | + ]; | ||
| 34 | + | ||
| 35 | + // See #2 - https://html.spec.whatwg.org/multipage/webappapis.html#dom-atob | ||
| 36 | + for (const value of testCases) { | ||
| 35 | 37 | assert.throws(() => atob(value), { | |
| 36 | 38 | constructor: DOMException, | |
| 37 | 39 | name: 'InvalidCharacterError', | |
| 38 | 40 | code: 5, | |
| 39 | - })); | ||
| 41 | + }); | ||
| 42 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,4 +29,7 @@ function test(stringVariant) { | |||
| 29 | 29 | child.on('exit', common.mustCall((code) => assert.strictEqual(code, 0))); | |
| 30 | 30 | } | |
| 31 | 31 | ||
| 32 | - ['pipe', 'inherit', 'ignore'].forEach(test); | ||
| 32 | + const testCases = ['pipe', 'inherit', 'ignore']; | ||
| 33 | + for (const value of testCases) { | ||
| 34 | + test(value); | ||
| 35 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,8 +32,8 @@ if (process.argv[2] === 'child') { | |||
| 32 | 32 | ||
| 33 | 33 | child.on('message', common.mustCall((msg) => { | |
| 34 | 34 | assert.strictEqual(msg, 'ready'); | |
| 35 | - values.forEach((value) => { | ||
| 35 | + for (const value of values) { | ||
| 36 | 36 | child.send(value); | |
| 37 | - }); | ||
| 37 | + }; | ||
| 38 | 38 | })); | |
| 39 | 39 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,7 +18,9 @@ interfacer.stderr.setEncoding('utf-8'); | |||
| 18 | 18 | const onData = (data) => { | |
| 19 | 19 | data = (buffer + data).split('\n'); | |
| 20 | 20 | buffer = data.pop(); | |
| 21 | - data.forEach((line) => interfacer.emit('line', line)); | ||
| 21 | + for (const line of data) { | ||
| 22 | + interfacer.emit('line', line); | ||
| 23 | + } | ||
| 22 | 24 | }; | |
| 23 | 25 | interfacer.stdout.on('data', onData); | |
| 24 | 26 | interfacer.stderr.on('data', onData); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,13 +7,14 @@ require('../common'); | |||
| 7 | 7 | ||
| 8 | 8 | const assert = require('assert'); | |
| 9 | 9 | const { internalBinding } = require('internal/test/binding'); | |
| 10 | - [ | ||
| 10 | + const testCases = [ | ||
| 11 | 11 | internalBinding('udp_wrap').UDP.prototype.bind6, | |
| 12 | 12 | internalBinding('tcp_wrap').TCP.prototype.bind6, | |
| 13 | 13 | internalBinding('udp_wrap').UDP.prototype.send6, | |
| 14 | 14 | internalBinding('tcp_wrap').TCP.prototype.bind, | |
| 15 | 15 | internalBinding('udp_wrap').UDP.prototype.close, | |
| 16 | 16 | internalBinding('tcp_wrap').TCP.prototype.open, | |
| 17 | - ].forEach((binding, i) => { | ||
| 17 | + ]; | ||
| 18 | + for (const [i, binding] of testCases.entries()) { | ||
| 18 | 19 | assert.strictEqual('prototype' in binding, false, `Test ${i} failed`); | |
| 19 | - }); | ||
| 20 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,9 +8,9 @@ const EventEmitter = require('events'); | |||
| 8 | 8 | process.on('uncaughtException', common.mustCall((err) => { | |
| 9 | 9 | const [firstLine, ...lines] = err.stack.split('\n'); | |
| 10 | 10 | assert.strictEqual(firstLine, 'Error'); | |
| 11 | - lines.forEach((line) => { | ||
| 11 | + for (const line of lines) { | ||
| 12 | 12 | assert.match(line, /^ {4}at/); | |
| 13 | - }); | ||
| 13 | + } | ||
| 14 | 14 | })); | |
| 15 | 15 | ||
| 16 | 16 | new EventEmitter().emit('error', new Error()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,11 +6,12 @@ require('../common'); | |||
| 6 | 6 | const assert = require('assert'); | |
| 7 | 7 | const fs = require('fs'); | |
| 8 | 8 | ||
| 9 | - [ | ||
| 9 | + const testCases = [ | ||
| 10 | 10 | true, false, 0, 1, Infinity, () => {}, {}, [], undefined, null, | |
| 11 | - ].forEach((value) => { | ||
| 11 | + ]; | ||
| 12 | + for (const value of testCases) { | ||
| 12 | 13 | assert.throws( | |
| 13 | 14 | () => fs.writeSync(1, value), | |
| 14 | 15 | { message: /"buffer"/, code: 'ERR_INVALID_ARG_TYPE' } | |
| 15 | 16 | ); | |
| 16 | - }); | ||
| 17 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,10 +8,10 @@ import fixtures from '../common/fixtures.js'; | |||
| 8 | 8 | tmpdir.refresh(); | |
| 9 | 9 | ||
| 10 | 10 | const src = fixtures.path('copy/kitchen-sink'); | |
| 11 | - [1, [], {}, null, 1n, undefined, null, Symbol(), '', () => {}] | ||
| 12 | - .forEach((verbatimSymlinks) => { | ||
| 13 | - assert.throws( | ||
| 14 | - () => cpSync(src, src, { verbatimSymlinks }), | ||
| 15 | - { code: 'ERR_INVALID_ARG_TYPE' } | ||
| 16 | - ); | ||
| 17 | - }); | ||
| 11 | + const testCases = [1, [], {}, null, 1n, undefined, null, Symbol(), '', () => {}]; | ||
| 12 | + for (const verbatimSymlinks of testCases) { | ||
| 13 | + assert.throws( | ||
| 14 | + () => cpSync(src, src, { verbatimSymlinks }), | ||
| 15 | + { code: 'ERR_INVALID_ARG_TYPE' } | ||
| 16 | + ); | ||
| 17 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,8 @@ const common = require('../common'); | |||
| 4 | 4 | const assert = require('assert'); | |
| 5 | 5 | const fs = require('fs'); | |
| 6 | 6 | ||
| 7 | - [false, 1, {}, [], null, undefined].forEach((i) => { | ||
| 7 | + const testCases = [false, 1, {}, [], null, undefined]; | ||
| 8 | + for (const i of testCases) { | ||
| 8 | 9 | assert.throws( | |
| 9 | 10 | () => fs.readlink(i, common.mustNotCall()), | |
| 10 | 11 | { | |
@@ -19,4 +20,4 @@ const fs = require('fs'); | |||
| 19 | 20 | name: 'TypeError' | |
| 20 | 21 | } | |
| 21 | 22 | ); | |
| 22 | - }); | ||
| 23 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,8 @@ const common = require('../common'); | |||
| 4 | 4 | const assert = require('assert'); | |
| 5 | 5 | const fs = require('fs'); | |
| 6 | 6 | ||
| 7 | - [false, 1, [], {}, null, undefined].forEach((i) => { | ||
| 7 | + const testCases = [false, 1, [], {}, null, undefined]; | ||
| 8 | + for (const i of testCases) { | ||
| 8 | 9 | assert.throws( | |
| 9 | 10 | () => fs.rmdir(i, common.mustNotCall()), | |
| 10 | 11 | { | |
@@ -19,4 +20,4 @@ const fs = require('fs'); | |||
| 19 | 20 | name: 'TypeError' | |
| 20 | 21 | } | |
| 21 | 22 | ); | |
| 22 | - }); | ||
| 23 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments