|
| 1 | +import*astsfrom"../../_namespaces/ts.js"; |
| 2 | +import{jsonToReadableText}from"../helpers.js"; |
| 3 | +import{verifyTsc}from"../helpers/tsc.js"; |
| 4 | +import{TestServerHost}from"../helpers/virtualFileSystemWithWatch.js"; |
| 5 | + |
| 6 | +describe("unittests:: tsc:: ignoreConfig::",()=>{ |
| 7 | +functionsysWithoutConfig(){ |
| 8 | +returnTestServerHost.createWatchedSystem({ |
| 9 | +"/home/src/workspaces/project/src/a.ts":"export const a = 10;", |
| 10 | +"/home/src/workspaces/project/src/b.ts":"export const b = 10;", |
| 11 | +"/home/src/workspaces/project/c.ts":"export const c = 10;", |
| 12 | +}); |
| 13 | +} |
| 14 | +functionsysWithConfig(){ |
| 15 | +constsys=sysWithoutConfig(); |
| 16 | +sys.writeFile( |
| 17 | +"/home/src/workspaces/project/tsconfig.json", |
| 18 | +jsonToReadableText({ |
| 19 | +include:["src"], |
| 20 | +}), |
| 21 | +); |
| 22 | +returnsys; |
| 23 | +} |
| 24 | +functionrunScenario(subScenario:string,commandLineArgs:readonlystring[]){ |
| 25 | +verifyTsc({ |
| 26 | +scenario:"ignoreConfig", |
| 27 | + subScenario, |
| 28 | +sys:sysWithConfig, |
| 29 | + commandLineArgs, |
| 30 | +}); |
| 31 | + |
| 32 | +verifyTsc({ |
| 33 | +scenario:"ignoreConfig", |
| 34 | +subScenario:subScenario+" with --ignoreConfig", |
| 35 | +sys:sysWithConfig, |
| 36 | +commandLineArgs:commandLineArgs.concat("--ignoreConfig"), |
| 37 | +}); |
| 38 | + |
| 39 | +verifyTsc({ |
| 40 | +scenario:"ignoreConfig", |
| 41 | +subScenario:subScenario+" when config file absent", |
| 42 | +sys:sysWithoutConfig, |
| 43 | + commandLineArgs, |
| 44 | +}); |
| 45 | + |
| 46 | +verifyTsc({ |
| 47 | +scenario:"ignoreConfig", |
| 48 | +subScenario:subScenario+" when config file absent with --ignoreConfig", |
| 49 | +sys:sysWithoutConfig, |
| 50 | +commandLineArgs:commandLineArgs.concat("--ignoreConfig"), |
| 51 | +}); |
| 52 | +} |
| 53 | + |
| 54 | +runScenario("without any options",ts.emptyArray); |
| 55 | +runScenario("specifying files",["src/a.ts"]); |
| 56 | +runScenario("specifying project",["-p","."]); |
| 57 | +runScenario("mixing project and files",["-p",".","src/a.ts","c.ts"]); |
| 58 | +}); |