| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1977348 commit ac367b3
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -110,11 +110,11 @@ export default [ | |||
| 110 | 110 | message: 'Calling `.catch(common.mustNotCall())` will not detect never-settling promises. Use `.then(common.mustCall())` instead.', | |
| 111 | 111 | }, | |
| 112 | 112 | { | |
| 113 | - selector: 'CallExpression[callee.type="MemberExpression"][callee.object.type="Identifier"][callee.object.name="assert"][callee.property.type="Identifier"][callee.property.name="ok"][arguments.0.type="CallExpression"][arguments.0.callee.type="MemberExpression"][arguments.0.callee.object.regex][arguments.0.callee.property.type="Identifier"][arguments.0.callee.property.name="test"]', | ||
| 113 | + selector: 'CallExpression:matches([callee.type="Identifier"][callee.name="assert"], [callee.type="MemberExpression"][callee.object.type="Identifier"][callee.object.name="assert"][callee.property.type="Identifier"][callee.property.name="ok"])[arguments.0.type="CallExpression"][arguments.0.callee.type="MemberExpression"][arguments.0.callee.object.regex][arguments.0.callee.property.type="Identifier"][arguments.0.callee.property.name="test"]', | ||
| 114 | 114 | message: 'Use assert.match instead', | |
| 115 | 115 | }, | |
| 116 | 116 | { | |
| 117 | - selector: 'CallExpression[callee.type="MemberExpression"][callee.object.type="Identifier"][callee.object.name="assert"][callee.property.type="Identifier"][callee.property.name="ok"][arguments.0.type="UnaryExpression"][arguments.0.operator="!"][arguments.0.argument.type="CallExpression"][arguments.0.argument.callee.type="MemberExpression"][arguments.0.argument.callee.object.regex][arguments.0.argument.callee.property.name="test"]', | ||
| 117 | + selector: 'CallExpression:matches([callee.type="Identifier"][callee.name="assert"], [callee.type="MemberExpression"][callee.object.type="Identifier"][callee.object.name="assert"][callee.property.type="Identifier"][callee.property.name="ok"])[arguments.0.type="UnaryExpression"][arguments.0.operator="!"][arguments.0.argument.type="CallExpression"][arguments.0.argument.callee.type="MemberExpression"][arguments.0.argument.callee.object.regex][arguments.0.argument.callee.property.name="test"]', | ||
| 118 | 118 | message: 'Use assert.doesNotMatch instead', | |
| 119 | 119 | }, | |
| 120 | 120 | ], | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,11 +18,7 @@ process.on('warning', common.mustCall((warning) => { | |||
| 18 | 18 | case 1: | |
| 19 | 19 | // Warning about rejection not being handled (will be next tick) | |
| 20 | 20 | assert.strictEqual(warning.name, 'UnhandledPromiseRejectionWarning'); | |
| 21 | - assert( | ||
| 22 | - /Unhandled promise rejection/.test(warning.message), | ||
| 23 | - 'Expected warning message to contain "Unhandled promise rejection" ' + | ||
| 24 | - `but did not. Had "${warning.message}" instead.` | ||
| 25 | - ); | ||
| 21 | + assert.match(warning.message, /Unhandled promise rejection/); | ||
| 26 | 22 | break; | |
| 27 | 23 | case 2: | |
| 28 | 24 | // Number rejection error displayed. Note it's been stringified | |
@@ -31,17 +27,12 @@ process.on('warning', common.mustCall((warning) => { | |||
| 31 | 27 | case 3: | |
| 32 | 28 | // Unhandled rejection warning (won't be handled next tick) | |
| 33 | 29 | assert.strictEqual(warning.name, 'UnhandledPromiseRejectionWarning'); | |
| 34 | - assert( | ||
| 35 | - /Unhandled promise rejection/.test(warning.message), | ||
| 36 | - 'Expected warning message to contain "Unhandled promise rejection" ' + | ||
| 37 | - `but did not. Had "${warning.message}" instead.` | ||
| 38 | - ); | ||
| 30 | + assert.match(warning.message, /Unhandled promise rejection/); | ||
| 39 | 31 | break; | |
| 40 | 32 | case 4: | |
| 41 | 33 | // Rejection handled asynchronously. | |
| 42 | 34 | assert.strictEqual(warning.name, 'PromiseRejectionHandledWarning'); | |
| 43 | - assert(/Promise rejection was handled asynchronously/ | ||
| 44 | - .test(warning.message)); | ||
| 35 | + assert.match(warning.message, /Promise rejection was handled asynchronously/); | ||
| 45 | 36 | } | |
| 46 | 37 | }, 5)); | |
| 47 | 38 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,7 +49,7 @@ const file = fixtures.path('snapshot', 'mutate-fs.js'); | |||
| 49 | 49 | console.log(child.stdout.toString()); | |
| 50 | 50 | assert.strictEqual(child.status, 0); | |
| 51 | 51 | } | |
| 52 | - assert(/I am from the snapshot/.test(child.stdout.toString())); | ||
| 52 | + assert.match(child.stdout.toString(), /I am from the snapshot/); | ||
| 53 | 53 | } | |
| 54 | 54 | ||
| 55 | 55 | { | |
@@ -68,5 +68,5 @@ const file = fixtures.path('snapshot', 'mutate-fs.js'); | |||
| 68 | 68 | console.log(child.stdout.toString()); | |
| 69 | 69 | assert.strictEqual(child.status, 0); | |
| 70 | 70 | } | |
| 71 | - assert(/I am from the snapshot/.test(child.stdout.toString())); | ||
| 71 | + assert.match(child.stdout.toString(), /I am from the snapshot/); | ||
| 72 | 72 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,6 +46,6 @@ process.on('exit', function() { | |||
| 46 | 46 | common.printSkipMessage('`openssl s_client -ssl3` not supported.'); | |
| 47 | 47 | } else { | |
| 48 | 48 | assert.strictEqual(errors.length, 1); | |
| 49 | - assert(/:version too low/.test(errors[0].message)); | ||
| 49 | + assert.match(errors[0].message, /:version too low/); | ||
| 50 | 50 | } | |
| 51 | 51 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments