mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: stop using console.assert everywhere (#2646)
Since Node 10, `console.assert` no longer throws an AssertionError. (This is generally good since it aligns Node.js with Browsers.) This patch migrates all usages of `console.assert` in our codebase. - All the `lib/` and testing code is migrated onto a handmade `assert` function. This is to make Puppeteer transpilation / bundling easier. - All the tooling is switched to use Node's `assert` module. Fixes #2547.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
const {helper} = require('./helper');
|
||||
const {helper, assert} = require('./helper');
|
||||
const debugProtocol = require('debug')('puppeteer:protocol');
|
||||
const debugSession = require('debug')('puppeteer:session');
|
||||
|
||||
@@ -228,7 +228,7 @@ class CDPSession extends EventEmitter {
|
||||
this._sessions.delete(object.params.sessionId);
|
||||
}
|
||||
}
|
||||
console.assert(!object.id);
|
||||
assert(!object.id);
|
||||
this.emit(object.method, object.params);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user