Skip to content

Assert required constructor driver #706

Open
@straker

Description

@straker

Each of our packages should assert that the required constructor driver is passed in. Right now they are not checked so passing in nothing results in an error message about our code trying to access properties that don't exist.

For example, this is the output from puppeteer.

const axeBuilder = require('@axe-core/puppeteer');
new axeBuilder.default();

/*
axePuppeteer.js:24
        if ('mainFrame' in pageFrame) {
                        ^
TypeError: Cannot use 'in' operator to search for 'mainFrame' in undefined
    at new AxePuppeteer 
    at Object.<anonymous>
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47
*/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions