5
5
jsonToReadableText ,
6
6
} from "../helpers" ;
7
7
import {
8
+ getSampleProjectConfigWithNodeNext ,
8
9
getSysForSampleProjectReferences ,
9
10
} from "../helpers/sampleProjectReferences" ;
10
11
import {
@@ -27,54 +28,63 @@ import {
27
28
} from "../helpers/virtualFileSystemWithWatch" ;
28
29
29
30
describe ( "unittests:: tsc-watch:: projects with references: invoking when references are already built" , ( ) => {
30
- verifyTscWatch ( {
31
- scenario : "projectsWithReferences" ,
32
- subScenario : "on sample project" ,
33
- sys : ( ) =>
34
- solutionBuildWithBaseline (
35
- getSysForSampleProjectReferences ( ) ,
36
- [ "tests" ] ,
37
- ) ,
38
- commandLineArgs : [ "-w" , "-p" , "tests" , "--traceResolution" , "--explainFiles" ] ,
39
- edits : [
40
- {
41
- caption : "local edit in logic ts, and build logic" ,
42
- edit : sys => {
43
- sys . appendFile ( "/user/username/projects/sample1/logic/index.ts" , `function foo() { }` ) ;
44
- const solutionBuilder = createSolutionBuilder ( sys , [ "logic" ] ) ;
45
- solutionBuilder . build ( ) ;
31
+ function verify ( withNodeNext : boolean ) {
32
+ verifyTscWatch ( {
33
+ scenario : "projectsWithReferences" ,
34
+ subScenario : `on sample project${ withNodeNext ? " with nodenext" : "" } ` ,
35
+ sys : ( ) =>
36
+ solutionBuildWithBaseline (
37
+ getSysForSampleProjectReferences ( withNodeNext ) ,
38
+ [ "tests" ] ,
39
+ ) ,
40
+ commandLineArgs : [ "-w" , "-p" , "tests" , "--traceResolution" , "--explainFiles" ] ,
41
+ edits : [
42
+ {
43
+ caption : "local edit in logic ts, and build logic" ,
44
+ edit : sys => {
45
+ sys . appendFile ( "/user/username/projects/sample1/logic/index.ts" , `function foo() { }` ) ;
46
+ const solutionBuilder = createSolutionBuilder ( sys , [ "logic" ] ) ;
47
+ solutionBuilder . build ( ) ;
48
+ } ,
49
+ // not ideal, but currently because of d.ts but no new file is written
50
+ // There will be timeout queued even though file contents are same
51
+ timeouts : noop ,
46
52
} ,
47
- // not ideal, but currently because of d.ts but no new file is written
48
- // There will be timeout queued even though file contents are same
49
- timeouts : noop ,
50
- } ,
51
- {
52
- caption : "non local edit in logic ts, and build logic" ,
53
- edit : sys => {
54
- sys . appendFile ( "/user/username/projects/sample1/logic/index.ts" , `export function gfoo() { }` ) ;
55
- const solutionBuilder = createSolutionBuilder ( sys , [ "logic" ] ) ;
56
- solutionBuilder . build ( ) ;
53
+ {
54
+ caption : "non local edit in logic ts, and build logic" ,
55
+ edit : sys => {
56
+ sys . appendFile ( "/user/username/projects/sample1/logic/index.ts" , `export function gfoo() { }` ) ;
57
+ const solutionBuilder = createSolutionBuilder ( sys , [ "logic" ] ) ;
58
+ solutionBuilder . build ( ) ;
59
+ } ,
60
+ timeouts : sys => sys . runQueuedTimeoutCallbacks ( ) ,
57
61
} ,
58
- timeouts : sys => sys . runQueuedTimeoutCallbacks ( ) ,
59
- } ,
60
- {
61
- caption : "change in project reference config file builds correctly" ,
62
- edit : sys => {
63
- sys . writeFile (
64
- "/user/username/projects/sample1/logic/tsconfig.json" ,
65
- jsonToReadableText ( {
66
- compilerOptions : { composite : true , declaration : true , declarationDir : "decls" } ,
67
- references : [ { path : "../core" } ] ,
68
- } ) ,
69
- ) ;
70
- const solutionBuilder = createSolutionBuilder ( sys , [ "logic" ] ) ;
71
- solutionBuilder . build ( ) ;
62
+ {
63
+ caption : "change in project reference config file builds correctly" ,
64
+ edit : sys => {
65
+ sys . writeFile (
66
+ "/user/username/projects/sample1/logic/tsconfig.json" ,
67
+ jsonToReadableText ( {
68
+ compilerOptions : {
69
+ ...getSampleProjectConfigWithNodeNext ( withNodeNext ) ,
70
+ composite : true ,
71
+ declaration : true ,
72
+ declarationDir : "decls" ,
73
+ } ,
74
+ references : [ { path : "../core" } ] ,
75
+ } ) ,
76
+ ) ;
77
+ const solutionBuilder = createSolutionBuilder ( sys , [ "logic" ] ) ;
78
+ solutionBuilder . build ( ) ;
79
+ } ,
80
+ timeouts : sys => sys . runQueuedTimeoutCallbacks ( ) ,
72
81
} ,
73
- timeouts : sys => sys . runQueuedTimeoutCallbacks ( ) ,
74
- } ,
75
- ] ,
76
- baselineDependencies : true ,
77
- } ) ;
82
+ ] ,
83
+ baselineDependencies : true ,
84
+ } ) ;
85
+ }
86
+ verify ( /*withNodeNext*/ false ) ;
87
+ verify ( /*withNodeNext*/ true ) ;
78
88
79
89
function changeCompilerOpitonsPaths ( sys : TestServerHost , config : string , newPaths : object ) {
80
90
const configJson = JSON . parse ( sys . readFile ( config ) ! ) ;
0 commit comments