我想在我的Meteor客户端应用程序中运行用于快照测试的Jest测试用例。
安装软件包:
npm i --save-dev jest react-test-renderer
我只写了这样的东西:
import React from 'react';
import renderer from 'react-test-renderer';
import { expect } from 'meteor/practicalmeteor:chai';
import CoolComponent from '../some/where';
正在使用jest,并在导入组件时出错。
import ContactForm from "../components/Contact/ContactForm.vue";
import { mount } from '@vue/test-utils'
describe("Contact Form", () => {
});
但是现在正在收到一个错误SyntaxError:意外令牌<在导入ContactForm
要让导入工作,我需要添加什么?
这就是我的联系方式
<template>
my form is here
我试图通过jest将单元测试添加到现有的vue项目中,但是当我尝试运行第一个测试时,我得到了一个错误:
Vue软件包版本不匹配:
- vue@2.5.16
- vue-template-compiler@2.6.6
This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loa
当我注册一个新的用户帐户时,我正在构建一个带有meteor帐户包的自定义帐户系统,它直接登录到他(我不问他的行为),而流星玩具显示了一个收集中的用户(尽管我之前添加了其他用户),这是因为我没有发布用户。当我用现有用户名创建一个新用户时,它会返回一个错误,但也会重定向,并且该用户已登录,请帮助我完成以下操作
// Meteor server side method for register
Meteor.methods({
'users.register'( data ) {
try {
user = Accounts.create
我用Jest测试工具测试我的Vue.js项目。对于覆盖范围而言,我也希望测试顶级.js。它通过了,但是我得到了下面的错误消息。
如何测试顶级.js?
console.error node_modules\vue\dist\vue.runtime.common.js:589
[Vue warn]: Cannot find element: #app
console.error node_modules\vue\dist\vue.runtime.common.js:589
[Vue warn]: You are using the runtime-only build of Vue whe
我有一个Meteor项目,其中我使用coffeescript。
我不确定发生了什么,但是突然我的解决方案得到了这个错误。
ReferenceError: share is not defined
at app/models/Models.js:3:3
当我尝试启动我的解决方案时。
无论我在哪里使用Meteor coffeescript共享变量,它都会生成此错误。
我正在使用WebStorm,并且我有一个FileWatcher来将coffeescript转换成javascript。当我打开它(我需要能够在WebStorm中调试它)时,它会为我的.coffee文件生成.js和.map文件。
我试图用一个测试来覆盖基本的还原器,但是它在我的常量文件中抛出导出错误:
FAIL jest/spec/reducers/RootReducer.spec.js
● Test suite failed to run
Jest encountered an unexpected token
Details:
project-root\js\src\constants\ActionTypes.js:2
export const LOCALE_REQUEST = 'ROOT/LOCALE_REQUEST';
^^^^^^
根据我的布尔字段“成员”是否为真,我试图在站点的用户配置文件页面中显示某些内容。我目前正试图用这样的if语句来解决这个问题。
if ($user_profile['field_member']['und']['0']['value'] == '1') {
print ('<p>This is working</p>');
}
但是,这将返回一个
‘未定义索引: und in include()’
if语句行上出现错误。我不太熟悉drupal
我对nodejs和流星非常陌生。我需要创建一个页面content-type application/json和mongo集合中的数据。因此,当收集数据更改时,json页面必须更改。
对于json页面,我使用了以下示例:
if (Meteor.isServer) {
Meteor.startup(function () {
try{
var interval = Meteor.setInterval(function() {
var result = Meteor.http.call("GET", "http://192.168