@graphql-inspector/action
Version:
GraphQL Inspector functionality for GitHub Actions
27 lines (26 loc) • 950 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const jsesc_1 = tslib_1.__importDefault(require("jsesc"));
const strip_ansi_1 = tslib_1.__importDefault(require("strip-ansi"));
function nonTTY(msg) {
return (0, strip_ansi_1.default)((0, jsesc_1.default)((0, strip_ansi_1.default)(msg)));
}
expect.extend({
toHaveBeenCalledNormalized(spy, expected) {
const normalizedExpected = nonTTY(expected);
const calls = spy.mock.calls;
const contain = calls.some(args => nonTTY(args.join(' ')).includes(normalizedExpected));
if (contain) {
return {
message: () => `expected not to be a called with ${expected}`,
pass: true,
};
}
const message = `expected to be called with ${expected}`;
return {
message: () => message,
pass: false,
};
},
});
;