mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-08 18:39:20 +08:00
fix: Allow skip demo image (#56890)
Co-authored-by: lijianan <574980606@qq.com>
This commit is contained in:
@@ -303,22 +303,22 @@ export function imageDemoTest(component: string, options: Options = {}) {
|
||||
});
|
||||
|
||||
files.forEach((file) => {
|
||||
if (Array.isArray(options.skip) && options.skip.includes(path.basename(file))) {
|
||||
describeMethod = describe.skip;
|
||||
} else {
|
||||
describeMethod = describe;
|
||||
}
|
||||
const shouldSkip = Array.isArray(options.skip) && options.skip.includes(path.basename(file));
|
||||
describeMethod = shouldSkip ? describe.skip : describe;
|
||||
|
||||
describeMethod(`Test ${file} image`, () => {
|
||||
let Demo = require(`../../${file}`).default;
|
||||
if (typeof Demo === 'function') {
|
||||
Demo = <Demo />;
|
||||
}
|
||||
imageTest(Demo, `${component}-${path.basename(file, '.tsx')}`, file, getTestOption(file));
|
||||
// Only require the demo file if it's not skipped to avoid dependency issues
|
||||
if (!shouldSkip) {
|
||||
let Demo = require(`../../${file}`).default;
|
||||
if (typeof Demo === 'function') {
|
||||
Demo = <Demo />;
|
||||
}
|
||||
imageTest(Demo, `${component}-${path.basename(file, '.tsx')}`, file, getTestOption(file));
|
||||
|
||||
// Check if need mobile test
|
||||
if ((options.mobile || []).includes(path.basename(file))) {
|
||||
mobileDemos.push([file, Demo]);
|
||||
// Check if need mobile test
|
||||
if ((options.mobile || []).includes(path.basename(file))) {
|
||||
mobileDemos.push([file, Demo]);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user