|
1 |
| -import { beforeAll, expect, test } from 'vitest'; |
2 |
| -import { $ } from 'zx'; |
3 | 1 | import fs from 'fs';
|
4 | 2 | import path from 'path';
|
| 3 | +import { beforeAll, expect, test } from 'vitest'; |
| 4 | +import { $ } from 'zx'; |
5 | 5 |
|
6 | 6 | const dir = '__tmp__';
|
7 | 7 | const filename = 'test-vue.md';
|
8 | 8 | const filepath = path.join(dir, filename);
|
9 | 9 |
|
10 |
| -beforeAll(() => { |
| 10 | +beforeAll(async () => { |
11 | 11 | if (!fs.existsSync(dir)) fs.mkdirSync(dir);
|
| 12 | + await $`npm run build`; |
12 | 13 | });
|
13 | 14 |
|
14 | 15 | // TODO 現状、--config-file で指定するパスは -d からの相対パスだが、将来的には -d をなくしたい。その移行のため --config-file での指定は、-d を無視したカレントディレクトリからの相対パスで設定ファイルを優先し、なければ -d からの相対パスで探すようにしたい。
|
15 | 16 |
|
16 | 17 | test('run:sample', async () => {
|
17 |
| - await $`npx tsx ./src/cli/entry.ts --tsconfig './dummy_project/tsconfig.json' --md ${filepath} --vue`; |
| 18 | + await $`node ./bin/tsg.js --tsconfig './dummy_project/tsconfig.json' --md ${filepath} --vue`; |
18 | 19 |
|
19 | 20 | const file = fs.readFileSync(filepath, { encoding: 'utf-8' });
|
20 | 21 | expect(file).toMatchInlineSnapshot(`
|
@@ -124,7 +125,7 @@ test('run:sample', async () => {
|
124 | 125 | });
|
125 | 126 |
|
126 | 127 | test('run:sample:argument-include', async () => {
|
127 |
| - await $`npx tsx ./src/cli/entry.ts includeFiles config --tsconfig './dummy_project/tsconfig.json' --md ${filepath} --vue`; |
| 128 | + await $`node ./bin/tsg.js includeFiles config --tsconfig './dummy_project/tsconfig.json' --md ${filepath} --vue`; |
128 | 129 |
|
129 | 130 | const file = fs.readFileSync(filepath, { encoding: 'utf-8' });
|
130 | 131 | expect(file).toMatchInlineSnapshot(`
|
@@ -219,7 +220,7 @@ test('run:sample:argument-include', async () => {
|
219 | 220 | });
|
220 | 221 |
|
221 | 222 | test('run:sample:include', async () => {
|
222 |
| - await $`npx tsx ./src/cli/entry.ts --tsconfig './dummy_project/tsconfig.json' --include includeFiles config --md ${filepath} --vue`; |
| 223 | + await $`node ./bin/tsg.js --tsconfig './dummy_project/tsconfig.json' --include includeFiles config --md ${filepath} --vue`; |
223 | 224 |
|
224 | 225 | const file = fs.readFileSync(filepath, { encoding: 'utf-8' });
|
225 | 226 | expect(file).toMatchInlineSnapshot(`
|
@@ -314,7 +315,7 @@ test('run:sample:include', async () => {
|
314 | 315 | });
|
315 | 316 |
|
316 | 317 | test('run:sample:exclude', async () => {
|
317 |
| - await $`npx tsx ./src/cli/entry.ts --tsconfig './dummy_project/tsconfig.json' --include includeFiles config --exclude excludeFiles utils --md ${filepath} --vue`; |
| 318 | + await $`node ./bin/tsg.js --tsconfig './dummy_project/tsconfig.json' --include includeFiles config --exclude excludeFiles utils --md ${filepath} --vue`; |
318 | 319 |
|
319 | 320 | const file = fs.readFileSync(filepath, { encoding: 'utf-8' });
|
320 | 321 | expect(file).toMatchInlineSnapshot(`
|
@@ -381,7 +382,7 @@ test('run:sample:exclude', async () => {
|
381 | 382 | });
|
382 | 383 |
|
383 | 384 | test('run:sample:abstraction', async () => {
|
384 |
| - await $`npx tsx ./src/cli/entry.ts --tsconfig './dummy_project/tsconfig.json' --include includeFiles config --exclude excludeFiles utils --abstraction abstractions --md ${filepath} --vue`; |
| 385 | + await $`node ./bin/tsg.js --tsconfig './dummy_project/tsconfig.json' --include includeFiles config --exclude excludeFiles utils --abstraction abstractions --md ${filepath} --vue`; |
385 | 386 |
|
386 | 387 | const file = fs.readFileSync(filepath, { encoding: 'utf-8' });
|
387 | 388 | expect(file).toMatchInlineSnapshot(`
|
@@ -439,7 +440,7 @@ test('run:sample:abstraction', async () => {
|
439 | 440 | });
|
440 | 441 |
|
441 | 442 | test('run:sample:highlight', async () => {
|
442 |
| - await $`npx tsx ./src/cli/entry.ts --tsconfig './dummy_project/tsconfig.json' --include includeFiles config --exclude excludeFiles utils --abstraction abstractions --highlight config.ts b.ts --md ${filepath} --vue`; |
| 443 | + await $`node ./bin/tsg.js --tsconfig './dummy_project/tsconfig.json' --include includeFiles config --exclude excludeFiles utils --abstraction abstractions --highlight config.ts b.ts --md ${filepath} --vue`; |
443 | 444 |
|
444 | 445 | const file = fs.readFileSync(filepath, { encoding: 'utf-8' });
|
445 | 446 | expect(file).toMatchInlineSnapshot(`
|
|
0 commit comments