Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating L0 for DotNetCoreCLIV2 task #10773

Merged
merged 4 commits into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Tasks/DotNetCoreCLIV2/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,13 @@ describe('DotNetCoreExe Suite', function () {


it('publish works with publishWebProjects option if .csproj have Microsoft.Net.Sdk.Web', (done: MochaDone) => {
process.env["__projects__"] = "havesdk*/*.csproj;";
process.env["__publishWebProjects__"] = "true";
let tp = path.join(__dirname, 'publishInputs.js')
process.env["__projects__"] = "validateWebProject.csproj";
process.env["workingDirectory"] = ".";
process.env["__publishWebProject__"] = "true";
let tp = path.join(__dirname, 'validateWebProject.js')
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
tr.run();

assert(tr.invokedToolCount == 1, 'should have invoked been invoked once');
assert(tr.succeeded, 'task should have failed');
assert(tr.succeeded, 'task should have succeeded');
issacnitin marked this conversation as resolved.
Show resolved Hide resolved
done();
})

Expand Down
6 changes: 0 additions & 6 deletions Tasks/DotNetCoreCLIV2/Tests/publishInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
"code": 1,
"stdout": "not published",
"stderr": ""
},
"dotnet publish havesdk/project.csproj": {
"code": 0,
"stdout": "published",
"stderr": ""
}
},
"findMatch": {
Expand All @@ -103,7 +98,6 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
"*fail*/project.json": [],
"*customoutput/project.json": ["web3/project.json", "lib2/project.json"],
"dummy/project.json": ["dummy/project.json"],
"havesdk*/*.csproj": ["havesdk/project.csproj"],
"" : []
}
};
Expand Down
17 changes: 17 additions & 0 deletions Tasks/DotNetCoreCLIV2/Tests/validateWebProject.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Include="Controllers/ValuesController.fs" />
<Compile Include="Startup.fs" />
<Compile Include="Program.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

</Project>
42 changes: 42 additions & 0 deletions Tasks/DotNetCoreCLIV2/Tests/validateWebProject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import ma = require('azure-pipelines-task-lib/mock-answer');
import tmrm = require('azure-pipelines-task-lib/mock-run');
import path = require('path');

let taskPath = path.join(__dirname, '..', 'dotnetcore.js');
let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);

tmr.setInput('command', "publish");
tmr.setInput('projects', process.env["__projects__"]);
tmr.setInput('publishWebProjects', process.env["__publishWebProjects__"] && process.env["__publishWebProjects__"] == "true" ? "true" : "false");
tmr.setInput('arguments', process.env["__arguments__"] ? process.env["__arguments__"] : "");
tmr.setInput('modifyOutputPath', process.env["modifyOutput"] == "false" ? "false" : "true");
tmr.setInput('zipAfterPublish', process.env["zipAfterPublish"] ? process.env["zipAfterPublish"] : "false");
tmr.setInput('workingDirectory', process.env["workingDirectory"] ? process.env["workingDirectory"] : "");

process.env['TASK_TEST_TRACE'] = "true";

var projectFile = path.join(__dirname, 'validateWebProject.csproj');
issacnitin marked this conversation as resolved.
Show resolved Hide resolved
var execCommand = "dotnet publish " + projectFile

let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
"which": {
"dotnet": "dotnet",
},
"checkPath": { "dotnet": true },
"exec": {},
"findMatch": {
"**/*.csproj\n**/*.vbproj\n**/*.fsproj": [projectFile]
}
}

a['exec'][execCommand] = {
"code": 0,
"stdout": "published",
"stderr": ""
}

process.env["MOCK_NORMALIZE_SLASHES"] = "true";
tmr.setAnswers(a)
tmr.registerMock('azure-pipelines-task-lib/toolrunner', require('azure-pipelines-task-lib/mock-toolrunner'));

tmr.run();