function verify(ast, type, expectedNamesList) {
        const scopeManager = analyze(ast, {
            ecmaVersion: 6,
            sourceType: "module"
        });

        visit(ast, {
            [type](node) {
                const expected = expectedNamesList.shift();
                const actual = scopeManager.getDeclaredVariables(node);

                expect(actual).to.have.length(expected.length);
                if (actual.length > 0) {
                    const end = actual.length - 1;

                    for (let i = 0; i <= end; i++) {
                        expect(actual[i].name).to.be.equal(expected[i]);
                    }
                }

                this.visitChildren(node);
            }
        });

        expect(expectedNamesList).to.have.length(0);
    }
Asserts that nodes of the given type declare expected variables.
@param {Object} ast The AST to check.
@param {string} type The node type to check.
@param {string[][]} expectedNamesList List of expected variable names for each node of the given type.
@throws {Error} If the list of declared variables doesn't match the expected list.
@returns {void}