Files

36 lines
858 B
JavaScript
Raw Permalink Normal View History

2026-05-25 12:40:10 +10:00
import { plugin as cypressGrepPlugin } from "@cypress/grep/plugin";
2026-01-27 11:22:16 +10:00
import { SwaggerValidation } from "@jc21/cypress-swagger-validation";
import chalk from "chalk";
import backendTask from "./backendApi/task.mjs";
2020-02-19 15:55:06 +11:00
2026-01-27 08:45:23 +10:00
export default (on, config) => {
2020-02-19 15:55:06 +11:00
// Replace swaggerBase config var wildcard
2026-01-27 11:22:16 +10:00
if (typeof config.env.swaggerBase !== "undefined") {
config.env.swaggerBase = config.env.swaggerBase.replace(
"{{baseUrl}}",
config.baseUrl,
);
2020-02-19 15:55:06 +11:00
}
2026-05-25 12:40:10 +10:00
cypressGrepPlugin(config);
2020-02-19 15:55:06 +11:00
// Plugin Events
2026-01-27 11:22:16 +10:00
on("task", SwaggerValidation(config));
on("task", backendTask(config));
on("task", {
2020-02-19 15:55:06 +11:00
log(message) {
2026-01-27 11:22:16 +10:00
console.log(
`${chalk.cyan.bold("[")}${chalk.blue.bold("LOG")}${chalk.cyan.bold("]")} ${chalk.red.bold(message)}`,
);
2020-02-19 15:55:06 +11:00
return null;
2026-01-27 11:22:16 +10:00
},
2020-02-19 15:55:06 +11:00
});
2026-05-25 12:40:10 +10:00
on("task", {
getFixturesFolder() {
2026-05-25 12:40:10 +10:00
return config.fixturesFolder;
},
});
2020-02-19 15:55:06 +11:00
return config;
};