我尝试使用此项目收集测试覆盖率
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) 我正在尝试制作一个简单的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)