{"id":3772,"date":"2026-11-08T15:26:07","date_gmt":"2026-11-08T06:26:07","guid":{"rendered":"https:\/\/qol-kk.com\/wp2\/?p=3772"},"modified":"2026-11-08T15:26:07","modified_gmt":"2026-11-08T06:26:07","slug":"20261024-00mvlm00","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2026\/11\/08\/20261024-00mvlm00\/","title":{"rendered":"Jest\u30fbMocha\u30fbChai\uff1aJavaScript\u30c6\u30b9\u30c8\u30c4\u30fc\u30eb\u306e\u68f2\u307f\u5206\u3051\u6bd4\u8f03"},"content":{"rendered":"<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p>JavaScript \u306e\u30c6\u30b9\u30c8\u30c4\u30fc\u30eb\u3092\u8abf\u3079\u308b\u3068\u3001\u307e\u305a\u540d\u524d\u304c\u6319\u304c\u308b\u306e\u304c Jest\u30fbMocha\u30fbChai \u306e 3 \u3064\u3067\u3059\u3002\u3057\u304b\u3057\u3053\u306e 3 \u3064\u306f\u300c\u3069\u308c\u3092\u9078\u3076\u304b\u300d\u3068\u3044\u3046\u540c\u5217\u306e\u9078\u629e\u80a2\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u62c5\u5f53\u3059\u308b\u30ec\u30a4\u30e4\u30fc\u304c\u9055\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li><strong>Jest<\/strong> \u2026 \u30c6\u30b9\u30c8\u30e9\u30f3\u30ca\u30fc + \u30a2\u30b5\u30fc\u30b7\u30e7\u30f3 + \u30e2\u30c3\u30af + \u30ab\u30d0\u30ec\u30c3\u30b8\u3092 1 \u3064\u306b\u675f\u306d\u305f\u30aa\u30fc\u30eb\u30a4\u30f3\u30ef\u30f3<\/li>\n<li><strong>Mocha<\/strong> \u2026 \u30c6\u30b9\u30c8\u30e9\u30f3\u30ca\u30fc\uff08\u30c6\u30b9\u30c8\u306e\u69cb\u9020\u3068\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u3060\u3051\u3092\u63d0\u4f9b\u3059\u308b\uff09<\/li>\n<li><strong>Chai<\/strong> \u2026 \u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u30e9\u30a4\u30d6\u30e9\u30ea\uff08\u671f\u5f85\u5024\u306e\u691c\u8a3c\u3060\u3051\u3092\u62c5\u5f53\u3059\u308b\uff09<\/li>\n<\/ul>\n<p>\u5b9f\u969b\u306e\u9078\u629e\u306f\u300c<strong>Jest \u5358\u4f53<\/strong>\u300d\u304b\u300c<strong>Mocha + Chai\uff08+ Sinon \u306a\u3069\u3092\u8db3\u3059\uff09<\/strong>\u300d\u304b\u3068\u3044\u3046\u69cb\u6210\u5358\u4f4d\u306e\u6bd4\u8f03\u306b\u306a\u308a\u307e\u3059\u3002\u672c\u8a18\u4e8b\u3067\u306f\u5404\u30c4\u30fc\u30eb\u306e\u8cac\u52d9\u3092\u5207\u308a\u5206\u3051\u305f\u3046\u3048\u3067\u3001\u3069\u3093\u306a\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306a\u3089\u3069\u3061\u3089\u304c\u5411\u304f\u304b\u3092\u6574\u7406\u3057\u307e\u3059\u3002<\/p>\n<h2>\u30c6\u30b9\u30c8\u30c4\u30fc\u30eb\u304c\u62c5\u3046\u8cac\u52d9\u306e\u5206\u89e3<\/h2>\n<p>JavaScript \u306e\u30c6\u30b9\u30c8\u306f\u3001\u304a\u304a\u3080\u306d\u6b21\u306e\u8cac\u52d9\u306e\u7a4d\u307f\u91cd\u306d\u3067\u6210\u308a\u7acb\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u8cac\u52d9<\/th>\n<th>\u3084\u308b\u3053\u3068<\/th>\n<th>Jest<\/th>\n<th>Mocha<\/th>\n<th>Chai<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u30c6\u30b9\u30c8\u30e9\u30f3\u30ca\u30fc<\/td>\n<td><code>describe<\/code> \/ <code>it<\/code> \u3067\u69cb\u9020\u5316\u30fb\u5b9f\u884c<\/td>\n<td>\u2705<\/td>\n<td>\u2705<\/td>\n<td>\u2015<\/td>\n<\/tr>\n<tr>\n<td>\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3<\/td>\n<td>\u671f\u5f85\u5024\u3092\u691c\u8a3c<\/td>\n<td>\u2705<\/td>\n<td>\u2015\uff08\u5225\u9014\uff09<\/td>\n<td>\u2705<\/td>\n<\/tr>\n<tr>\n<td>\u30e2\u30c3\u30af \/ \u30b9\u30bf\u30d6<\/td>\n<td>\u95a2\u6570\u30fb\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u5dee\u3057\u66ff\u3048<\/td>\n<td>\u2705<\/td>\n<td>\u2015\uff08Sinon \u7b49\uff09<\/td>\n<td>\u2015<\/td>\n<\/tr>\n<tr>\n<td>\u30ab\u30d0\u30ec\u30c3\u30b8<\/td>\n<td>\u884c\u30fb\u5206\u5c90\u306e\u8a08\u6e2c<\/td>\n<td>\u2705<\/td>\n<td>\u2015\uff08c8\/nyc \u7b49\uff09<\/td>\n<td>\u2015<\/td>\n<\/tr>\n<tr>\n<td>\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8<\/td>\n<td>\u51fa\u529b\u306e\u8a18\u9332\u30fb\u5dee\u5206\u6bd4\u8f03<\/td>\n<td>\u2705<\/td>\n<td>\u2015\uff08\u5225\u9014\uff09<\/td>\n<td>\u2015<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Jest \u306f\u6a2a\u4e00\u5217\u3092\u307b\u307c\u5168\u90e8\u30ab\u30d0\u30fc\u3057\u307e\u3059\u3002Mocha \u306f\u30e9\u30f3\u30ca\u30fc\u306b\u7279\u5316\u3057\u3001\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u3084\u30e2\u30c3\u30af\u306f\u5916\u90e8\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u524d\u63d0\u3067\u3059\u3002Chai \u306f\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u306e\u4e00\u6a5f\u80fd\u3060\u3051\u3092\u63d0\u4f9b\u3059\u308b\u306e\u3067\u3001\u5fc5\u305a\u4f55\u3089\u304b\u306e\u30e9\u30f3\u30ca\u30fc\u3068\u30bb\u30c3\u30c8\u3067\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<h2>Mocha + Chai \u306e\u69cb\u6210<\/h2>\n<p>Mocha \u306f\u30c6\u30b9\u30c8\u306e\u300c\u67a0\u300d\u3060\u3051\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u671f\u5f85\u5024\u3092\u691c\u8a3c\u3059\u308b\u6a5f\u80fd\u3092\u6301\u305f\u306a\u3044\u305f\u3081\u3001Chai \u3092\u8db3\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">const { expect } = require(\"chai\");\nconst { sum } = require(\"..\/src\/sum\");\n\ndescribe(\"sum\", () =&gt; {\n  it(\"adds two numbers\", () =&gt; {\n    expect(sum(1, 2)).to.equal(3);\n  });\n\n  it(\"returns a number\", () =&gt; {\n    expect(sum(1, 2)).to.be.a(\"number\");\n  });\n});<\/pre>\n<p>Chai \u306f 3 \u30b9\u30bf\u30a4\u30eb\u306e\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u3092\u63d0\u4f9b\u3059\u308b\u306e\u304c\u7279\u5fb4\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">const chai = require(\"chai\");\n\n\/\/ 1. expect \u30b9\u30bf\u30a4\u30eb\nchai.expect(value).to.equal(3);\n\n\/\/ 2. should \u30b9\u30bf\u30a4\u30eb\uff08Object.prototype \u3092\u62e1\u5f35\u3059\u308b\uff09\nchai.should();\nvalue.should.equal(3);\n\n\/\/ 3. assert \u30b9\u30bf\u30a4\u30eb\uff08Node.js \u6a19\u6e96 assert \u306b\u8fd1\u3044\uff09\nchai.assert.equal(value, 3);<\/pre>\n<p><code>expect(value).to.be.an(\"array\").that.includes(2)<\/code> \u306e\u3088\u3046\u306b\u81ea\u7136\u8a00\u8a9e\u306b\u8fd1\u304f\u9023\u7d50\u3067\u304d\u308b BDD \u30b9\u30bf\u30a4\u30eb\u304c\u4eba\u6c17\u306e\u7406\u7531\u3067\u3059\u3002<\/p>\n<p>\u30e2\u30c3\u30af\u304c\u5fc5\u8981\u306b\u306a\u308b\u3068 Sinon \u3092\u8db3\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">const sinon = require(\"sinon\");\nconst { expect } = require(\"chai\");\n\nit(\"calls the callback once\", () =&gt; {\n  const callback = sinon.spy();\n  doSomething(callback);\n  expect(callback.calledOnce).to.be.true;\n});<\/pre>\n<p>\u30ab\u30d0\u30ec\u30c3\u30b8\u304c\u6b32\u3057\u3051\u308c\u3070 c8 \u304b nyc \u3092\u88ab\u305b\u307e\u3059\u3002\u3064\u307e\u308a Mocha \u69cb\u6210\u306f\u300cMocha + Chai + Sinon + c8\u300d\u306e\u3088\u3046\u306b\u7a4d\u307f\u4e0a\u3052\u3066\u3044\u304f\u306e\u304c\u57fa\u672c\u5f62\u3067\u3059\u3002<\/p>\n<h2>Jest \u306e\u69cb\u6210<\/h2>\n<p>Jest \u306f\u4e0a\u8a18\u3092 1 \u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u8cc4\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">const { sum } = require(\"..\/src\/sum\");\n\ndescribe(\"sum\", () =&gt; {\n  it(\"adds two numbers\", () =&gt; {\n    expect(sum(1, 2)).toBe(3);\n  });\n});<\/pre>\n<p>\u30e2\u30c3\u30af\u3082\u7d44\u307f\u8fbc\u307f\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">it(\"calls the callback once\", () =&gt; {\n  const callback = jest.fn();\n  doSomething(callback);\n  expect(callback).toHaveBeenCalledTimes(1);\n});\n\n\/\/ \u30e2\u30b8\u30e5\u30fc\u30eb\u5168\u4f53\u306e\u30e2\u30c3\u30af\u3082 1 \u884c\njest.mock(\"..\/src\/api\");<\/pre>\n<p>\u30ab\u30d0\u30ec\u30c3\u30b8\u306f <code>--coverage<\/code> \u3092\u4ed8\u3051\u308b\u3060\u3051\u3001\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u3082\u6a19\u6e96\u88c5\u5099\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">it(\"renders correctly\", () =&gt; {\n  expect(renderComponent()).toMatchSnapshot();\n});<\/pre>\n<pre class=\"lang:default decode:true\">jest --coverage<\/pre>\n<h2>\u6027\u80fd\u3068\u5b9f\u884c\u30e2\u30c7\u30eb\u306e\u9055\u3044<\/h2>\n<ul>\n<li><strong>Jest<\/strong> \u2026 \u30c6\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3054\u3068\u306b\u30ef\u30fc\u30ab\u30fc\u30d7\u30ed\u30bb\u30b9\u3092\u5206\u3051\u3066\u4e26\u5217\u5b9f\u884c\u3057\u3001\u5404\u30d5\u30a1\u30a4\u30eb\u3092\u72ec\u7acb\u3057\u305f\u30e2\u30b8\u30e5\u30fc\u30eb\u30ec\u30b8\u30b9\u30c8\u30ea\u3067\u8d70\u3089\u305b\u308b\u3002\u30d5\u30a1\u30a4\u30eb\u9593\u306e\u72b6\u614b\u6c5a\u67d3\u304c\u8d77\u304d\u306b\u304f\u3044\u53cd\u9762\u3001\u30d7\u30ed\u30bb\u30b9\u5206\u96e2\u306e\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u304c\u3042\u308b\u3002<code>jsdom<\/code> \u306a\u3069\u306e\u74b0\u5883\u3092\u565b\u307e\u305b\u308b\u3053\u3068\u304c\u591a\u304f\u3001\u30d6\u30e9\u30a6\u30b6 API \u306e\u30e2\u30c3\u30af\u304c\u7d61\u3080\u3068\u7d20\u306e Node.js \u3068\u306f\u6319\u52d5\u304c\u5909\u308f\u308b\u3002<\/li>\n<li><strong>Mocha<\/strong> \u2026 \u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u5358\u4e00\u30d7\u30ed\u30bb\u30b9\u3067\u76f4\u5217\u5b9f\u884c\uff08<code>--parallel<\/code> \u3067\u4e26\u5217\u5316\u3082\u53ef\u80fd\uff09\u3002\u8efd\u91cf\u3067\u8d77\u52d5\u304c\u901f\u304f\u3001Node.js \u306e\u7d20\u306e\u6319\u52d5\u306b\u8fd1\u3044\u307e\u307e\u52d5\u304f\u3002<\/li>\n<\/ul>\n<p>\u300c\u306a\u305c\u304b CLI \u3067\u52d5\u304f\u306e\u306b Jest \u74b0\u5883\u3060\u3068\u843d\u3061\u308b\u300d\u3068\u3044\u3046\u5dee\u7570\u306f\u3001\u3053\u306e\u5b9f\u884c\u74b0\u5883\u306e\u9055\u3044\u306b\u8d77\u56e0\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002<\/p>\n<h2>\u3069\u3061\u3089\u3092\u9078\u3076\u304b<\/h2>\n<h3>Jest \u304c\u5411\u304f\u30b1\u30fc\u30b9<\/h3>\n<ul>\n<li>React \/ React Native \/ Vue \u306a\u3069\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u4e2d\u5fc3\uff08Create React App \u3084 Next.js \u7cfb\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067 Jest \u5bc4\u308a\uff09<\/li>\n<li>\u30e2\u30c3\u30af\u30fb\u30ab\u30d0\u30ec\u30c3\u30b8\u30fb\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u3092\u3059\u3050\u4f7f\u3044\u305f\u3044<\/li>\n<li>\u8a2d\u5b9a\u3092\u6700\u5c0f\u306b\u3057\u3066\u300c\u5165\u308c\u305f\u3089\u3059\u3050\u66f8\u3051\u308b\u300d\u72b6\u614b\u3092\u512a\u5148\u3057\u305f\u3044<\/li>\n<li>\u30c1\u30fc\u30e0\u306e\u7d4c\u9a13\u5024\u304c\u3070\u3089\u3064\u304f\u306e\u3067\u69cb\u6210\u3092 1 \u672c\u306b\u56fa\u5b9a\u3057\u305f\u3044<\/li>\n<\/ul>\n<h3>Mocha + Chai \u304c\u5411\u304f\u30b1\u30fc\u30b9<\/h3>\n<ul>\n<li>Node.js \u306e\u30d0\u30c3\u30af\u30a8\u30f3\u30c9 \/ \u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u7d20\u306e\u5b9f\u884c\u74b0\u5883\u306b\u8fd1\u3044\u6319\u52d5\u3067\u30c6\u30b9\u30c8\u3057\u305f\u3044<\/li>\n<li>Chai \u306e BDD \u30b9\u30bf\u30a4\u30eb\u306e\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u8868\u73fe\u306b\u3053\u3060\u308f\u308a\u304c\u3042\u308b<\/li>\n<li>\u30e2\u30c3\u30af\u306f Sinon\u3001\u30ab\u30d0\u30ec\u30c3\u30b8\u306f c8 \u306a\u3069\u90e8\u54c1\u3092\u81ea\u524d\u3067\u9078\u3073\u305f\u3044<\/li>\n<li>\u8d77\u52d5\u306e\u8efd\u3055\u30fb\u5b9f\u884c\u901f\u5ea6\u3092\u91cd\u8996\u3059\u308b\u5c0f\u898f\u6a21\u306a\u30c6\u30b9\u30c8\u7fa4<\/li>\n<\/ul>\n<h3>\u88dc\u8db3\uff1aVitest \u3068\u3044\u3046\u7b2c 3 \u306e\u9078\u629e\u80a2<\/h3>\n<p>\u8fd1\u5e74\u306f Vite \u30d9\u30fc\u30b9\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067 Vitest \u3068\u3044\u3046\u9078\u629e\u80a2\u3082\u5e83\u304c\u3063\u3066\u3044\u307e\u3059\u3002Jest \u4e92\u63db\u306e API \u3092\u6301\u3061\u3064\u3064 Vite \u306e\u5909\u63db\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\u306b\u4e57\u308b\u305f\u3081\u3001ESM \/ Vite \u74b0\u5883\u3068\u76f8\u6027\u826f\u304f\u4f7f\u3048\u307e\u3059\u3002\u672c\u8a18\u4e8b\u306e\u8ef8\u304b\u3089\u306f\u5916\u308c\u308b\u305f\u3081\u3001\u3053\u3053\u3067\u306f\u300cJest \u304b Mocha+Chai \u304b\u300d\u306b\u7d5e\u308a\u307e\u3059\u3002<\/p>\n<h2>\u5b9f\u88c5\u4f8b\uff1a\u540c\u3058\u95a2\u6570\u3092\u4e21\u69cb\u6210\u3067\u66f8\u304f<\/h2>\n<pre class=\"lang:default decode:true\">\/\/ src\/inventory.js\nfunction applyDiscount(price, rate) {\n  if (rate &lt; 0 || rate &gt; 1) {\n    throw new Error(\"rate must be between 0 and 1\");\n  }\n  return Math.round(price * (1 - rate));\n}\n\nmodule.exports = { applyDiscount };<\/pre>\n<p>Jest \u7248:<\/p>\n<pre class=\"lang:default decode:true\">const { applyDiscount } = require(\"..\/src\/inventory\");\n\ndescribe(\"applyDiscount\", () =&gt; {\n  it(\"applies a 20% discount\", () =&gt; {\n    expect(applyDiscount(1000, 0.2)).toBe(800);\n  });\n\n  it(\"throws on invalid rate\", () =&gt; {\n    expect(() =&gt; applyDiscount(1000, 1.5)).toThrow(\"rate must be between 0 and 1\");\n  });\n});<\/pre>\n<p>Mocha + Chai \u7248:<\/p>\n<pre class=\"lang:default decode:true\">const { expect } = require(\"chai\");\nconst { applyDiscount } = require(\"..\/src\/inventory\");\n\ndescribe(\"applyDiscount\", () =&gt; {\n  it(\"applies a 20% discount\", () =&gt; {\n    expect(applyDiscount(1000, 0.2)).to.equal(800);\n  });\n\n  it(\"throws on invalid rate\", () =&gt; {\n    expect(() =&gt; applyDiscount(1000, 1.5)).to.throw(\"rate must be between 0 and 1\");\n  });\n});<\/pre>\n<p>\u30c6\u30b9\u30c8\u306e\u9aa8\u683c\uff08<code>describe<\/code> \/ <code>it<\/code>\uff09\u306f\u307b\u307c\u540c\u3058\u3067\u3001\u9055\u3044\u306f\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u306e\u66f8\u304d\u65b9\uff08<code>.toBe<\/code> vs <code>.to.equal<\/code>\u3001<code>.toThrow<\/code> vs <code>.to.throw<\/code>\uff09\u3068\u3001Chai \u3092 import \u3059\u308b\u304b\u3069\u3046\u304b\u306b\u96c6\u7d04\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>\u78ba\u8a8d\u65b9\u6cd5<\/h2>\n<pre class=\"lang:default decode:true\"># Jest\nnpx jest\nnpx jest --coverage\n\n# Mocha + Chai\nnpx mocha \"mocha\/**\/*.spec.js\"\nnpx c8 mocha \"mocha\/**\/*.spec.js\"<\/pre>\n<h2>\u6ce8\u610f\u70b9<\/h2>\n<ul>\n<li><strong>Chai \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3068 import \u5f62\u5f0f<\/strong>\uff1a\u65b0\u3057\u3044\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u306f ESM \u524d\u63d0\u306b\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u3001CommonJS \u306e <code>require<\/code> \u3067\u305d\u306e\u307e\u307e\u8aad\u3081\u306a\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u5f62\u5f0f\uff08CJS \/ ESM\uff09\u3068 Chai \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5408\u308f\u305b\u3066\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\uff08\u4eee\u7f6e\u304d: \u4f7f\u7528\u4e2d\u30d0\u30fc\u30b8\u30e7\u30f3\u306e README \u3092\u53c2\u7167\uff09\u3002<\/li>\n<li><strong>Jest \u3068 ESM<\/strong>\uff1aJest \u306f\u6b74\u53f2\u7684\u306b CommonJS \u524d\u63d0\u306e\u8a2d\u8a08\u3067\u3001\u7d14\u7c8b\u306a ESM \u3092\u6271\u3046\u306b\u306f\u8ffd\u52a0\u8a2d\u5b9a\u304c\u5fc5\u8981\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n<li><strong>\u300c\u5168\u90e8\u5165\u308a\u300d\u306e\u88cf\u8fd4\u3057<\/strong>\uff1aJest \u306f\u30b0\u30ed\u30fc\u30d0\u30eb\u306b <code>describe<\/code> \/ <code>it<\/code> \/ <code>expect<\/code> \u3092\u6ce8\u5165\u3057\u3001<code>jsdom<\/code> \u74b0\u5883\u3092\u565b\u307e\u305b\u308b\u3053\u3068\u304c\u591a\u3044\u305f\u3081\u3001\u7d20\u306e Node.js \u3068\u306f\u6319\u52d5\u304c\u5909\u308f\u308b\u5834\u9762\u304c\u3042\u308a\u307e\u3059\u3002\u74b0\u5883\u4f9d\u5b58\u306e\u30d0\u30b0\u3092\u5207\u308a\u5206\u3051\u308b\u3068\u304d\u306f\u3053\u306e\u524d\u63d0\u3092\u601d\u3044\u51fa\u3059\u3068\u65e9\u3044\u3067\u3059\u3002<\/li>\n<li><strong>\u6df7\u305c\u306a\u3044<\/strong>\uff1a1 \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u3067 Jest \u3068 Mocha \u3092\u4f75\u7528\u3059\u308b\u3068\u8a2d\u5b9a\u30fb\u30b0\u30ed\u30fc\u30d0\u30eb\u304c\u885d\u7a81\u3057\u307e\u3059\u3002\u3069\u3061\u3089\u304b\u306b\u5bc4\u305b\u308b\u306e\u304c\u539f\u5247\u3067\u3059\u3002<\/li>\n<\/ul>\n<h2>\u307e\u3068\u3081<\/h2>\n<ul>\n<li>Jest\u30fbMocha\u30fbChai \u306f\u540c\u5217\u306e\u9078\u629e\u80a2\u3067\u306f\u306a\u304f\u3001\u62c5\u5f53\u30ec\u30a4\u30e4\u30fc\u304c\u9055\u3046\u3002<\/li>\n<li>\u5b9f\u969b\u306e\u6bd4\u8f03\u306f\u300cJest \u5358\u4f53\u300dvs\u300cMocha + Chai\uff08+ Sinon + c8\uff09\u300d\u3002<\/li>\n<li>Jest \u306f\u5168\u90e8\u5165\u308a\u3067\u3001\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u30fb\u3059\u3050\u66f8\u304d\u59cb\u3081\u305f\u3044\u30c1\u30fc\u30e0\u5411\u3051\u3002<\/li>\n<li>Mocha + Chai \u306f\u90e8\u54c1\u3092\u9078\u3079\u308b\u69cb\u6210\u3067\u3001Node.js \u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u30fb\u7d20\u306e\u5b9f\u884c\u74b0\u5883\u30fb\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u8868\u73fe\u306b\u3053\u3060\u308f\u308b\u5834\u9762\u5411\u3051\u3002<\/li>\n<li>\u8ff7\u3063\u305f\u3089\u300c\u69cb\u6210\u3092\u56fa\u5b9a\u3057\u305f\u3044\u306a\u3089 Jest\u3001\u7d44\u307f\u5408\u308f\u305b\u306e\u81ea\u7531\u304c\u6b32\u3057\u3044\u306a\u3089 Mocha + Chai\u300d\u3067\u5207\u308a\u5206\u3051\u308b\u306e\u304c\u5b9f\u52d9\u7684\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>JavaScript \u306e\u30c6\u30b9\u30c8\u30c4\u30fc\u30eb\u3092\u8abf\u3079\u308b\u3068\u3001\u307e\u305a\u540d\u524d\u304c\u6319\u304c\u308b\u306e\u304c Jest\u30fbMocha\u30fbChai \u306e 3 \u3064\u3067\u3059\u3002\u3057\u304b\u3057\u3053\u306e 3 \u3064\u306f\u300c\u3069\u308c\u3092\u9078\u3076\u304b\u300d\u3068\u3044\u3046\u540c\u5217\u306e\u9078\u629e\u80a2\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u62c5\u5f53\u3059\u308b\u30ec\u30a4\u30e4\u30fc\u304c\u9055\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":3771,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","_lightning_design_setting":[],"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[36],"tags":[64,365,1196,1161,1190,1188,970],"class_list":["post-3772","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript-memorandum","tag-api","tag-javascript","tag-node-js","tag-react","tag-vite","tag-1188","tag-970"],"veu_head_title_object":{"title":"","add_site_title":""},"jetpack_publicize_connections":[],"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2026\/11\/20261024-00mvlm00-thumbnail.jpg","_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/comments?post=3772"}],"version-history":[{"count":1,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3772\/revisions"}],"predecessor-version":[{"id":3773,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3772\/revisions\/3773"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/3771"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=3772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=3772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=3772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}