• Failed to write coverage reports:ERROR: Error: EEXIST: file already exists, mkdir...


    配置 vue 的 jest 单元测试时报错如下:

     Failed to write coverage reports:
            ERROR: Error: EEXIST: file already exists, mkdir 'xxx	estscoveragevue-cli-3distjs'
            STACK: Error: EEXIST: file already exists, mkdir 'xxx	estscoveragevue-cli-3distjs'
        at Object.mkdirSync (fs.js:738:3)
        at sync (xxx
    ode_modulesmkdirpindex.js:71:13)
        at sync (xxx
    ode_modulesmkdirpindex.js:77:24)
        at sync (xxx
    ode_modulesmkdirpindex.js:78:17)
        at sync (xxx
    ode_modulesmkdirpindex.js:78:17)
        at sync (xxx
    ode_modulesmkdirpindex.js:78:17)
        at sync (xxx
    ode_modulesmkdirpindex.js:78:17)
        at sync (xxx
    ode_modulesmkdirpindex.js:78:17)
        at sync (xxx
    ode_modulesmkdirpindex.js:78:17)
        at sync (xxx
    ode_modulesmkdirpindex.js:78:17)

    百度、谷歌没有无果。后来修改了 jest.config.js 里的 collectCoverageFrom 匹配规格解决问题。

    // jest.config.js
    model.export={
      // ...
        collectCoverageFrom: [
          '**/*.{js,vue}',
          '!**/node_modules/**'
       ],
      // ...      
    }

    改成

    // jest.config.js
    model.export={
      // ...
        collectCoverageFrom: [
           'src/**/*.{js,vue}',
            '!src/main.js',
            '!src/router/index.js',
            '!**/node_modules/**'
       ],
      // ...      
    }
    作者:五更
    欢迎交流,转载请标明出处,谢谢。
  • 相关阅读:
    Hash大法
    最小表示法
    KMP算法题集
    分块总结
    2018 雅礼国庆集训
    二分图总结
    贪心总结
    Tire树总结(模板+例题)
    工具类文章合集
    网文胡乱汇总
  • 原文地址:https://www.cnblogs.com/teemwu/p/10065445.html
Copyright © 2020-2023  润新知