Run tests during build
This commit is contained in:
parent
90430b425d
commit
9d6b227226
|
|
@ -60,6 +60,9 @@ default Configuration='Release'
|
||||||
#nuget-install target='install' description='Copy NuGet packages to local repo'
|
#nuget-install target='install' description='Copy NuGet packages to local repo'
|
||||||
nuget-local-publish sourcePackagesDir='${BUILD_DIR}'
|
nuget-local-publish sourcePackagesDir='${BUILD_DIR}'
|
||||||
|
|
||||||
|
#xunit-test target='test' if='Directory.Exists("test")'
|
||||||
|
k-test each='var projectFile in Files.Include("test/**/project.json")'
|
||||||
|
|
||||||
#make-roslyn-fast
|
#make-roslyn-fast
|
||||||
ngen-roslyn
|
ngen-roslyn
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
use namespace='System.Web.Script.Serialization'
|
||||||
|
use assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
|
||||||
|
|
||||||
|
@{/*
|
||||||
|
|
||||||
|
k-test
|
||||||
|
Run unit tests in your project.
|
||||||
|
|
||||||
|
projectFile=''
|
||||||
|
Required. Path to the test project.json to execute
|
||||||
|
|
||||||
|
*/}
|
||||||
|
|
||||||
|
var projectFolder='${Path.GetDirectoryName(projectFile)}'
|
||||||
|
|
||||||
|
k command='test' workingdir='${projectFolder}' if='HasTestCommand(projectFile)'
|
||||||
|
|
||||||
|
functions
|
||||||
|
@{
|
||||||
|
bool HasTestCommand(string projectFile)
|
||||||
|
{
|
||||||
|
var serializer = new JavaScriptSerializer();
|
||||||
|
var projectText = File.ReadAllText(projectFile);
|
||||||
|
var project = (Dictionary<string, object>)serializer.DeserializeObject(projectText);
|
||||||
|
|
||||||
|
object commandsObject;
|
||||||
|
if (!project.TryGetValue("commands", out commandsObject))
|
||||||
|
return false;
|
||||||
|
var commands = (Dictionary<string, object>)commandsObject;
|
||||||
|
|
||||||
|
return commands.Keys.Contains("test");
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue