Testing is very important for finding bugs, verifying the functionality and improving the general stability of a piece of software. Almost all (if not all) developers test their code in some way. One way to test would be to manually run the program and try out all the functions to see if everything is working as expected. Another (and better) way is to write automated tests that are run every time
はじめに 最近Reactとか触っています。Github上とかでいろいろなコードを見させていただくのですが、React周辺はReduxを使っているのでBabel使ってるけど、テストはFacebookのJestを使っていてあんまりBabel使えてなかったり、もはやテスト書いてなかったりします。 そもそもReactはフロントエンドのライブラリなので、あまりテストを書きたくなくなるのもわかります。ですが、Railsやっててもなるべくテストを書くことを尊重する雰囲気になってきているので、React周辺でもテストを書いていきたいのです。そこで、JestではなくてMochaとChaiを使ってテストを書くにはどうするべきなのかと思い、まとめました。 環境 node: v5.1.0 npm: 3.3.12 ディレクトリ構成 . ├── .babelrc ├── .eslintrc ├── package.j
ES6 で書かれたコードをユニット テストしたい。できればテスト自体も ES6 で。という希望を実現してくれそうなツールがあったので試してみる。 mocha ユニット テストには mocha を利用する。業務で Node モジュールのテストに利用していて馴染みがあるのと後述する espower-babel が mocha を想定しているのがその理由。 mocha を npm test や npm run から利用するならインストールはローカルだけでよい。package.json 管理下にある npm にはパスが通った状態になる。 余談だが以下の記事を読んで gulp などもローカルにインストールして実行を npm で抽象化するほうがよいのでは?と考えるようになった。 npm で依存もタスクも一元化する 記事中にもメリットとして説明されているとおり利用者は npm だけ覚えればよい。グローバ
I'm working with Yarn v0.16.1. If I understand correctly (according to the documentation), yarn global add <package> should be the equivalent of npm install -g <package>. However, when I run the example in the docs (with create-react-app), the command runs successfully but create-react-app is then not available from the command line. Here's the output: $ yarn global add create-react-app $ yarn glo
React でルーティングをする react-router を試しました。 インストール Browserify + Babel でコンパイルするのでそのツールを React 、 react-router と一緒にインストールしておきます。 $ npm install -g browserify $ npm install -D babelify babel-preset-es2015 babel-preset-react $ npm install -S react react-dom react-router Hello, World! とりあえず画面になにか表示するところからやってみます。 import React, { Component } from 'react'; import { render } from 'react-dom'; import { Router, Rout
www.news-postseven.com news.biglobe.ne.jp この石田衣良さんの言葉を読んで、僕もなんだかすごく嫌な気分になったんですよね。 『君の名は。』が気に入らないのなら、作品を批判すればいいのに、なんで監督の人生経験を(勝手に想像して)揶揄するのだろう? でも、こういう手合いに、わざわざ新海誠監督が反応してしまっているのをみると、こういう「人生経験マウンティング」みたいなのは、やられたほうには、けっこう「効く」のも事実なんですよね。 少なくとも、僕はイヤだな、それが事実であろうがなかろうが。 記憶のなかに手を突っ込まれて、かき回されるだけで不快です。 そもそも、世の中の大部分の人は、一般的に「青春時代」と言われているような年代における自分の経験に、満足しているわけではないと思うし。 まあ、こういう「人生経験マウンティング」って、石田さんの「芸風」ではあるんです
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く