55 listFiles ,
66 readFile ,
77 readJson ,
8+ runCommand ,
89 runNxCommand ,
910 runNxCommandAsync ,
1011 tmpProjPath ,
@@ -18,7 +19,7 @@ import { XmlDocument } from 'xmldoc';
1819
1920import { findProjectFileInPathSync } from '@nx-dotnet/utils' ;
2021import { readDependenciesFromNxDepGraph } from '@nx-dotnet/utils/e2e' ;
21- import { exec , execSync } from 'child_process' ;
22+ import { execSync } from 'child_process' ;
2223import { ensureDirSync } from 'fs-extra' ;
2324import { Workspaces } from '@nrwl/tao/src/shared/workspace' ;
2425
@@ -30,7 +31,7 @@ describe('nx-dotnet e2e', () => {
3031 initializeGitRepo ( e2eDir ) ;
3132 } , 1500000 ) ;
3233
33- xit ( 'should create apps, libs, and project references' , async ( ) => {
34+ it ( 'should create apps, libs, and project references' , async ( ) => {
3435 const testApp = uniq ( 'app' ) ;
3536 const testLib = uniq ( 'lib' ) ;
3637
@@ -49,9 +50,10 @@ describe('nx-dotnet e2e', () => {
4950 expect ( output . stdout ) . toMatch ( / R e f e r e n c e .* a d d e d t o t h e p r o j e c t / ) ;
5051 } ) ;
5152
52- xit ( 'should work with affected' , async ( ) => {
53+ it ( 'should work with affected' , async ( ) => {
5354 const testApp = uniq ( 'app' ) ;
5455 const testLib = uniq ( 'lib' ) ;
56+ runCommand ( 'git checkout -b "affected-tests"' ) ;
5557
5658 await runNxCommandAsync (
5759 `generate @nx-dotnet/core:app ${ testApp } --language="C#" --template="webapi"` ,
@@ -65,18 +67,12 @@ describe('nx-dotnet e2e', () => {
6567 `generate @nx-dotnet/core:project-reference ${ testApp } ${ testLib } ` ,
6668 ) ;
6769
68- const output = await runNxCommandAsync ( 'print-affected --target build' ) ;
69-
70- const deps = await readDependenciesFromNxDepGraph (
71- join ( __dirname , '../../../' , e2eDir ) ,
72- testApp ,
73- ) ;
74-
75- expect ( output . stderr ) . toBeFalsy ( ) ;
70+ const deps = await readDependenciesFromNxDepGraph ( join ( e2eDir ) , testApp ) ;
7671 expect ( deps ) . toContain ( testLib ) ;
72+ runCommand ( 'git checkout main' ) ;
7773 } , 150000 ) ;
7874
79- xdescribe ( 'nx g app' , ( ) => {
75+ describe ( 'nx g app' , ( ) => {
8076 it ( 'should obey dry-run' , async ( ) => {
8177 const app = uniq ( 'app' ) ;
8278 await runNxCommandAsync (
@@ -157,7 +153,7 @@ describe('nx-dotnet e2e', () => {
157153 } ) ;
158154 } ) ;
159155
160- xdescribe ( 'nx g test' , ( ) => {
156+ describe ( 'nx g test' , ( ) => {
161157 it ( 'should add a reference to the target project' , async ( ) => {
162158 const app = uniq ( 'app' ) ;
163159 await runNxCommandAsync (
@@ -203,7 +199,7 @@ describe('nx-dotnet e2e', () => {
203199 } ) ;
204200 } ) ;
205201
206- xdescribe ( 'nx g lib' , ( ) => {
202+ describe ( 'nx g lib' , ( ) => {
207203 it ( 'should obey dry-run' , async ( ) => {
208204 const lib = uniq ( 'lib' ) ;
209205 await runNxCommandAsync (
@@ -223,7 +219,7 @@ describe('nx-dotnet e2e', () => {
223219 } ) ;
224220 } ) ;
225221
226- xdescribe ( 'nx g import-projects' , ( ) => {
222+ describe ( 'nx g import-projects' , ( ) => {
227223 it ( 'should import apps, libs, and test' , async ( ) => {
228224 const testApp = uniq ( 'app' ) ;
229225 const testLib = uniq ( 'lib' ) ;
@@ -257,7 +253,7 @@ describe('nx-dotnet e2e', () => {
257253 } ) ;
258254 } ) ;
259255
260- xdescribe ( 'solution handling' , ( ) => {
256+ describe ( 'solution handling' , ( ) => {
261257 // For solution handling, defaults fall back to if a file exists.
262258 // This ensures that the tests are ran in a clean state, without previous
263259 // test projects interfering with the test.
@@ -360,11 +356,11 @@ describe('nx-dotnet e2e', () => {
360356 expect ( ( ) => runNxCommand ( `build ${ api } ` ) ) . not . toThrow ( ) ;
361357 } ) ;
362358
363- xit ( 'should work without workspace.json or project.json' , ( ) => {
364- const workspaceJsonContents = readJson ( 'workspace.json' ) ;
359+ it ( 'should work without workspace.json or project.json' , ( ) => {
360+ const workspaceJsonContents = readFile ( 'workspace.json' ) ;
365361 unlinkSync ( join ( e2eDir , 'workspace.json' ) ) ;
366362
367- const projectJsonContents = readJson (
363+ const projectJsonContents = readFile (
368364 joinPathFragments ( 'apps' , api , 'project.json' ) ,
369365 ) ;
370366 unlinkSync ( join ( projectFolder , 'project.json' ) ) ;
@@ -373,15 +369,16 @@ describe('nx-dotnet e2e', () => {
373369
374370 writeFileSync ( join ( e2eDir , 'workspace.json' ) , workspaceJsonContents ) ;
375371
376- updateFile ( join ( projectFolder , 'project.json' ) , projectJsonContents ) ;
372+ writeFileSync ( join ( projectFolder , 'project.json' ) , projectJsonContents ) ;
377373 } ) ;
378374 } ) ;
379375} ) ;
380376
381377function initializeGitRepo ( cwd : string ) {
382- execSync ( 'git init' , { cwd } ) ;
383- execSync ( 'git config user.email no-one@some-website.com' , { cwd } ) ;
384- execSync ( 'git config user.name CI-Bot' , { cwd } ) ;
385- execSync ( 'git add .' , { cwd } ) ;
386- execSync ( 'git commit -m "initial commit"' , { cwd } ) ;
378+ runCommand ( 'git init' ) ;
379+ runCommand ( 'git branch -m main' ) ;
380+ runCommand ( 'git config user.email no-one@some-website.com' ) ;
381+ runCommand ( 'git config user.name CI-Bot' ) ;
382+ runCommand ( 'git add .' ) ;
383+ runCommand ( 'git commit -m "initial commit"' ) ;
387384}
0 commit comments