function wrapParser(parser) {
	if (typeof parser.parseForESLint === "function") {
		return {
			[parserSymbol]: parser,
			parseForESLint(...args) {
				const ret = parser.parseForESLint(...args);

				defineStartEndAsErrorInTree(ret.ast, ret.visitorKeys);
				return ret;
			},
		};
	}

	return {
		[parserSymbol]: parser,
		parse(...args) {
			const ast = parser.parse(...args);

			defineStartEndAsErrorInTree(ast);
			return ast;
		},
	};
}
Wraps the given parser in order to intercept and modify return values from the `parse` and `parseForESLint` methods, for test purposes.
In particular, to modify ast nodes, tokens and comments to throw on access to their `start` and `end` properties.
@param {Parser} parser Parser object.
@returns {Parser} Wrapped parser object.