@nx-dotnet/core
Advanced tools
Comparing version
@@ -8,4 +8,4 @@ { | ||
"dependencies": { | ||
"@nx-dotnet/dotnet": "0.1.5-dev.15", | ||
"@nx-dotnet/utils": "0.1.5-dev.15", | ||
"@nx-dotnet/dotnet": "0.1.5-dev.19", | ||
"@nx-dotnet/utils": "0.1.5-dev.19", | ||
"glob": "^7.1.6", | ||
@@ -16,5 +16,5 @@ "rimraf": "^3.0.2", | ||
}, | ||
"version": "0.1.5-dev.15", | ||
"version": "0.1.5-dev.19", | ||
"typings": "./src/index.d.ts", | ||
"peerDependencies": {} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { readProjectConfiguration, Tree } from '@nrwl/devkit'; | ||
import { Tree } from '@nrwl/devkit'; | ||
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; | ||
@@ -8,4 +8,7 @@ | ||
import { NxDotnetGeneratorSchema } from './schema'; | ||
import * as mockedProjectGenerator from '../utils/generate-project'; | ||
describe('nx-dotnet app generator', () => { | ||
jest.mock('../utils/generate-project'); | ||
describe('nx-dotnet library generator', () => { | ||
let appTree: Tree; | ||
@@ -17,5 +20,5 @@ let dotnetClient: DotNetClient; | ||
language: 'C#', | ||
template: 'mvc', | ||
"test-template": 'none', | ||
skipOutputPathManipulation: true | ||
template: 'webapi', | ||
'test-template': 'none', | ||
skipOutputPathManipulation: true, | ||
}; | ||
@@ -25,3 +28,3 @@ | ||
appTree = createTreeWithEmptyWorkspace(); | ||
dotnetClient = new DotNetClient(mockDotnetFactory()) | ||
dotnetClient = new DotNetClient(mockDotnetFactory()); | ||
}); | ||
@@ -31,5 +34,12 @@ | ||
await generator(appTree, options, dotnetClient); | ||
const config = readProjectConfiguration(appTree, 'test'); | ||
expect(config).toBeDefined(); | ||
}); | ||
it('should call project generator with application project type', async () => { | ||
const projectGenerator = (mockedProjectGenerator as jest.Mocked< | ||
typeof mockedProjectGenerator | ||
>).GenerateProject; | ||
await generator(appTree, options, dotnetClient); | ||
expect(projectGenerator).toHaveBeenCalledWith(appTree, options, dotnetClient, 'application'); | ||
}); | ||
}); |
@@ -25,3 +25,2 @@ "use strict"; | ||
if (!host.isFile('.gitignore')) { | ||
console.warn('Not updating gitignore because it is not present!'); | ||
return; | ||
@@ -28,0 +27,0 @@ } |
@@ -8,4 +8,4 @@ import { Tree } from '@nrwl/devkit'; | ||
import { NxDotnetGeneratorSchema } from './schema'; | ||
import * as mockedProjectGenerator from '../utils/generate-project'; | ||
jest.mock('../utils/generate-project'); | ||
@@ -21,4 +21,4 @@ | ||
template: 'classlib', | ||
"test-template": 'none', | ||
skipOutputPathManipulation: true | ||
'test-template': 'none', | ||
skipOutputPathManipulation: true, | ||
}; | ||
@@ -34,2 +34,11 @@ | ||
}); | ||
it('should call project generator with library project type', async () => { | ||
const projectGenerator = (mockedProjectGenerator as jest.Mocked< | ||
typeof mockedProjectGenerator | ||
>).GenerateProject; | ||
await generator(appTree, options, dotnetClient); | ||
expect(projectGenerator).toHaveBeenCalledWith(appTree, options, dotnetClient, 'library'); | ||
}); | ||
}); |
@@ -46,3 +46,3 @@ import { readProjectConfiguration, Tree } from '@nrwl/devkit'; | ||
it('should run successfully for applications', async () => { | ||
await GenerateProject(appTree, options, dotnetClient, 'library'); | ||
await GenerateProject(appTree, options, dotnetClient, 'application'); | ||
const config = readProjectConfiguration(appTree, 'test'); | ||
@@ -72,6 +72,6 @@ expect(config).toBeDefined(); | ||
.childNamed('PropertyGroup') | ||
?.childNamed('OutputPath')?.val; | ||
?.childNamed('OutputPath')?.val as string; | ||
expect(outputPath).toBeTruthy(); | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const absolute = resolve(config.root, outputPath!); | ||
const absolute = resolve(config.root, outputPath); | ||
const relativeOutput = relative(process.cwd(), absolute); | ||
@@ -78,0 +78,0 @@ |
Sorry, the diff of this file is not supported yet
58443
1.23%1141
1.24%+ Added
+ Added
- Removed
- Removed