Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

possible to replace subset of exports from module?

オープン
#536 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript
領域
testing

調査の方向性

Start with td.test.js and the replaceEsm entry point to determine whether partial export replacement is supported. Use sample.js as the fixture and make the test demonstrate preserving a while replacing b; done means both assertions pass without moving the functions.

索引モデルが issue の本文から書いたものです。

説明

sample.js

export {a, b}

function a() {
  return b()
}

function b() {
  return 'b'
}

want to replace b() but preserve a()...

td.test.js

import test from 'ava'
import * as td from 'testdouble'
// import {a} from './sample.js'

let mock

test.beforeEach(async () => {
  // unclear how to use second parameter here, is this a potential solution?
  // or is the ask not supported and would need to place `a` and `b` in separate files?
  //
  mock = await td.replaceEsm('./sample.js')
})

test.afterEach(async () => {
  td.reset()
})

test('a', (t) => {
  td.when(mock.b()).thenResolve('bee')
  t.is(mock.a(), 'bee')
})

test('b', (t) => {
  td.when(mock.b()).thenReturn('be')
  t.is(mock.b(), 'be')
})
主要言語
JavaScript
スター
1.4k
フォーク
140
平均マージ
5時間 55分
マージ済み PR(30日)
4

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

testdouble/testdouble.js のほかの issue

testdouble/testdouble.js の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。