小编Mar*_*ine的帖子

由于 lombok @Data,Sonarqube 的覆盖范围很广

我使用 jacoco 进行覆盖率报告。当我查看 jacoco 报告时,报道似乎很好。但是在 Sonarqube 中,覆盖率很低,因为它说@Data来自lombok 的注释不被测试覆盖。

已编译的类被标记为@Generated但它不会被声纳忽略。

如何排除@Data分析?

maven lombok jacoco sonarqube jacoco-maven-plugin

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

如何在不模拟ActivatedRouteSnapshot的情况下测试角度护罩/旋转变压器

我正在尝试测试访问子级路由参数的Angular Resolver。

我的后卫工作正常,但是我无法轻松创建单元测试,因为我无法创建ActivatedRouteSnapshot带有子级路由(只读属性)。

我的解析器

@Injectable({
    providedIn: 'root'
})
export class MyResolverGuard implements Resolve<string> {

    constructor() {
    }

    resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): string {
        return route.firstChild.paramMap.get('my-param');
    }
}

Run Code Online (Sandbox Code Playgroud)

我的测试:

    it('should resolve chilren route params', () => {
        guard = TestBed.get(MyResolverGuard);
        const route = new ActivatedRouteSnapshot();
        // Cannot assign children because it's a read only property
        route.children = [...];
        const myResolverParams = guard.resolve(route, null);
    });
Run Code Online (Sandbox Code Playgroud)

除了使用模拟以外,还有其他方法ActivatedRouteSnapshot吗?

我的测试后卫方法好吗?

感谢您分享您的策略。

javascript angular angular-router angular-test angular-testing

6
推荐指数
0
解决办法
206
查看次数

如何在 Windows 浏览器上自动隐藏滚动条

我有几个带有overflow: auto. 它工作得很好。在 macOS 上,当用户不滚动时滚动条会自动隐藏并出现在滚动条上。

在 Windows 和任何浏览器上滚动条始终可见。它产生了丑陋的渲染。

那么当用户不滚动时,如何在每个操作系统和每个浏览器上自动隐藏滚动条?

我知道有很多类似的问题,但我还没有找到合适的答案

html css user-interface web

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

NPM 安装错误:证书链中的自签名证书

在我的公司,有一个自动签名的 ssl 证书。所以它们是一些因此无法安装的 npm 包。

我已经添加strict-ssl=false.npmrc--strict-ssl=false命令ARGS。

它适用于某些软件包,但有些似乎不负责此选项。

例如,我尝试安装Cypress

命令 :

npm i cypress --save-dev --strict-ssl=false

错误日志:

> cypress@3.4.0 postinstall /Users/mchoraine/Documents/Workplace/SAMSE/rechercheproduit/rechercheproduit-front/node_modules/cypress
> node index.js --exec install

Installing Cypress (version: 3.4.0)

 ?  Downloading Cypress    
   ? Cypress Version: 3.4.0
    Unzipping Cypress      
    Finishing Installation 
The Cypress App could not be downloaded.

Please check network connectivity and try again:

----------

URL: https://download.cypress.io/desktop/3.4.0?platform=darwin&arch=x64
Error: self signed certificate in certificate chain

----------

Platform: darwin (18.6.0)
Cypress Version: 3.4.0
Run Code Online (Sandbox Code Playgroud)

问题似乎只发生在带有 …

ssl npm npm-install cypress

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