小编Lua*_*ual的帖子

Jest 查找测试但不收集覆盖率

我尝试使用此项目收集测试覆盖率

yarn test --coverage # i.e. "react-scripts test --coverage"
Run Code Online (Sandbox Code Playgroud)

我的笑话配置是这样的:

  "jest": {
    "collectCoverageFrom": [
      "src/**/*.ts*"
    ],
    "coverageThreshold": {
      "global": {
        "lines": 90,
        "statements": 90
      }
    }
  }
Run Code Online (Sandbox Code Playgroud)

我的文件夹结构如下:

.
??? package.json
??? postcss.config.js
??? public/
??? README.md
??? src/
?   ??? App.css
?   ??? App.test.tsx
?   ??? App.tsx
?   ??? assets/
?   ??? components/
?   ?   ??? Emoji/
?   ?   ?   ??? Emoji.test.tsx
?   ?   ?   ??? Emoji.tsx
?   ?   ?   ??? index.ts
?   ?   ??? Home/
? …
Run Code Online (Sandbox Code Playgroud)

typescript istanbul reactjs jestjs

32
推荐指数
5
解决办法
3万
查看次数

XMLHttpRequest无法加载资源

我正在尝试制作一个简单的php后端来处理另一个服务器中的联系表单,但是尽管添加了正确的标题,它仍然给我相同的错误消息:

XMLHttpRequest cannot load https://php-contact-form-lual.herokuapp.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4000' is therefore not allowed access. The response had HTTP status code 404.
Run Code Online (Sandbox Code Playgroud)


这是ajax请求:

$.ajax({
    type: 'POST',
    url: 'https://php-contact-form-lual.herokuapp.com/',
    data: {
            subject: 'subject',
            to: 'receiver',
            name: $('#name').val(),
            email: $('#email').val(),
            msg: $('#msg').val()
            }
    }) // then the callbacks
Run Code Online (Sandbox Code Playgroud)


这是PHP:

<?php

    if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
  // return only the headers and not the content
  // only allow CORS if we're doing a POST - i.e. no …
Run Code Online (Sandbox Code Playgroud)

php ajax jquery heroku cors

9
推荐指数
1
解决办法
2067
查看次数

标签 统计

ajax ×1

cors ×1

heroku ×1

istanbul ×1

jestjs ×1

jquery ×1

php ×1

reactjs ×1

typescript ×1