小编Sha*_*mal的帖子

如何在 GitHub 中查看逐行代码覆盖率?

我有一个 Node.js 项目,其中包括 Istanbul,一个可以生成代码覆盖率报告的工具。我想查看该项目的 GitHub Pull 请求中的测试未涵盖哪些行以及哪些行已涵盖。

伊斯坦布尔允许我在目录中本地查看覆盖范围coverage/lcov-report,但我希望在 GitHub 中的拉取请求的“文件已更改”选项卡中看到此内容。

有一些工具可以提供可视化的逐行覆盖:

CodeCov 会执行此操作,但要求我将覆盖率报告上传到他们的服务器。

Covaralls也这样做,但要求您授予他们访问您的存储库的权限。 工作服视觉测试覆盖范围

Jest覆盖率报告使用GitHub操作添加注释,但无法添加逐行测试覆盖率的视觉指示(例如突出显示)。

在此输入图像描述

有没有其他方法可以在 GitHub Pull Request 中可视化逐行测试覆盖率?

github github-actions

8
推荐指数
0
解决办法
1457
查看次数

多代理,多服务器集群中的Kafka生产者无法写入新创建的主题

我有一个带有2个代理的Kafka集群,每个代理都在自己的(AWS)服务器上(我使用这里的intstructions设置集群).我正在使用SASL(但没有加密).在运行代理2的服务器2上,我创建了一个主题:

KAFKA_OPTS="-Djava.security.auth.login.config=/home/kafka/kafka_2.11-1.0.0/config/jaas.conf -Djava.security.krb5.conf=/etc/krb5.conf" \
    bin/kafka-topics.sh --create \
    --zookeeper zookeeper-server-01.eigenroute.com:2181,zookeeper-server-02.eigenroute.com:2181,zookeeper-server-03.eigenroute.com:2181/apps/kafka-cluster-demo \
    --replication-factor 2   --partitions 9   --topic another-test-topic
Run Code Online (Sandbox Code Playgroud)

看似成功,因为描述主题表明它至少是创建的:

KAFKA_OPTS="-Djava.security.auth.login.config=/home/kafka/kafka_2.11-1.0.0/config/jaas.conf -Djava.security.krb5.conf=/etc/krb5.conf" \
    bin/kafka-topics.sh --describe \
    --zookeeper zookeeper-server-01.eigenroute.com:2181,zookeeper-server-02.eigenroute.com:2181,zookeeper-server-03.eigenroute.com:2181/apps/kafka-cluster-demo
Topic:another-test-topic    PartitionCount:9    ReplicationFactor:2 Configs:    MarkedForDeletion:true
    Topic: another-test-topic   Partition: 0    Leader: none    Replicas: 2,1   Isr:
    Topic: another-test-topic   Partition: 1    Leader: none    Replicas: 1,2   Isr:
    Topic: another-test-topic   Partition: 2    Leader: none    Replicas: 2,1   Isr:
    Topic: another-test-topic   Partition: 3    Leader: none    Replicas: 1,2   Isr:
    Topic: another-test-topic   Partition: 4    Leader: none    Replicas: 2,1   Isr:
    Topic: another-test-topic   Partition: …
Run Code Online (Sandbox Code Playgroud)

sasl apache-kafka apache-zookeeper

6
推荐指数
1
解决办法
1241
查看次数

如何将react-leaflet弹出指针指向标记?

如何将React-Leaftlet弹出框上的弹出框上的箭头指向标记,而不是框的右下角,如下图所示?

在此输入图像描述

这是弹出窗口的代码:

<Popup>
  <span>
    <p>Foo</p>
  </span>
</Popup>
Run Code Online (Sandbox Code Playgroud)

我正在使用存储库示例文件夹中的Popup.js代码react-leaflet.在该课程中,我没有看到设置偏移的选项.

即使只是删除向下箭头也可能足够好.

谢谢,

react-leaflet

6
推荐指数
1
解决办法
261
查看次数

如何在反应传单中制作椭圆?

我试图在使用的地图上绘制一个椭圆react-leaflet,它内置了对圆形和矩形的支持.

为了达到这个目的,我使用代码leaflet这里生成一个椭圆(非反应),我在下面修改并粘贴:

import * as L from 'leaflet';


L.SVG.include ({
    _updateEllipse: function (layer) {
        var // c = layer._point,
            rx = layer._radiusX,
            ry = layer._radiusY,
            phi = layer._tiltDeg,
            endPoint = layer._endPointParams;

        var d = 'M' + endPoint.x0 + ',' + endPoint.y0 +
            'A' + rx + ',' + ry + ',' + phi + ',' +
            endPoint.largeArc + ',' + endPoint.sweep + ',' +
            endPoint.x1 + ',' + endPoint.y1 + ' z';
        this._setPath(layer, d); …
Run Code Online (Sandbox Code Playgroud)

react-leaflet

6
推荐指数
1
解决办法
406
查看次数

如何使用 Golang (Go) 和 gorilla/mux 为 NextJs 前端提供服务?

我按照以下示例使用 Golang 和本机包提供 NextJs 前端单页应用程序net/http

import (
    "embed"
    "io/fs"
    "log"
    "net/http"
    "runtime/pprof"
)

//go:embed nextjs/dist
//go:embed nextjs/dist/_next
//go:embed nextjs/dist/_next/static/chunks/pages/*.js
//go:embed nextjs/dist/_next/static/*/*.js
var nextFS embed.FS

func main() {
    // Root at the `dist` folder generated by the Next.js app.
    distFS, err := fs.Sub(nextFS, "nextjs/dist")
    if err != nil {
        log.Fatal(err)
    }

    // The static Next.js app will be served under `/`.
    http.Handle("/", http.FileServer(http.FS(distFS)))
    // The API will be served under `/api`.
    http.HandleFunc("/api", handleAPI)

    // Start HTTP server …
Run Code Online (Sandbox Code Playgroud)

go gorilla next.js

6
推荐指数
1
解决办法
4247
查看次数

如何在 Java 测试文件中使用 ScalaTest?

可以在 Java 测试文件中使用 ScalaTest,如果可以,我在哪里可以找到示例?

当我尝试类似的事情时:

// MyUTest.java

import org.scalatest.flatspec.AnyFlatSpec;
import org.scalatest.matchers.should.Matchers;

public class MyUTest extends AnyFlatSpec, Matchers {
  ...
}
Run Code Online (Sandbox Code Playgroud)

我得到一个错误,equal(Object)Matchers与同一方法的冲突matchers.dsl.MatherWords

java scala scalatest

4
推荐指数
1
解决办法
255
查看次数

使用Pandas DataFrame的groupby方法时出现StopIteration错误

groupby在StackOverflow上发布的方法遇到了类似的问题:

pandas group StopIteration错误

我试图用这个grouby方法做的更简单,但我得到一个类似的StopIteration错误:

Traceback (most recent call last):
  File "prepare_data_TJ2012_v1p0.py", line 107, in <module>
    grouped = df.groupby('hh').apply(f)
  File "/Users/shafiquejamal/allfiles/htdocs/venvs/easyframes-py3/lib/python3.4/site-packages/pandas/core/groupby.py", line 637, in apply
    return self._python_apply_general(f)
  File "/Users/shafiquejamal/allfiles/htdocs/venvs/easyframes-py3/lib/python3.4/site-packages/pandas/core/groupby.py", line 644, in _python_apply_general
    not_indexed_same=mutated)
  File "/Users/shafiquejamal/allfiles/htdocs/venvs/easyframes-py3/lib/python3.4/site-packages/pandas/core/groupby.py", line 2657, in _wrap_applied_output
    v = next(v for v in values if v is not None)
StopIteration
Run Code Online (Sandbox Code Playgroud)

以下是生成它的代码:

df = pd.DataFrame(
            {'educ': {0: 'pri', 1: 'bach', 2: 'pri', 3: 'hi', 4: 'bach', 5: 'sec', 
                6: 'hi', 7: 'hi', …
Run Code Online (Sandbox Code Playgroud)

python-3.x pandas

3
推荐指数
1
解决办法
1213
查看次数

systemd:似乎 ExecStop 脚本在启动命令运行后立即执行

systemd我正在尝试在 RHEL 7 上启动一个 docker-compose 项目作为服务。这是我的systemd脚本 ( /etc/systemd/system/wp.service):

\n\n
[Unit]\nDescription=wp service with docker compose\nRequires=docker.service\nAfter=docker.service\n\n[Service]\nEnvironmentFile=/home/ec2-user/projects/wp/project-dir/vars.env\nWorkingDirectory=/home/ec2-user/projects/wp/project-dir\n\n# ExecStartPre=/usr/bin/docker-compose down\n\nExecStart=/usr/bin/docker-compose up -d --build --remove-orphans\n\n# ExecStop=/usr/bin/docker-compose down\n\n[Install]\nWantedBy=multi-user.target\n
Run Code Online (Sandbox Code Playgroud)\n\n

当我执行以下命令时:

\n\n
sudo systemctl status wp.service\n
Run Code Online (Sandbox Code Playgroud)\n\n

一切正常 - 容器运行并保持运行。这是输出sudo systemctl status wp.service

\n\n
Aug 15 03:07:22 ip-172-31-33-87.ec2.internal docker-compose[4185]: ---> Using cache\nAug 15 03:07:22 ip-172-31-33-87.ec2.internal docker-compose[4185]: ---> 7392974149d3\nAug 15 03:07:22 ip-172-31-33-87.ec2.internal docker-compose[4185]: Successfully built 7392974149d3\nAug 15 03:07:22 ip-172-31-33-87.ec2.internal docker-compose[4185]: Successfully tagged foo_wp:latest\nAug 15 03:07:22 ip-172-31-33-87.ec2.internal docker-compose[4185]: Creating mysql ...\nAug 15 03:07:22 ip-172-31-33-87.ec2.internal …
Run Code Online (Sandbox Code Playgroud)

systemd rhel7 docker-compose

2
推荐指数
1
解决办法
2200
查看次数

启动 vue js dev server 报错:.plugins[0] 可能只是二元组或三元组

我正在使用 Vue CLI 版本 3 在 Docker 容器内运行 Vue 应用程序。要启动开发服务器,我运行:

https://cli.vuejs.org/guide/cli-service.html
Run Code Online (Sandbox Code Playgroud)

这给出了以下错误:

 ERROR  Failed to compile with 1 errors                                                                                                                                                          17:05:14

 error  in ./app/main.js

Module build failed (from ./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib/index.js):
Error: .plugins[0] may only be a two-tuple or three-tuple
    at assertPluginItem (/home/src/node_modules/@babel/core/lib/config/validation/option-assertions.js:235:13)
    at arr.forEach (/home/src/node_modules/@babel/core/lib/config/validation/option-assertions.js:222:30)
    at Array.forEach (<anonymous>)
    at assertPluginList (/home/src/node_modules/@babel/core/lib/config/validation/option-assertions.js:222:9)
    at Object.keys.forEach.key (/home/src/node_modules/@babel/core/lib/config/validation/options.js:107:5)
    at Array.forEach (<anonymous>)
    at validateNested (/home/src/node_modules/@babel/core/lib/config/validation/options.js:83:21)
    at validate (/home/src/node_modules/@babel/core/lib/config/validation/options.js:74:10)
    at file (/home/src/node_modules/@babel/core/lib/config/config-chain.js:174:34)
    at cachedFunction (/home/src/node_modules/@babel/core/lib/config/caching.js:33:19)
    at buildRootChain (/home/src/node_modules/@babel/core/lib/config/config-chain.js:120:36)
    at loadPrivatePartialConfig (/home/src/node_modules/@babel/core/lib/config/partial.js:85:55)
    at Object.loadPartialConfig (/home/src/node_modules/@babel/core/lib/config/partial.js:110:18)
    at Object.<anonymous> (/home/src/node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib/index.js:140:26)
    at …
Run Code Online (Sandbox Code Playgroud)

node.js npm vue.js babeljs vuejs2

2
推荐指数
1
解决办法
3701
查看次数