javascript - 开玩笑 - 不输出测试结果
问题描述
自从我尝试开始使用 Jest 以来,我一直遇到困难。我没有尝试运行任何测试,也没有尝试通过 Jest 的选项,我从未在控制台中获得“通过”/“失败”输出结果。
开玩笑总是只输出“完成”
使用“Nuxt CLI”有一个默认测试写成:
import { mount } from '@vue/test-utils'
import Logo from '@/components/Logo.vue'
describe('Logo', () => {
test('is a Vue instance', () => {
const wrapper = mount(Logo)
expect(wrapper.isVueInstance()).toBeTruthy()
})
})
到目前为止,我已经尝试过:
yarn test
yarn test --verbose
yarn test --watch
yarn test --watchAll
yarn test --no-watchmen
每次,结果如下:
yarn run v1.21.1
$ jest
Done in 0.72s.
当前jest.config.js:
module.exports = {
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1',
'^~/(.*)$': '<rootDir>/$1',
'^vue$': 'vue/dist/vue.common.js'
},
moduleFileExtensions: ['js', 'vue', 'json'],
transform: {
'^.+\\.js$': 'babel-jest',
'.*\\.(vue)$': 'vue-jest'
},
collectCoverage: true,
collectCoverageFrom: [
'<rootDir>/components/**/*.vue',
'<rootDir>/pages/**/*.vue'
]
}
这似乎是 Nuxt 的默认配置。
任何帮助,将不胜感激
解决方案
所以我想通了(有点)。
我的测试在以下情况下运行良好:
yarn test --no-watchman
我不明白为什么守望者给我带来了这么多问题,但这似乎确实有帮助。
推荐阅读
- shell - 在我的应用程序中打开 Shell Context/PopupMenu
- c++ - Visual Studio for C++ - 标识符“概念”未定义
- c# - C# 在通用方法中对类型约束进行别名以便重用
- python - 对字典列表执行操作
- react-admin - react-admin - 列表视图中的 ChipField 条件颜色
- anylogic - 检索代理抓住车队运输机作为参数
- ruby-on-rails - Stripe SCA webhook 返回 401
- r - 从 table1 对象创建单独的变量
- ios - 无法在 tableview ios 应用程序中向下滚动
- c# - 动态更改 Wpf DatagridTemplateColumn 的 BorderBrush 颜色