【发布时间】:2017-10-23 20:17:14
【问题描述】:
我是 JestJS 的新手,正在尝试测试同步代码。以下测试通过:
bin = new Compiler().compile('{int a = 42;}');
test('Integer constant declaration', function() {
expect(bin.dumpVariables()).toBe("[int const a = 42]\n");
});
但是,当我附加此代码时:
bin = new Compiler().compile('{bool b;}');
test('Another test', function() { ... }
...第一个测试失败,因为bin 已经具有来自它之后的赋值的新值。这是为什么?我的代码是完全同步的,所以我希望第一个测试通过,然后是后面代码的效果。
【问题讨论】:
标签: jestjs