@@ -11,15 +11,17 @@ beforeAll(() => {
1111 if ( ! fs . existsSync ( dir ) ) fs . mkdirSync ( dir ) ;
1212} ) ;
1313
14+ // TODO 現状、--config-file で指定するパスは -d からの相対パスだが、将来的には -d をなくしたい。その移行のため --config-file での指定は、-d を無視したカレントディレクトリからの相対パスで設定ファイルを優先し、なければ -d からの相対パスで探すようにしたい。
15+
1416test ( 'run:sample' , async ( ) => {
15- await $ `ts-node -O '{\"module\": \"commonjs\"}' ./src/index.ts -d './dummy_project' --md ${ filepath } ` ;
17+ await $ `ts-node -O '{\"module\": \"commonjs\"}' ./src/index.ts --tsconfig './dummy_project/tsconfig.json ' --md ${ filepath } ` ;
1618
1719 const file = fs . readFileSync ( filepath , { encoding : 'utf-8' } ) ;
1820 expect ( file ) . toMatchInlineSnapshot ( `
1921 "# TypeScript Graph
2022
2123 \`\`\`bash
22- tsg -d ./dummy_project --md __tmp__/test.md
24+ tsg --tsconfig ./dummy_project/tsconfig.json --md __tmp__/test.md
2325 \`\`\`
2426
2527 \`\`\`mermaid
@@ -115,14 +117,14 @@ test('run:sample', async () => {
115117} ) ;
116118
117119test ( 'run:sample:argument-include' , async ( ) => {
118- await $ `ts-node -O '{\"module\": \"commonjs\"}' ./src/index.ts includeFiles config -d './dummy_project' --md ${ filepath } ` ;
120+ await $ `ts-node -O '{\"module\": \"commonjs\"}' ./src/index.ts includeFiles config --tsconfig './dummy_project/tsconfig.json ' --md ${ filepath } ` ;
119121
120122 const file = fs . readFileSync ( filepath , { encoding : 'utf-8' } ) ;
121123 expect ( file ) . toMatchInlineSnapshot ( `
122124 "# TypeScript Graph
123125
124126 \`\`\`bash
125- tsg includeFiles config -d ./dummy_project --md __tmp__/test.md
127+ tsg includeFiles config --tsconfig ./dummy_project/tsconfig.json --md __tmp__/test.md
126128 \`\`\`
127129
128130 \`\`\`mermaid
@@ -203,14 +205,14 @@ test('run:sample:argument-include', async () => {
203205} ) ;
204206
205207test ( 'run:sample:include' , async ( ) => {
206- await $ `ts-node -O '{\"module\": \"commonjs\"}' ./src/index.ts -d './dummy_project' --include includeFiles config --md ${ filepath } ` ;
208+ await $ `ts-node -O '{\"module\": \"commonjs\"}' ./src/index.ts --tsconfig './dummy_project/tsconfig.json ' --include includeFiles config --md ${ filepath } ` ;
207209
208210 const file = fs . readFileSync ( filepath , { encoding : 'utf-8' } ) ;
209211 expect ( file ) . toMatchInlineSnapshot ( `
210212 "# TypeScript Graph
211213
212214 \`\`\`bash
213- tsg -d ./dummy_project --include includeFiles config --md __tmp__/test.md
215+ tsg --tsconfig ./dummy_project/tsconfig.json --include includeFiles config --md __tmp__/test.md
214216 \`\`\`
215217
216218 \`\`\`mermaid
@@ -291,14 +293,14 @@ test('run:sample:include', async () => {
291293} ) ;
292294
293295test ( 'run:sample:exclude' , async ( ) => {
294- await $ `ts-node -O '{\"module\": \"commonjs\"}' ./src/index.ts -d './dummy_project' --include includeFiles config --exclude excludeFiles utils --md ${ filepath } ` ;
296+ await $ `ts-node -O '{\"module\": \"commonjs\"}' ./src/index.ts --tsconfig './dummy_project/tsconfig.json ' --include includeFiles config --exclude excludeFiles utils --md ${ filepath } ` ;
295297
296298 const file = fs . readFileSync ( filepath , { encoding : 'utf-8' } ) ;
297299 expect ( file ) . toMatchInlineSnapshot ( `
298300 "# TypeScript Graph
299301
300302 \`\`\`bash
301- tsg -d ./dummy_project --include includeFiles config --exclude excludeFiles utils --md __tmp__/test.md
303+ tsg --tsconfig ./dummy_project/tsconfig.json --include includeFiles config --exclude excludeFiles utils --md __tmp__/test.md
302304 \`\`\`
303305
304306 \`\`\`mermaid
@@ -351,14 +353,14 @@ test('run:sample:exclude', async () => {
351353} ) ;
352354
353355test ( 'run:sample:abstraction' , async ( ) => {
354- await $ `ts-node -O '{\"module\": \"commonjs\"}' ./src/index.ts -d './dummy_project' --include includeFiles config --exclude excludeFiles utils --abstraction abstractions --md ${ filepath } ` ;
356+ await $ `ts-node -O '{\"module\": \"commonjs\"}' ./src/index.ts --tsconfig './dummy_project/tsconfig.json ' --include includeFiles config --exclude excludeFiles utils --abstraction abstractions --md ${ filepath } ` ;
355357
356358 const file = fs . readFileSync ( filepath , { encoding : 'utf-8' } ) ;
357359 expect ( file ) . toMatchInlineSnapshot ( `
358360 "# TypeScript Graph
359361
360362 \`\`\`bash
361- tsg -d ./dummy_project --include includeFiles config --exclude excludeFiles utils --abstraction abstractions --md __tmp__/test.md
363+ tsg --tsconfig ./dummy_project/tsconfig.json --include includeFiles config --exclude excludeFiles utils --abstraction abstractions --md __tmp__/test.md
362364 \`\`\`
363365
364366 \`\`\`mermaid
@@ -402,14 +404,14 @@ test('run:sample:abstraction', async () => {
402404} ) ;
403405
404406test ( 'run:sample:highlight' , async ( ) => {
405- await $ `ts-node -O '{\"module\": \"commonjs\"}' ./src/index.ts -d './dummy_project' --include includeFiles config --exclude excludeFiles utils --abstraction abstractions --highlight config.ts b.ts --md ${ filepath } ` ;
407+ await $ `ts-node -O '{\"module\": \"commonjs\"}' ./src/index.ts --tsconfig './dummy_project/tsconfig.json ' --include includeFiles config --exclude excludeFiles utils --abstraction abstractions --highlight config.ts b.ts --md ${ filepath } ` ;
406408
407409 const file = fs . readFileSync ( filepath , { encoding : 'utf-8' } ) ;
408410 expect ( file ) . toMatchInlineSnapshot ( `
409411 "# TypeScript Graph
410412
411413 \`\`\`bash
412- tsg -d ./dummy_project --include includeFiles config --exclude excludeFiles utils --abstraction abstractions --highlight config.ts b.ts --md __tmp__/test.md
414+ tsg --tsconfig ./dummy_project/tsconfig.json --include includeFiles config --exclude excludeFiles utils --abstraction abstractions --highlight config.ts b.ts --md __tmp__/test.md
413415 \`\`\`
414416
415417 \`\`\`mermaid
0 commit comments