Coder Social home page Coder Social logo

try_frisby's Introduction

try_frisby

Frisbyのチュートリアルをちょっと触ってみるだけのリポジトリ. まず愚直に公式のdocを読んでいく. ついでにくっそ久々にjsを触るのでちょっと感じを思い出したいという気持ちもある.

How Starting

まずリポジトリを作った思考停止して yarn init たたくやん. それは覚えてる. 対話形式のやつをてきとーにエンターしてくやん. で、その後必要そうなパッケージを追加してく. とりあえず yarn add frisby やん.

yarn init
yarn add frisby

でもってES2016で書きたいやん. lintもほしい. で, eslint,babel.

yarn add  babel-cli babel-preset-env eslint

いちいちterminalもどってテスト実行とかしてられないから, だれかにwatchしてほしいやん. このへんで frisbyがjestの拡張(?)だったことを思い出して jset を入れれば--watchできるなーとjestを入れる. でもfrisbyで入っている可能性もあるので無意味っぽいけどまあいいや. ついでに jset-runner-eslintも入れる.

yarn init
yarn add jest jest-runner-eslint

で, eslintの設定をしないといけないので、以下のコマンドで対話型式で適当にきめる.

yarn eslint --init

ここで, 期待した動きをしているのかどうかを確認するためだけに yarn jestしてみる. testMatchしねーぞ!!! と言われるので, これまた対話形式でjestのconfigを書いていく.

yarn jest --init

その他にも独自に設定を少し加えた。詳しくはjest.config.jsをチェケラ.

設定が期待したとおりのものをかどうかをテストするためにtests/first.jsを書いた.

test('first test', () => {
    expect(true).toBe(true)
})

が, ダメ……ッ.

try_frisby (master): yarn jest
yarn run v1.13.0
$ /Users/say0213/try/try_frisby/node_modules/.bin/jest
 FAIL   ES lint  tests/first.js

/Users/say0213/try/try_frisby/tests/first.js
  1:1  error  'test' is not defined    no-undef
  2:5  error  'expect' is not defined  no-undef

✖ 2 problems (2 errors, 0 warnings)

jestで実行したときは, jestはimportしなくても良かったはずなんだけどなー.で、しらべてみたら, .eslint.jsの環境変数を設定する必要があったので, 追加しとく.

ここまでで, よーやくテストが通った.

try_frisby (master): yarn jest
yarn run v1.13.0
$ /Users/say0213/try/try_frisby/node_modules/.bin/jest
 PASS   ES lint  tests/first.js
 PASS   tests  tests/first.js

Test Suites: 2 passed, 2 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        2.877s
Ran all test suites in 2 projects.
✨  Done in 5.09s.
try_frisby (master):

frisby

あとは yarn jest --watchでチュートリアルをやっていくだけ. やっていくだけなんだけど例示されたコードの中でリクエスト先をexample.comからhttpbin.orgに変更した.

try_frisby's People

Contributors

say3no avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.