diff --git a/benchmark/assert/throws.js b/benchmark/assert/throws.js index 2409d19206e353..a8a7bd4509e1ca 100644 --- a/benchmark/assert/throws.js +++ b/benchmark/assert/throws.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common.js'); -const assert = require('assert'); +const { throws, doesNotThrow } = require('assert'); const bench = common.createBenchmark(main, { n: [1e6], @@ -14,8 +14,8 @@ const bench = common.createBenchmark(main, { }); function main({ n, method }) { - const throws = () => { throw new TypeError('foobar'); }; - const doesNotThrow = () => { return 'foobar'; }; + const throwError = () => { throw new TypeError('foobar'); }; + const doNotThrowError = () => { return 'foobar'; }; const regExp = /foobar/; const message = 'failure'; var i; @@ -26,30 +26,28 @@ function main({ n, method }) { case 'doesNotThrow': bench.start(); for (i = 0; i < n; ++i) { - // eslint-disable-next-line no-restricted-syntax - assert.doesNotThrow(doesNotThrow); + doesNotThrow(doNotThrowError); } bench.end(n); break; case 'throws': bench.start(); for (i = 0; i < n; ++i) { - // eslint-disable-next-line no-restricted-syntax - assert.throws(throws); + throws(throwError); } bench.end(n); break; case 'throws_TypeError': bench.start(); for (i = 0; i < n; ++i) { - assert.throws(throws, TypeError, message); + throws(throwError, TypeError, message); } bench.end(n); break; case 'throws_RegExp': bench.start(); for (i = 0; i < n; ++i) { - assert.throws(throws, regExp, message); + throws(throwError, regExp, message); } bench.end(n); break;