gpt4 book ai didi

javascript - 如何运行验收测试?

转载 作者:搜寻专家 更新时间:2023-11-01 04:52:01 24 4
gpt4 key购买 nike

我在 ember-cli 版本 0.0.22 应用程序中有以下 tests/acceptance/index-test.js:

import startApp from '../helpers/start-app';
test('index transitions', function(){
visit('/');
});

当我访问 http://localhost:4200/tests 时,我看到:

Died on test #1
at eval (ember-cli/tests/acceptance/index-test.js:7:5)
at requireModule (loader/loader.js:54:29)
at eval (ember-cli/tests/test-loader.js:9:7)
at Array.forEach (native)
at eval (ember-cli/tests/test-loader.js:8:8)
at requireModule (loader/loader.js:54:29)
at http://localhost:4200/tests:43:7: visit is not defined

Source: ReferenceError: visit is not defined
at Object.eval (ember-cli/tests/acceptance/index-test.js:8:7)

看来我在加载代码时遇到了问题。项目中的占位符文件会很有用。我怎样才能让它发挥作用?

最佳答案

我需要在测试文件中调用 startApp();,例如:

import startApp from '../helpers/start-app';

test('index transitions', function(){
startApp();
visit('/');
andThen(function(){
equal(find('h3.breadcrumb').text(), 'Title');
});
});

关于javascript - 如何运行验收测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23002008/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com