diff --git a/tests/edit.test.ts b/tests/edit.test.ts index d2d9f67..0a32ab3 100644 --- a/tests/edit.test.ts +++ b/tests/edit.test.ts @@ -243,7 +243,8 @@ describe('planEdits: old -> new, the diff per file, the checks', () => { describe('CLI: storebound edit on a copy of the demo app', () => { const copy = (): string => { const dir = mkdtempSync(join(tmpdir(), 'sb-edit-')); - cpSync(join(ROOT, 'examples', 'demo-app'), dir, { recursive: true }); + // only the tracked example: the gitignored .storebound/, renders, frames and video of a local checkout stay out + cpSync(join(ROOT, 'examples', 'demo-app'), dir, { recursive: true, filter: (src) => !/(^|[\\/])(\.storebound|renders|frames|video)([\\/]|$)/.test(src.slice(join(ROOT, 'examples', 'demo-app').length)) }); return dir; }; test('--show lists what the editors show', async () => { diff --git a/tools/desktop-boot-check.ts b/tools/desktop-boot-check.ts index 7e76f41..40af562 100644 --- a/tools/desktop-boot-check.ts +++ b/tools/desktop-boot-check.ts @@ -862,7 +862,7 @@ async function runEditorCase(browser: Browser, sidecar: Sidecar): Promise(); const logged: string[] = []; const dir = mkdtempSync(join(tmpdir(), 'sb-boot-editor-')); - cpSync(join(EXAMPLES, 'demo-app'), dir, { recursive: true }); + copyExample('demo-app', dir); const appstore = join(dir, 'store', 'appstore.md'); const before = { md: readFileSync(appstore, 'utf8'), cfg: readFileSync(join(dir, 'storebound.config.ts'), 'utf8') }; const fx = loadFixture('empty'); @@ -991,6 +991,15 @@ const ART_PULL_DRY = 'add store/renders/en/ios69/ 2 files (01.png .. 02.pn /** A 1x1 PNG as the thumbnail art.thumb answers. */ const THUMB = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGNgYGAAAAAEAAH2FzhVAAAAAElFTkSuQmCC'; +/** Copies an example as git has it: the example's own .gitignore entries (a local .storebound/, renders, frames) stay + * out, so a checkout with generated files behaves like CI's clean one. */ +function copyExample(name: string, dir: string): void { + const src = join(EXAMPLES, name); + const ignored = (existsSync(join(src, '.gitignore')) ? readFileSync(join(src, '.gitignore'), 'utf8') : '') + .split('\n').map(l => l.trim()).filter(l => l && !l.startsWith('#')).map(l => l.replace(/^\/|\/$/g, '')); + cpSync(src, dir, { recursive: true, filter: f => { const rel = f.slice(src.length + 1).split('\\').join('/'); return !ignored.some(i => rel === i || rel.startsWith(`${i}/`)); } }); +} + /** * The Store art tab of an app folder with pulled art: the live store art (art.live, canned) draws its thumbnails * (art.thumb data: URLs) with same / differs / not pulled per image, "Pull from stores" goes through the confirm dialog @@ -1008,7 +1017,7 @@ async function runLiveArtCase(browser: Browser, sidecar: Sidecar): Promise(); const logged: string[] = []; const dir = mkdtempSync(join(tmpdir(), 'sb-boot-art-')); - cpSync(join(EXAMPLES, 'demo-app'), dir, { recursive: true }); + copyExample('demo-app', dir); // a pulled Play screenshot in the renders folder (a real PNG, so the gallery and the replace dry run read it) const { encodePng } = await import('../tests/build-fixtures'); const shot = encodePng(540, 960, () => [40, 120, 200], { colorType: 2 });