Win78

Win78

V2EX member #266868, joined on 2017-11-14 10:22:04 +08:00
诚惶诚恐,又上 v 站帮我姑卖赣南脐橙
美酒与美食  •  Win78  •  Dec 8, 2023  •  Lastly replied by ArthurTsang
7
可用流量卡推荐
问与答  •  Win78  •  Sep 26, 2022  •  Lastly replied by anonymous1024
7
96 折出盒马礼品卡
二手交易  •  Win78  •  Sep 1, 2022
nodejs 如何在单元测试中 mock path.basename 的运行环境
  •  1   
    Node.js  •  Win78  •  Feb 15, 2023  •  Lastly replied by Win78
    6
    Win78's recent replies
    @xavierchow 嗨,请问对 remote 友好吗
    简历投递会有回复吗 @Annie0506
    水水更健康
    @zficode 王中王中王
    最终,在单元测试里 mock 的方向,我也找到了一个解决方案,使用 `proxyquire` mock `path` 库:
    ```js
    const path = require('path');
    const proxyquire = require('proxyquire');

    const rule = proxyquire('../../../lib/rules/no-index', {
    path: { ...path.win32, '@global': true },
    });
    ```

    ![https://stackoverflow.com/questions/72934150/how-do-i-mock-node-js-running-time-operating-system-in-a-unit-test-for-path-mo]( https://stackoverflow.com/questions/72934150/how-do-i-mock-node-js-running-time-operating-system-in-a-unit-test-for-path-mo)
    @yccyeng 现在不能自动刷新内容,连续模式下会自动变换角度
    @iamgx 这个 shields.io 直接支持,形如 `https://img.shields.io/npm/dm/${package-name}.svg`
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5944 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 02:04 · PVG 10:04 · LAX 19:04 · JFK 22:04
    ♥ Do have faith in what you're doing.