我正在尝试测试一个方法在挂载组件时会被调用,但它总是失败 Expected mock function to have been called one time, but it was called zero times. 下面是组件: <template>
<b-form-input
class="mr-2 rounded-0"
placeholder="Enter Search term..."
id="input-keyword"
/>
</template>
<s
在我的jest测试中,我需要导入测试组件需要工作的所有内容(在我的应用程序的main.js中这样做)。因为我有多个测试文件,我需要在每个文件中“重新导入”它。是否有一种方法将其全部导入到单个文件中,然后只导入此文件?
import Component from '@/views/input-something'
import {mount, shallowMount} from '@vue/test-utils'
import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome'
import
我和Cypress建立了一个NuxtJS项目。在我的测试中,我转到应用程序的一个页面,例如主页(/)
describe('Index page', function () {
it('should show index page of app', function () {
cy.visit('/')
cy.get('h1.title').contains('frontend')
})
})
因此,我需要启动开发服务器,以便能够构建Nuxt应用程序(Vue),然后启动e2e测试。
问题是,当
我使用jest运行vue单元测试来检查各个组件的输出。该组件使用vuetify。
我创建一个vue实例来挂载组件:
import myComponent from './MyComponent.vue';
import VueRouter from 'vue-router';
import Vuetify from 'vuetify';
describe('Component', () => {
let wrapper;
const router = new VueRouter({
bas
在这种情况下,如何定义describe()、it()和expect()?我得到了:No files found in C:\Users\tarek\Dogalu\dogalu_frontend_v2. Make sure Jest's configuration does not exclude this directory. To set up Jest, make sure a package.json file exists. Jest Documentation: facebook.github.io/jest/docs/configuration.html Files:
我有一个组件,它的行为看起来像这样: @Component
export default class MyComponent extends Vue {
public result: number = 0;
public ready: boolean = false;
// for test purpose only. In the real code, this promise is the result of a call to a dependency service.
public promise!: Promise<void>;
priva
我正试着向大家介绍我目前的项目。
但是,在最初的设置过程中,我遇到了这个错误,并且它没有正常运行。
我怎么才能解决这个问题?
我目前正在使用来自vue-cli的vue2。
● Test suite failed to run
TypeError: Cannot read properties of undefined (reading 'html')
at new JSDOMEnvironment (node_modules/jest-environment-jsdom/build/index.js:72:44)
at async TestS
我想动态地呈现vue- code的模式,而不是通过编写任何html代码。我引用了doc - ,并在我的vue项目中应用了同样的方法,但是当我试图调用bvModal.msgBoxOk(‘bvModal.msgBoxOk’)时,它给了我一个错误。
vue.runtime.esm.js?ff9b:587 [Vue warn]: Property or method "$bvModal" is
not defined on the instance but referenced during render. Make sure that
this property is react
我对vue和jest测试并不熟悉,在运行特定的测试时,我一直会收到这个错误。我知道这是一个普遍的错误,但我不知道如何钻研和找出什么是错误的。
以下是错误:
Test suite failed to run
Jest worker encountered 4 child process exceptions, exceeding retry limit
at ChildProcessWorker.initialize (node_modules/jest-worker/build/workers/ChildProcessWorker.js:185:21)
以下是失败的测
我使用Vue与webpack模板,我试图运行测试与Jest。我还使用Pug来呈现模板。
但是当我运行测试时,我得到了一个错误:
[vue-jest] Error: Error: the "filename" option is required to use includes and extends with "relative" paths
at undefined line 2
at error (node_modules/vue-jest/lib/throw-error.js:2:9)
at module.exports (node_m
我使用的应用程序与webpacker (rails宝石),vue,类型记录,玩笑。我也用。当我将jest从24.8.0升级到24.9.0时,如果我尝试运行任何测试,都会遇到这个错误:
FAIL app/javascript/apis/__tests__/emails.spec.ts
● Test suite failed to run
[BABEL] jest_setup.ts: .value is not a valid Plugin property
at Object.keys.forEach.key (node_modules/babel-jest/no