我正在使用karma,jasmine,typescript来编写来自https://angular.io/docs/js/latest/quickstart.html的helloworld应用程序的单元测试.
以下是测试代码:
///<reference path="../typings/jasmine/jasmine.d.ts"/>
import {
MyAppComponent
} from '../spray1';
describe("name is Alice", () => {
var comp = new MyAppComponent();
it("verify name", () => {
expect(comp.name).toBe("Alice");
});
});
Run Code Online (Sandbox Code Playgroud)
tsc(带"--module commonjs")将此测试代码转换为:
///<reference path="../typings/jasmine/jasmine.d.ts"/>
var spray1_1 = require('../spray1');
describe("name is Alice", function () {
var comp = new myAppComponent_1.MyAppComponent();
it("verify name", function () {
expect(comp.name).toBe("Alice");
});
});
Run Code Online (Sandbox Code Playgroud)
业力未能运行单元测试:
未捕获错误:尚未为上下文加载模块名称"../myAppComponent":_.使用require([]) http://requirejs.org/docs/errors.html#notloaded at /Users/spray1/web2/node_modules/requirejs/require.js:141
Chrome 43.0.2357(Mac OS X 10.10.3):执行0 0成功(0秒/ 0秒)
如果我使用tsc"--module amd",则转换后的测试代码为:
define(["require", "exports", '../spray1'], function (require, exports, spray1_1) { …Run Code Online (Sandbox Code Playgroud) 我从这里下载链接文本的CLR分析器不适用于使用.NET 4.0实现的我的应用程序.是否有.NET 4.0版本?谢谢.
我从库中看到了一些代码:
trait A extends scala.AnyRef
trait B extends scala.AnyRef with A
Run Code Online (Sandbox Code Playgroud)
为什么A需要明确扩展AnyRef?是不是AnyRef已经隐式派生出所有类?
为什么B需要扩展AnyRef即使A已经这样做了?将上述代码更改为以下内容有何不同:
trait A
trait B extends A
Run Code Online (Sandbox Code Playgroud) 有没有办法以真正的异步方式使用Powershell的BeginInvoke()和EndInvoke().那就是,我只是调用BeginInvoke()然后忘记而不是使用EndInvoke来等待返回或结果.我喜欢EndInvoke是一个在BeginInvoke()完成时自动调用的回调函数. MSDN上的示例实际上是同步的.
如何以真正的异步方式使用BeginInvoke()和EndInvoke()?谢谢.
我在那里没有得到有效的答案,所以试试这个论坛是否可以提供帮助。这阻碍了我的工作。
这是我的两个 powershell 脚本。第一个是创建事件源,第二个是使用 4 个线程生成事件。每个线程中使用 Start-Sleep 来控制事件生成率。如果我删除 Start-Sleep,那么 powershell 内存使用量是恒定的,否则它会快速增长,直到使用完所有系统内存并且系统变得非常慢。
这是一个已知的问题?任何解决方法?欣赏任何线索。
# use this script to create channel and source if they does not exist.
$logName = "TestLog"
$sourceName = "TestSource"
New-EventLog -LogName $logName -Source $sourceName
# maximumSize's max is 4G.
Limit-EventLog -LogName $logName -OverflowAction OverWriteOlder -RetentionDays 30 -MaximumSize 3080000KB
Run Code Online (Sandbox Code Playgroud)
事件生成脚本:
# use this script to generate events in TestLog channel.
Param(
[int]$sleepIntervalInMilliSeconds = 0
)
$eventGenScript = {
$logName = "TestLog"
$sourceName = "TestSource"
while($true) { …Run Code Online (Sandbox Code Playgroud) powershell ×2
amd ×1
asynchronous ×1
clr ×1
karma-runner ×1
profiler ×1
scala ×1
typescript ×1