| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3e7226a commit 31cd05c
40 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,6 +49,8 @@ rules: | |||
| 49 | 49 | message: Use 'test' as debuglog value in tests. | |
| 50 | 50 | - selector: CallExpression:matches([callee.object.name="common"][callee.property.name=/^must(Not)?Call/],[callee.name="mustCall"],[callee.name="mustCallAtLeast"],[callee.name="mustNotCall"])>:first-child[type=/FunctionExpression$/][body.body.length=0] | |
| 51 | 51 | message: Do not use an empty function, omit the parameter altogether. | |
| 52 | + - selector: ExpressionStatement>CallExpression:matches([callee.name='rejects'], [callee.object.name='assert'][callee.property.name='rejects']) | ||
| 53 | + message: Calling `assert.rejects` without `await` or `.then(common.mustCall())` will not detect never-settling promises. | ||
| 52 | 54 | - selector: Identifier[name='webcrypto'] | |
| 53 | 55 | message: Use `globalThis.crypto`. | |
| 54 | 56 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,55 +23,55 @@ const expectedPackageHack = | |||
| 23 | 23 | ||
| 24 | 24 | const expectedBare = errTemplate('deep-fail', 'comeOn', '{ comeOn }'); | |
| 25 | 25 | ||
| 26 | - rejects(async () => { | ||
| 26 | + await rejects(async () => { | ||
| 27 | 27 | await import(`${fixtureBase}/single-quote.mjs`); | |
| 28 | 28 | }, { | |
| 29 | 29 | name: 'SyntaxError', | |
| 30 | 30 | message: expectedRelative | |
| 31 | 31 | }, 'should support relative specifiers with single quotes'); | |
| 32 | 32 | ||
| 33 | - rejects(async () => { | ||
| 33 | + await rejects(async () => { | ||
| 34 | 34 | await import(`${fixtureBase}/double-quote.mjs`); | |
| 35 | 35 | }, { | |
| 36 | 36 | name: 'SyntaxError', | |
| 37 | 37 | message: expectedRelative | |
| 38 | 38 | }, 'should support relative specifiers with double quotes'); | |
| 39 | 39 | ||
| 40 | - rejects(async () => { | ||
| 40 | + await rejects(async () => { | ||
| 41 | 41 | await import(`${fixtureBase}/renamed-import.mjs`); | |
| 42 | 42 | }, { | |
| 43 | 43 | name: 'SyntaxError', | |
| 44 | 44 | message: expectedRenamed | |
| 45 | 45 | }, 'should correctly format named imports with renames'); | |
| 46 | 46 | ||
| 47 | - rejects(async () => { | ||
| 47 | + await rejects(async () => { | ||
| 48 | 48 | await import(`${fixtureBase}/multi-line.mjs`); | |
| 49 | 49 | }, { | |
| 50 | 50 | name: 'SyntaxError', | |
| 51 | 51 | message: expectedWithoutExample, | |
| 52 | 52 | }, 'should correctly format named imports across multiple lines'); | |
| 53 | 53 | ||
| 54 | - rejects(async () => { | ||
| 54 | + await rejects(async () => { | ||
| 55 | 55 | await import(`${fixtureBase}/json-hack.mjs`); | |
| 56 | 56 | }, { | |
| 57 | 57 | name: 'SyntaxError', | |
| 58 | 58 | message: expectedPackageHack | |
| 59 | 59 | }, 'should respect recursive package.json for module type'); | |
| 60 | 60 | ||
| 61 | - rejects(async () => { | ||
| 61 | + await rejects(async () => { | ||
| 62 | 62 | await import(`${fixtureBase}/bare-import-single.mjs`); | |
| 63 | 63 | }, { | |
| 64 | 64 | name: 'SyntaxError', | |
| 65 | 65 | message: expectedBare | |
| 66 | 66 | }, 'should support bare specifiers with single quotes'); | |
| 67 | 67 | ||
| 68 | - rejects(async () => { | ||
| 68 | + await rejects(async () => { | ||
| 69 | 69 | await import(`${fixtureBase}/bare-import-double.mjs`); | |
| 70 | 70 | }, { | |
| 71 | 71 | name: 'SyntaxError', | |
| 72 | 72 | message: expectedBare | |
| 73 | 73 | }, 'should support bare specifiers with double quotes'); | |
| 74 | 74 | ||
| 75 | - rejects(async () => { | ||
| 75 | + await rejects(async () => { | ||
| 76 | 76 | await import(`${fixtureBase}/escaped-single-quote.mjs`); | |
| 77 | 77 | }, /import pkg from '\.\/oh'no\.cjs'/, 'should support relative specifiers with escaped single quote'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,7 @@ assert.rejects( | |||
| 17 | 17 | code: 'ENOTFOUND', | |
| 18 | 18 | message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`, | |
| 19 | 19 | }, | |
| 20 | - ); | ||
| 20 | + ).then(common.mustCall()); | ||
| 21 | 21 | ||
| 22 | 22 | assert.rejects( | |
| 23 | 23 | dnsPromises.lookup(addresses.NOT_FOUND, { | |
@@ -29,7 +29,7 @@ assert.rejects( | |||
| 29 | 29 | code: 'ENOTFOUND', | |
| 30 | 30 | message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}`, | |
| 31 | 31 | }, | |
| 32 | - ); | ||
| 32 | + ).then(common.mustCall()); | ||
| 33 | 33 | ||
| 34 | 34 | dns.lookup(addresses.NOT_FOUND, { | |
| 35 | 35 | hints: 0, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -409,10 +409,10 @@ assert.throws(() => new Blob({}), { | |||
| 409 | 409 | } | |
| 410 | 410 | ||
| 411 | 411 | (async () => { | |
| 412 | - assert.rejects(async () => Blob.prototype.arrayBuffer.call(), { | ||
| 412 | + await assert.rejects(async () => Blob.prototype.arrayBuffer.call(), { | ||
| 413 | 413 | code: 'ERR_INVALID_THIS', | |
| 414 | 414 | }); | |
| 415 | - assert.rejects(async () => Blob.prototype.text.call(), { | ||
| 415 | + await assert.rejects(async () => Blob.prototype.text.call(), { | ||
| 416 | 416 | code: 'ERR_INVALID_THIS', | |
| 417 | 417 | }); | |
| 418 | 418 | })().then(common.mustCall()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,7 +16,7 @@ subtle.importKey( | |||
| 16 | 16 | }, | |
| 17 | 17 | false, | |
| 18 | 18 | [ 'encrypt', 'decrypt' ]) | |
| 19 | - .then((k) => { | ||
| 19 | + .then((k) => | ||
| 20 | 20 | assert.rejects(() => { | |
| 21 | 21 | return subtle.decrypt({ | |
| 22 | 22 | name: 'AES-GCM', | |
@@ -25,5 +25,5 @@ subtle.importKey( | |||
| 25 | 25 | }, { | |
| 26 | 26 | name: 'OperationError', | |
| 27 | 27 | message: /The provided data is too small/, | |
| 28 | - }); | ||
| 29 | - }); | ||
| 28 | + }) | ||
| 29 | + ).then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,14 +1,14 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | - require('../common'); | ||
| 3 | + const common = require('../common'); | ||
| 4 | 4 | const fixtures = require('../common/fixtures'); | |
| 5 | 5 | const assert = require('assert'); | |
| 6 | 6 | const { pathToFileURL } = require('url'); | |
| 7 | 7 | ||
| 8 | 8 | { | |
| 9 | - assert.rejects(import('./'), /ERR_UNSUPPORTED_DIR_IMPORT/); | ||
| 9 | + assert.rejects(import('./'), /ERR_UNSUPPORTED_DIR_IMPORT/).then(common.mustCall()); | ||
| 10 | 10 | assert.rejects( | |
| 11 | 11 | import(pathToFileURL(fixtures.path('packages', 'main'))), | |
| 12 | 12 | /Did you mean/, | |
| 13 | - ); | ||
| 13 | + ).then(common.mustCall()); | ||
| 14 | 14 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -205,4 +205,4 @@ tickValue = 1; | |||
| 205 | 205 | ||
| 206 | 206 | // Should fail due to stub. | |
| 207 | 207 | assert.rejects(dnsPromises.lookup('example.com'), | |
| 208 | - { code: 'ENOMEM', hostname: 'example.com' }); | ||
| 208 | + { code: 'ENOMEM', hostname: 'example.com' }).then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,4 +16,4 @@ dnsPromises.lookupService('127.0.0.1', 22).then(common.mustCall((result) => { | |||
| 16 | 16 | assert.rejects( | |
| 17 | 17 | () => dnsPromises.lookupService('192.0.2.1', 22), | |
| 18 | 18 | { code: /^(?:ENOTFOUND|EAI_AGAIN)$/ } | |
| 19 | - ); | ||
| 19 | + ).then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,4 +32,4 @@ assert.rejects( | |||
| 32 | 32 | message: 'getnameinfo ENOENT 127.0.0.1', | |
| 33 | 33 | syscall: 'getnameinfo' | |
| 34 | 34 | } | |
| 35 | - ); | ||
| 35 | + ).then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | // Flags: --expose-internals | |
| 2 | 2 | 'use strict'; | |
| 3 | - require('../common'); | ||
| 3 | + const common = require('../common'); | ||
| 4 | 4 | const assert = require('assert'); | |
| 5 | 5 | const { internalBinding } = require('internal/test/binding'); | |
| 6 | 6 | const cares = internalBinding('cares_wrap'); | |
@@ -17,4 +17,4 @@ assert.rejects( | |||
| 17 | 17 | syscall: 'queryA', | |
| 18 | 18 | hostname: 'example.org' | |
| 19 | 19 | } | |
| 20 | - ); | ||
| 20 | + ).then(common.mustCall()); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments