GeezerVison is showing github.com — test: add trailing commas in `test/js-native-api` · nodejs/node@b0f2415
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/.eslintrc.yaml -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -74,7 +74,6 @@ overrides: | 74 | 74 | - files: | 75 | 75 | - es-module/*.js | 76 | 76 | - es-module/*.mjs | 77 | | - - js-native-api/*/*.js | 78 | 77 | - parallel/*.js | 79 | 78 | - parallel/*.mjs | 80 | 79 | - pummel/*.js | |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_array/test.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,14 +23,14 @@ assert.throws( | 23 | 23 | () => { | 24 | 24 | test_array.TestGetElement(array, array.length + 1); | 25 | 25 | }, | 26 | | - /^Error: assertion \(\(\(uint32_t\)index < length\)\) failed: Index out of bounds!$/ | | 26 | + /^Error: assertion \(\(\(uint32_t\)index < length\)\) failed: Index out of bounds!$/, | 27 | 27 | ); | 28 | 28 |
| 29 | 29 | assert.throws( | 30 | 30 | () => { | 31 | 31 | test_array.TestGetElement(array, -2); | 32 | 32 | }, | 33 | | - /^Error: assertion \(index >= 0\) failed: Invalid index\. Expects a positive integer\.$/ | | 33 | + /^Error: assertion \(index >= 0\) failed: Invalid index\. Expects a positive integer\.$/, | 34 | 34 | ); | 35 | 35 |
| 36 | 36 | array.forEach(function(element, index) { | |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_bigint/test.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -48,5 +48,5 @@ assert.throws(() => CreateTooBigBigInt(), { | 48 | 48 | // Test that we correctly forward exceptions from the engine. | 49 | 49 | assert.throws(() => MakeBigIntWordsThrow(), { | 50 | 50 | name: 'RangeError', | 51 | | - message: 'Maximum BigInt size exceeded' | | 51 | + message: 'Maximum BigInt size exceeded', | 52 | 52 | }); |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_constructor/test.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -58,5 +58,5 @@ assert.deepStrictEqual(TestConstructor.TestDefineClass(), { | 58 | 58 | cbIsNull: 'Invalid argument', | 59 | 59 | cbDataIsNull: 'napi_ok', | 60 | 60 | propertiesIsNull: 'Invalid argument', | 61 | | - resultIsNull: 'Invalid argument' | | 61 | + resultIsNull: 'Invalid argument', | 62 | 62 | }); |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_conversions/test.js +11-11Lines changed: 11 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -143,76 +143,76 @@ assert.deepStrictEqual(test.testNull.getValueBool(), { | 143 | 143 | envIsNull: 'Invalid argument', | 144 | 144 | valueIsNull: 'Invalid argument', | 145 | 145 | resultIsNull: 'Invalid argument', | 146 | | - inputTypeCheck: 'A boolean was expected' | | 146 | + inputTypeCheck: 'A boolean was expected', | 147 | 147 | }); | 148 | 148 |
| 149 | 149 | assert.deepStrictEqual(test.testNull.getValueInt32(), { | 150 | 150 | envIsNull: 'Invalid argument', | 151 | 151 | valueIsNull: 'Invalid argument', | 152 | 152 | resultIsNull: 'Invalid argument', | 153 | | - inputTypeCheck: 'A number was expected' | | 153 | + inputTypeCheck: 'A number was expected', | 154 | 154 | }); | 155 | 155 |
| 156 | 156 | assert.deepStrictEqual(test.testNull.getValueUint32(), { | 157 | 157 | envIsNull: 'Invalid argument', | 158 | 158 | valueIsNull: 'Invalid argument', | 159 | 159 | resultIsNull: 'Invalid argument', | 160 | | - inputTypeCheck: 'A number was expected' | | 160 | + inputTypeCheck: 'A number was expected', | 161 | 161 | }); | 162 | 162 |
| 163 | 163 | assert.deepStrictEqual(test.testNull.getValueInt64(), { | 164 | 164 | envIsNull: 'Invalid argument', | 165 | 165 | valueIsNull: 'Invalid argument', | 166 | 166 | resultIsNull: 'Invalid argument', | 167 | | - inputTypeCheck: 'A number was expected' | | 167 | + inputTypeCheck: 'A number was expected', | 168 | 168 | }); | 169 | 169 |
| 170 | 170 |
| 171 | 171 | assert.deepStrictEqual(test.testNull.getValueDouble(), { | 172 | 172 | envIsNull: 'Invalid argument', | 173 | 173 | valueIsNull: 'Invalid argument', | 174 | 174 | resultIsNull: 'Invalid argument', | 175 | | - inputTypeCheck: 'A number was expected' | | 175 | + inputTypeCheck: 'A number was expected', | 176 | 176 | }); | 177 | 177 |
| 178 | 178 | assert.deepStrictEqual(test.testNull.coerceToBool(), { | 179 | 179 | envIsNull: 'Invalid argument', | 180 | 180 | valueIsNull: 'Invalid argument', | 181 | 181 | resultIsNull: 'Invalid argument', | 182 | | - inputTypeCheck: 'napi_ok' | | 182 | + inputTypeCheck: 'napi_ok', | 183 | 183 | }); | 184 | 184 |
| 185 | 185 | assert.deepStrictEqual(test.testNull.coerceToObject(), { | 186 | 186 | envIsNull: 'Invalid argument', | 187 | 187 | valueIsNull: 'Invalid argument', | 188 | 188 | resultIsNull: 'Invalid argument', | 189 | | - inputTypeCheck: 'napi_ok' | | 189 | + inputTypeCheck: 'napi_ok', | 190 | 190 | }); | 191 | 191 |
| 192 | 192 | assert.deepStrictEqual(test.testNull.coerceToString(), { | 193 | 193 | envIsNull: 'Invalid argument', | 194 | 194 | valueIsNull: 'Invalid argument', | 195 | 195 | resultIsNull: 'Invalid argument', | 196 | | - inputTypeCheck: 'napi_ok' | | 196 | + inputTypeCheck: 'napi_ok', | 197 | 197 | }); | 198 | 198 |
| 199 | 199 | assert.deepStrictEqual(test.testNull.getValueStringUtf8(), { | 200 | 200 | envIsNull: 'Invalid argument', | 201 | 201 | valueIsNull: 'Invalid argument', | 202 | 202 | wrongTypeIn: 'A string was expected', | 203 | | - bufAndOutLengthIsNull: 'Invalid argument' | | 203 | + bufAndOutLengthIsNull: 'Invalid argument', | 204 | 204 | }); | 205 | 205 |
| 206 | 206 | assert.deepStrictEqual(test.testNull.getValueStringLatin1(), { | 207 | 207 | envIsNull: 'Invalid argument', | 208 | 208 | valueIsNull: 'Invalid argument', | 209 | 209 | wrongTypeIn: 'A string was expected', | 210 | | - bufAndOutLengthIsNull: 'Invalid argument' | | 210 | + bufAndOutLengthIsNull: 'Invalid argument', | 211 | 211 | }); | 212 | 212 |
| 213 | 213 | assert.deepStrictEqual(test.testNull.getValueStringUtf16(), { | 214 | 214 | envIsNull: 'Invalid argument', | 215 | 215 | valueIsNull: 'Invalid argument', | 216 | 216 | wrongTypeIn: 'A string was expected', | 217 | | - bufAndOutLengthIsNull: 'Invalid argument' | | 217 | + bufAndOutLengthIsNull: 'Invalid argument', | 218 | 218 | }); |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_error/test.js +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -70,35 +70,35 @@ assert.throws(() => { | 70 | 70 | (err) => { | 71 | 71 | assert.strictEqual(err, value); | 72 | 72 | return true; | 73 | | - } | | 73 | + }, | 74 | 74 | )); | 75 | 75 |
| 76 | 76 | assert.throws( | 77 | 77 | () => test_error.throwErrorCode(), | 78 | 78 | { | 79 | 79 | code: 'ERR_TEST_CODE', | 80 | | - message: 'Error [error]' | | 80 | + message: 'Error [error]', | 81 | 81 | }); | 82 | 82 |
| 83 | 83 | assert.throws( | 84 | 84 | () => test_error.throwRangeErrorCode(), | 85 | 85 | { | 86 | 86 | code: 'ERR_TEST_CODE', | 87 | | - message: 'RangeError [range error]' | | 87 | + message: 'RangeError [range error]', | 88 | 88 | }); | 89 | 89 |
| 90 | 90 | assert.throws( | 91 | 91 | () => test_error.throwTypeErrorCode(), | 92 | 92 | { | 93 | 93 | code: 'ERR_TEST_CODE', | 94 | | - message: 'TypeError [type error]' | | 94 | + message: 'TypeError [type error]', | 95 | 95 | }); | 96 | 96 |
| 97 | 97 | assert.throws( | 98 | 98 | () => test_error.throwSyntaxErrorCode(), | 99 | 99 | { | 100 | 100 | code: 'ERR_TEST_CODE', | 101 | | - message: 'SyntaxError [syntax error]' | | 101 | + message: 'SyntaxError [syntax error]', | 102 | 102 | }); | 103 | 103 |
| 104 | 104 | let error = test_error.createError(); | |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_exception/test.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,7 +31,7 @@ const test_exception = (function() { | 31 | 31 | // Test that the native side passes the exception through | 32 | 32 | assert.throws( | 33 | 33 | () => { test_exception.allowException(throwTheError); }, | 34 | | - (err) => err === theError | | 34 | + (err) => err === theError, | 35 | 35 | ); | 36 | 36 |
| 37 | 37 | // Test that the exception thrown above was marked as pending | @@ -59,7 +59,7 @@ const test_exception = (function() { | 59 | 59 | // Test that the native side passes the exception through | 60 | 60 | assert.throws( | 61 | 61 | () => { test_exception.constructAllowException(throwTheError); }, | 62 | | - (err) => err === theError | | 62 | + (err) => err === theError, | 63 | 63 | ); | 64 | 64 |
| 65 | 65 | // Test that the exception thrown above was marked as pending | |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_function/test.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,13 +40,13 @@ assert.deepStrictEqual(test_function.TestCreateFunctionParameters(), { | 40 | 40 | envIsNull: 'Invalid argument', | 41 | 41 | nameIsNull: 'napi_ok', | 42 | 42 | cbIsNull: 'Invalid argument', | 43 | | - resultIsNull: 'Invalid argument' | | 43 | + resultIsNull: 'Invalid argument', | 44 | 44 | }); | 45 | 45 |
| 46 | 46 | assert.throws( | 47 | 47 | () => test_function.TestBadReturnExceptionPending(), | 48 | 48 | { | 49 | 49 | code: 'throwing exception', | 50 | | - name: 'Error' | 51 | | - } | | 50 | + name: 'Error', | | 51 | + }, | 52 | 52 | ); |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_general/testEnvCleanup.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,7 +11,7 @@ if (process.argv[2] === 'child') { | 11 | 11 | 'simple wrap': 0, | 12 | 12 | 'wrap, removeWrap': 1, | 13 | 13 | 'first wrap': 2, | 14 | | - 'second wrap': 3 | | 14 | + 'second wrap': 3, | 15 | 15 | }; | 16 | 16 |
| 17 | 17 | // We attach the three objects we will test to `module.exports` to ensure they | @@ -39,7 +39,7 @@ if (process.argv[2] === 'child') { | 39 | 39 | const { spawnSync } = require('child_process'); | 40 | 40 |
| 41 | 41 | const child = spawnSync(process.execPath, [__filename, 'child'], { | 42 | | - stdio: [ process.stdin, 'pipe', process.stderr ] | | 42 | + stdio: [ process.stdin, 'pipe', process.stderr ], | 43 | 43 | }); | 44 | 44 |
| 45 | 45 | // Grab the child's output and construct an object whose keys are the rows of | @@ -49,7 +49,7 @@ if (process.argv[2] === 'child') { | 49 | 49 | child.stdout.toString().split(/\r\n|\r|\n/g).reduce((obj, item) => | 50 | 50 | Object.assign(obj, item ? { [item]: true } : {}), {}), { | 51 | 51 | 'finalize at env cleanup for simple wrap': true, | 52 | | - 'finalize at env cleanup for second wrap': true | | 52 | + 'finalize at env cleanup for second wrap': true, | 53 | 53 | }); | 54 | 54 |
| 55 | 55 | // Ensure that the child exited successfully. | |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_general/testInstanceOf.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -61,15 +61,15 @@ if (typeof Symbol !== 'undefined' && 'hasInstance' in Symbol && | 61 | 61 | function compareToNative(theObject, theConstructor) { | 62 | 62 | assert.strictEqual( | 63 | 63 | addon.doInstanceOf(theObject, theConstructor), | 64 | | - (theObject instanceof theConstructor) | | 64 | + (theObject instanceof theConstructor), | 65 | 65 | ); | 66 | 66 | } | 67 | 67 |
| 68 | 68 | function MyClass() {} | 69 | 69 | Object.defineProperty(MyClass, Symbol.hasInstance, { | 70 | 70 | value: function(candidate) { | 71 | 71 | return 'mark' in candidate; | 72 | | - } | | 72 | + }, | 73 | 73 | }); | 74 | 74 |
| 75 | 75 | function MySubClass() {} | |
|