mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +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) => {
|
files.forEach((file) => {
|
||||||
if (Array.isArray(options.skip) && options.skip.includes(path.basename(file))) {
|
const shouldSkip = Array.isArray(options.skip) && options.skip.includes(path.basename(file));
|
||||||
describeMethod = describe.skip;
|
describeMethod = shouldSkip ? describe.skip : describe;
|
||||||
} else {
|
|
||||||
describeMethod = describe;
|
|
||||||
}
|
|
||||||
|
|
||||||
describeMethod(`Test ${file} image`, () => {
|
describeMethod(`Test ${file} image`, () => {
|
||||||
let Demo = require(`../../${file}`).default;
|
// Only require the demo file if it's not skipped to avoid dependency issues
|
||||||
if (typeof Demo === 'function') {
|
if (!shouldSkip) {
|
||||||
Demo = <Demo />;
|
let Demo = require(`../../${file}`).default;
|
||||||
}
|
if (typeof Demo === 'function') {
|
||||||
imageTest(Demo, `${component}-${path.basename(file, '.tsx')}`, file, getTestOption(file));
|
Demo = <Demo />;
|
||||||
|
}
|
||||||
|
imageTest(Demo, `${component}-${path.basename(file, '.tsx')}`, file, getTestOption(file));
|
||||||
|
|
||||||
// Check if need mobile test
|
// Check if need mobile test
|
||||||
if ((options.mobile || []).includes(path.basename(file))) {
|
if ((options.mobile || []).includes(path.basename(file))) {
|
||||||
mobileDemos.push([file, Demo]);
|
mobileDemos.push([file, Demo]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user