@@ -60,7 +60,7 @@ describe('nx-dotnet e2e', () => {
6060 runCommand ( 'git checkout -b "affected-tests"' ) ;
6161 updateFile ( 'package.json' , ( f ) => {
6262 const json = JSON . parse ( f ) ;
63- json . dependencies [ '@nrwl/angular' ] = 'latest' ;
63+ json . dependencies [ '@nrwl/angular' ] = json . devDependencies [ 'nx' ] ;
6464 return JSON . stringify ( json ) ;
6565 } ) ;
6666 runPackageManagerInstall ( ) ;
@@ -162,7 +162,11 @@ describe('nx-dotnet e2e', () => {
162162 `generate @nx-dotnet/core:app ${ app } --language="C#" --template="webapi"` ,
163163 ) ;
164164 const promise = runNxCommandAsync ( `lint ${ app } ` ) . then ( ( x ) => x . stderr ) ;
165- await expect ( promise ) . resolves . toContain ( 'WHITESPACE' ) ;
165+ await expect ( promise ) . rejects . toThrow (
166+ expect . objectContaining ( {
167+ message : expect . stringContaining ( 'WHITESPACE' ) ,
168+ } ) ,
169+ ) ;
166170 } ) ;
167171 } ) ;
168172
@@ -336,6 +340,7 @@ describe('nx-dotnet e2e', () => {
336340 expect ( slnFile ) . toContain ( app + '-test' ) ;
337341 } ) ;
338342 } ) ;
343+
339344 describe ( 'inferred targets' , ( ) => {
340345 let api : string ;
341346 let projectFolder : string ;
@@ -386,6 +391,37 @@ describe('nx-dotnet e2e', () => {
386391 writeFileSync ( join ( projectFolder , 'project.json' ) , projectJsonContents ) ;
387392 } ) ;
388393 } ) ;
394+
395+ describe ( '@nx-dotnet/core:test' , ( ) => {
396+ it ( 'should test with xunit' , ( ) => {
397+ const appProject = uniq ( 'app' ) ;
398+ const testProject = `${ appProject } -test` ;
399+ runNxCommand (
400+ `generate @nx-dotnet/core:app ${ appProject } --language="C#" --template="webapi" --test-runner xunit` ,
401+ ) ;
402+
403+ expect ( ( ) => runNxCommand ( `test ${ testProject } ` ) ) . not . toThrow ( ) ;
404+
405+ updateFile (
406+ `apps/${ testProject } /UnitTest1.cs` ,
407+ `using Xunit;
408+
409+ namespace Proj.${ names ( appProject ) . className } .Test;
410+
411+ public class UnitTest1
412+ {
413+ // This test should fail, as the e2e test is checking for test failures.
414+ [Fact]
415+ public void Test1()
416+ {
417+ Assert.Equal(1, 2)
418+ }
419+ }` ,
420+ ) ;
421+
422+ expect ( ( ) => runNxCommand ( `test ${ testProject } ` ) ) . toThrow ( ) ;
423+ } ) ;
424+ } ) ;
389425} ) ;
390426
391427function initializeGitRepo ( cwd : string ) {
0 commit comments