forked from stackblitz/tutorialkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinline-content.test.ts
More file actions
33 lines (28 loc) · 989 Bytes
/
inline-content.test.ts
File metadata and controls
33 lines (28 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import fs from 'node:fs/promises';
import path from 'node:path';
import { getInlineContentForPackage } from '@tutorialkit/theme';
import { execa } from 'execa';
import { temporaryDirectory } from 'tempy';
import { afterAll, expect, test } from 'vitest';
const baseDir = path.resolve(__dirname, '../..');
const cli = path.join(baseDir, 'packages/cli/dist/index.js');
const tmp = temporaryDirectory();
afterAll(
async () => {
await fs.rm(tmp, { force: true, recursive: true });
},
process.env.CI ? 60_000 : 10_000,
);
test('getInlineContentForPackage finds files from @tutorialkit/astro', async () => {
await execa(
'node',
[cli, 'create', 'theme-test', '--install', '--no-git', '--no-start', '--package-manager', 'pnpm', '--defaults'],
{ cwd: tmp },
);
const content = getInlineContentForPackage({
name: '@tutorialkit/astro',
pattern: '/dist/default/**/*.astro',
root: `${tmp}/theme-test`,
});
expect(content.length).toBeGreaterThan(0);
});