@testplane/storybook
Version:
Testplane plugin that enables runtime screenshot storybook tests autogeneration
22 lines • 1.27 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractStories = exports.storybookDataJsonPaths = void 0;
const constants_1 = require("../../../constants");
const v3_1 = require("./v3");
const v4_1 = require("./v4");
const logger_1 = __importDefault(require("../../../logger"));
exports.storybookDataJsonPaths = [v3_1.storybookDataJsonPathV3, v4_1.storybookDataJsonPathV4];
const extractStories = (storiesJson) => {
if (!constants_1.STORYBOOK_JSON_SUPPORTED_VERSIONS.includes(storiesJson.v)) {
logger_1.default.warn("Unsupported version of stories json");
logger_1.default.warn(`'${constants_1.STORYBOOK_JSON_SUPPORTED_VERSIONS.join(", ")}' expected, but ${storiesJson.v} found`);
logger_1.default.warn("I'll try to do my best with it! (acting like it's v4)");
}
// Using "extractStoriesV4" for storiesJson 5 version, as it is compatible
return storiesJson.v === v3_1.supportedStoryVersionV3 ? (0, v3_1.extractStoriesV3)(storiesJson) : (0, v4_1.extractStoriesV4)(storiesJson);
};
exports.extractStories = extractStories;
//# sourceMappingURL=index.js.map