小编Raf*_*fal的帖子

如何配置karma所以打字稿源文件是可调试的

我已经下载了一个种子项目Angular2 Webpack Starter,并在没有问题的情况下启动并运行.我遇到的一个不便是在单元测试下调试源文件.所有*.spec.ts文件都加载到浏览器中并可调试,因此map至少为它们生成文件.当我进入测试的源文件时,我得到这样的东西:

浏览器中的源文件

业力配置:

module.exports = function(config) {
var testWebpackConfig = require('./webpack.test.js');

config.set({
    basePath: '',
    frameworks: ['jasmine'],
    exclude: [ ],
    files: [ { pattern: './config/spec-bundle.js', watched: false } ],
    preprocessors: { './config/spec-bundle.js': ['coverage', 'webpack', 'sourcemap'] },
    webpack: testWebpackConfig,
    coverageReporter: {
      dir : 'coverage/',
      reporters: [
        { type: 'text-summary' },
        { type: 'json' },
        { type: 'html' }
      ]
    },
webpackServer: { noInfo: true },
reporters: [ 'mocha', 'coverage' ],
port: 9876,
colors: true,
logLevel: …
Run Code Online (Sandbox Code Playgroud)

javascript typescript karma-runner webpack angular

9
推荐指数
1
解决办法
5605
查看次数

如何创建子对象的Expression.Property

通常我会以这种方式创建一个表达式.

ParameterExpression pe = Expression.Parameter(typeof(object1), "x");

string Name = "property1";

MemberExpression left = Expression.Property(pe, (object1).GetProperty(Name));
Run Code Online (Sandbox Code Playgroud)

它产生 left = x => x.property1

我需要知道我该如何制作

left = x => x.Object2.property1

如果Name ="Object2.property1"; 和object2是object1的子项

提前致谢

c# linq expression func expression-trees

6
推荐指数
1
解决办法
3714
查看次数

删除git存储库

考虑以下计划:

var path = Path.Combine(
    Path.GetTempPath(),
    Path.GetFileNameWithoutExtension(Path.GetRandomFileName()));
Directory.CreateDirectory(path);

var testFile = Path.Combine(path, "test.txt");
File.WriteAllText(testFile, "Test file");

var source = Repository.Init(path);

using (var repository = new Repository(source))
{
    repository.Index.Add("test.txt");
}

Directory.Delete(path, true); 
Run Code Online (Sandbox Code Playgroud)

在删除存储库文件夹时,我得到了UnauthorizedAccessException- 拒绝访问其中一个内部git文件.为了删除文件夹,还有什么我应该处理的吗?

c# git libgit2sharp

4
推荐指数
1
解决办法
768
查看次数

静态元素的执行顺序初始化

我遇到过像这样的设置代码:

internal class Something
{
    public string Name { get; set; }

    public override string ToString()
    {
        return Name;
    }
}

internal static class Factory
{
    public static string Name { get; set; }

    public static Something Create()
    {
        return new Something { Name = Name };
    }
}

internal static class Resources
{
    public static readonly Something DefaultSomething = Factory.Create();
}

internal class Program
{
    public static void Main(string[] args)
    {
        Factory.Name = "MyFactory";
        Execute();
        Console.ReadKey();
    }

    private static …
Run Code Online (Sandbox Code Playgroud)

c# static .net-4.0

1
推荐指数
1
解决办法
211
查看次数