TypeError: has no method 'async'
TypeError: has no method 'async'
我正在尝试 运行 异步示例并具有以下代码:
registerSuite({
name: 'Test Dashboard empty after removing all projects and data',
setup: function () {
var dfd = this.async(1000);
console.info('\n In setup');
remote = this.remote;
remote.setWindowSize(1024,768);
当我 运行 执行此操作时,我看到以下错误:
TypeError: Object #<Suite> has no method 'async'
at Suite.registerSuite.setup <tests/dashboard/dashboard_empty.js:18:28>
at <Suite.target.(anonymous function).dispatcher [as setup] (/home/bkuhlman/internjs_func/Lopez-Internjs-Func/node_modules/intern/node_modules/dojo/aspect.js:95:31)>
at callOnSuite <node_modules/intern/lib/Suite.js:157:42>
at call <node_modules/intern/lib/Suite.js:208:13>
at Suite.run <node_modules/intern/lib/Suite.js:306:4>
at <node_modules/intern/lib/Suite.js:237:13>
at signalListener <node_modules/intern/node_modules/dojo/Deferred.js:37:21>
at Promise.then.promise.then <node_modules/intern/node_modules/dojo/Deferred.js:258:5>
at runTest <node_modules/intern/lib/Suite.js:236:46>
at <node_modules/intern/lib/Suite.js:249:7>
我错过了什么?
谢谢,
布拉德
正如错误描述的那样。 setup
是套件生命周期方法,不是测试方法,所以它没有 this.async
。如果您需要从生命周期方法执行异步操作,您将需要 return 一个承诺。这将在未来版本的实习生中解决。
我正在尝试 运行 异步示例并具有以下代码:
registerSuite({
name: 'Test Dashboard empty after removing all projects and data',
setup: function () {
var dfd = this.async(1000);
console.info('\n In setup');
remote = this.remote;
remote.setWindowSize(1024,768);
当我 运行 执行此操作时,我看到以下错误:
TypeError: Object #<Suite> has no method 'async'
at Suite.registerSuite.setup <tests/dashboard/dashboard_empty.js:18:28>
at <Suite.target.(anonymous function).dispatcher [as setup] (/home/bkuhlman/internjs_func/Lopez-Internjs-Func/node_modules/intern/node_modules/dojo/aspect.js:95:31)>
at callOnSuite <node_modules/intern/lib/Suite.js:157:42>
at call <node_modules/intern/lib/Suite.js:208:13>
at Suite.run <node_modules/intern/lib/Suite.js:306:4>
at <node_modules/intern/lib/Suite.js:237:13>
at signalListener <node_modules/intern/node_modules/dojo/Deferred.js:37:21>
at Promise.then.promise.then <node_modules/intern/node_modules/dojo/Deferred.js:258:5>
at runTest <node_modules/intern/lib/Suite.js:236:46>
at <node_modules/intern/lib/Suite.js:249:7>
我错过了什么?
谢谢, 布拉德
正如错误描述的那样。 setup
是套件生命周期方法,不是测试方法,所以它没有 this.async
。如果您需要从生命周期方法执行异步操作,您将需要 return 一个承诺。这将在未来版本的实习生中解决。