{"id":2674,"date":"2019-11-08T18:59:03","date_gmt":"2019-11-08T09:59:03","guid":{"rendered":"http:\/\/appsweets.net\/blog\/?p=2674"},"modified":"2019-11-08T08:01:39","modified_gmt":"2019-11-07T23:01:39","slug":"habit-modulation-2","status":"publish","type":"post","link":"https:\/\/appsweets.net\/blog\/2019\/11\/08\/habit-modulation-2\/","title":{"rendered":"Habit modulation #2"},"content":{"rendered":"<div class=\"db9cc8cdb64025d13c1cc9dad0a0e262\" data-index=\"1\" style=\"float: left; margin: 16px 16px 16px 0;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-5825700137064158\";\r\n\/* 250sq, appsweets-blog *\/\r\ngoogle_ad_slot = \"4837931762\";\r\ngoogle_ad_width = 250;\r\ngoogle_ad_height = 250;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n\n<p>\u3068\u3044\u3046\u308f\u3051\u3067\u30c6\u30b9\u30c8\u3092\u66f8\u304f\u3002<\/p>\n\n\n\n<p>\u30c6\u30b9\u30c8\u306f <a href=\"https:\/\/mochajs.org\/index.html\">mocha<\/a> \u306b\u5b9f\u884c\u3055\u305b\u308b\u3002\u4e00\u65b9\u3001\u6843\u306f esm \u306e\u6587\u6cd5\u306b\u57fa\u3065\u3044\u3066\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5206\u3051\u3066\u3042\u308b\u3002\u3053\u3053\u3067\u554f\u984c\u304c\u51fa\u3066\u304f\u308b\u3002\u30b0\u30b0\u308c\u3070\u305f\u304f\u3055\u3093\u305d\u306e\u624b\u306e\u8a71\u304c\u51fa\u3066\u304f\u308b\u304c\u3001\u8981\u3059\u308b\u306b mocha\u3001\u3072\u3044\u3066\u306f node.js \u304c\u4eca\u73fe\u5728 cjs \u3068 esm \u306e\u904e\u6e21\u671f\u306b\u3042\u3063\u3066\u3001\u307e\u3060\u3042\u3093\u307e\u308a esm \u306e\u5bfe\u5fdc\u304c\u884c\u304d\u5c4a\u3044\u3066\u3044\u306a\u3044\u3002<\/p>\n\n\n\n<p>mocha \u306b\u304a\u3044\u3066\u3082\u3001import\/export \u3092\u4f7f\u3063\u305f\u30bd\u30fc\u30b9\u3092\u6e21\u3057\u3066\u3082\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3002\u305d\u306e\u8fba\u3092\u3069\u3046\u3059\u308b\u304b\u306f\u307e\u3055\u306b<a href=\"https:\/\/github.com\/mochajs\/mocha\/issues\/3006\">\u8b70\u8ad6\u4e2d<\/a>\u306e\u3088\u3046\u3060\u3002<\/p>\n\n\n\n<p>\u3067\u3001\u3044\u304f\u3064\u304b\u306e\u30ef\u30fc\u30af\u30a2\u30e9\u30a6\u30f3\u30c9\u304c\u8003\u3048\u3089\u308c\u3066:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b: cjs \u3068 esm \u306e\u6df7\u4e71\u306f\u3042\u304f\u307e\u3067 node.js \u306e\u4e2d\u306e\u8a71\u3067\u3042\u308b\u3002\u30d6\u30e9\u30a6\u30b6\u3092\u8d77\u52d5\u3057\u3066\u305d\u306e\u4e0a\u3067\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308c\u3070\u666e\u901a\u306b esm \u306e\u30b3\u30fc\u30c9\u304c\u30c6\u30b9\u30c8\u5bfe\u8c61\u306b\u306a\u308b\u3001\u306f\u305a<\/li><li>esm \u306e\u30b3\u30fc\u30c9\u3092 <a href=\"https:\/\/babeljs.io\/\">babel<\/a> \u3067\u30c8\u30e9\u30f3\u30b9\u30d1\u30a4\u30eb\u3057\u305f\u4e0a\u3067\u305d\u308c\u3092\u30c6\u30b9\u30c8\u3059\u308b<\/li><li>\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u30ed\u30fc\u30c9\u3059\u308b<\/li><\/ul>\n\n\n\n<p>\u524d2\u8005\u306f\u30ef\u30fc\u30af\u30a2\u30e9\u30a6\u30f3\u30c9\u306b\u3057\u3066\u306f\u5927\u639b\u304b\u308a\u306b\u306a\u308b\u306e\u3067\u3001\u6700\u5f8c\u306e\u5974\u3067\u884c\u3063\u3066\u307f\u3088\u3046\u3002<\/p>\n\n\n\n<p><code>const assert = require('assert');\nlet testfunc1, testfunc2;\n\nbefore(() =&gt; import('.\/path\/to\/module').then(module =&gt; {\n  ({testfunc1, testfunc2} = module);\n});\n\ndescribe('test', () =&gt; {\n  it('works', () =&gt; {\n    \/\/ test code with testfunc[12]\n  });\n});<\/code><\/p>\n\n\n\n<p>\u3069\u3046\u3067\u3082\u3044\u3044\u304c\u6700\u8fd1\u306e\u3053\u306e wordpress \u306e\u30a8\u30c7\u30a3\u30bf\u304c\u4f7f\u3044\u306b\u304f\u3044\u3002<\/p>\n<div class=\"db9cc8cdb64025d13c1cc9dad0a0e262\" data-index=\"1\" style=\"float: left; margin: 16px 16px 16px 0;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-5825700137064158\";\r\n\/* 250sq, appsweets-blog *\/\r\ngoogle_ad_slot = \"4837931762\";\r\ngoogle_ad_width = 250;\r\ngoogle_ad_height = 250;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>\u3068\u3044\u3046\u308f\u3051\u3067\u30c6\u30b9\u30c8\u3092\u66f8\u304f\u3002 \u30c6\u30b9\u30c8\u306f mocha \u306b\u5b9f\u884c\u3055\u305b\u308b\u3002\u4e00\u65b9\u3001\u6843\u306f esm \u306e\u6587\u6cd5\u306b\u57fa\u3065\u3044\u3066\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5206\u3051\u3066\u3042\u308b\u3002\u3053\u3053\u3067\u554f\u984c\u304c\u51fa\u3066\u304f\u308b\u3002\u30b0\u30b0\u308c\u3070\u305f\u304f\u3055\u3093\u305d\u306e\u624b\u306e\u8a71\u304c\u51fa\u3066\u304f\u308b\u304c\u3001\u8981\u3059\u308b\u306b mocha\u3001\u3072\u3044\u3066\u306f node.js \u304c\u4eca\u73fe\u5728 cjs \u3068 esm \u306e\u904e\u6e21\u671f\u306b\u3042\u3063\u3066\u3001\u307e\u3060\u3042\u3093\u307e\u308a esm \u306e\u5bfe\u5fdc\u304c\u884c\u304d\u5c4a\u3044\u3066\u3044\u306a\u3044\u3002 mocha \u306b\u304a\u3044\u3066\u3082\u3001import\/export \u3092\u4f7f\u3063\u305f\u30bd\u30fc\u30b9\u3092\u6e21\u3057\u3066\u3082\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3002\u305d\u306e\u8fba\u3092\u3069\u3046\u3059\u308b\u304b\u306f\u307e\u3055\u306b\u8b70\u8ad6\u4e2d\u306e\u3088\u3046\u3060\u3002 \u3067\u3001\u3044\u304f\u3064\u304b\u306e\u30ef\u30fc\u30af\u30a2\u30e9\u30a6\u30f3\u30c9\u304c\u8003\u3048\u3089\u308c\u3066: \u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b: cjs \u3068 esm \u306e\u6df7\u4e71\u306f\u3042\u304f\u307e\u3067 node.js \u306e\u4e2d\u306e\u8a71\u3067\u3042\u308b\u3002\u30d6\u30e9\u30a6\u30b6\u3092\u8d77\u52d5\u3057\u3066\u305d\u306e\u4e0a\u3067\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308c\u3070\u666e\u901a\u306b esm \u306e\u30b3\u30fc\u30c9\u304c\u30c6\u30b9\u30c8\u5bfe\u8c61\u306b\u306a\u308b\u3001\u306f\u305a esm \u306e\u30b3\u30fc\u30c9\u3092 babel \u3067\u30c8\u30e9\u30f3\u30b9\u30d1\u30a4\u30eb\u3057\u305f\u4e0a\u3067\u305d\u308c\u3092\u30c6\u30b9\u30c8\u3059\u308b \u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u30ed\u30fc\u30c9\u3059\u308b \u524d2\u8005\u306f\u30ef\u30fc\u30af\u30a2\u30e9\u30a6\u30f3\u30c9\u306b\u3057\u3066\u306f\u5927\u639b\u304b\u308a\u306b\u306a\u308b\u306e\u3067\u3001\u6700\u5f8c\u306e\u5974\u3067\u884c\u3063\u3066\u307f\u3088\u3046\u3002 const assert = require(&#8216;assert&#8217;); let testfunc1, &hellip; <a href=\"https:\/\/appsweets.net\/blog\/2019\/11\/08\/habit-modulation-2\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10,41,5,56],"class_list":["post-2674","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-akahukuplus","tag-chrome","tag-javascript","tag-mocha"],"_links":{"self":[{"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/posts\/2674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/comments?post=2674"}],"version-history":[{"count":3,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/posts\/2674\/revisions"}],"predecessor-version":[{"id":2677,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/posts\/2674\/revisions\/2677"}],"wp:attachment":[{"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/media?parent=2674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/categories?post=2674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appsweets.net\/blog\/wp-json\/wp\/v2\/tags?post=2674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}