You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
Creating an Object Validator in JavaScript the Test-Driven Development Way Introduction Test-Driven Development (TDD) seems like a great concept, but it’s hard to fully understand and appreciate until you see it in action. In this blog post, we’re going to implement a JavaScript object validator using TDD. A Quick Primer on Test-Driven Development TDD flips a lot of “conventional” software develop
技術書、ブログ、READMEを書いてていて、文章中に出てくるコードブロックのコードをテストしたいことがあると思います。 そのサンプルコードが本当に動いてるのか不安になることがあるからです。 power-doctestは、そのコードブロック中のコードにコメントを入れるだけでテスト可能にするツール群です。 power-doctestの例 具体的な例から見ていきます。 次の例では、Markdownで説明とJavaScriptのコードブロックを書いています。 デフォルト引数を使って書くことで、このような挙動は起きなくなるため安全です。 デフォルト引数では、引数が渡されなかった場合のみデフォルト値が入ります。 ```js function addPrefix(text, prefix = "デフォルト:") { return prefix + text; } // falsyな値を渡してもデフォルト
Generating code coverage for test files using Puppeteer is currently not possible if your test uses page.$eval, page.$$eval or page.evaluate as the passed function is executed outside of Jest's scope. Check out issue #7962 on GitHub for a workaround. Use jest-puppeteer Preset Jest Puppeteer provides all required configuration to run your tests using Puppeteer. First, install jest-puppeteer
{ "forbidden": [ { "name": "not-to-test", "comment": "Don't allow dependencies from outside the test folder to test", "severity": "error", "from": { "pathNot": "^(test|spec)" }, "to": { "path": "^(test|spec)" } }, { "name": "not-to-spec", "comment": "Don't allow dependencies to (typescript/ javascript/ coffeescript) spec files", "severity": "error", "from": {}, "to": { "path": "\\.spec\\.(js|ts|ls
// The examples use Ava but any test runner works (Jest, Mocha, Jasmine, etc.) import test from 'ava' import multiply from './multiply.js' import { each } from 'test-each' // The code we are testing // Repeat test using different inputs and expected outputs each( [ { first: 2, second: 2, output: 4 }, { first: 3, second: 3, output: 9 }, ], ({ title }, { first, second, output }) => { // Test titles
About half a year ago Bronley Plumb kindly made me aware of a memory leak in one of my open-source packages. To see this memory leak in action it was necessary to open a browser and its dev tools to execute some manual steps. On top of that, the memory had to be inspected manually. It was a complicated procedure. Normally I just add a failing test before I fix a bug. This time it was a bit more tr
webpack-dev-server のテストを高速化しました。 jest を使っていて、--runInBandを今までは使っていましたが、それを外しました。 —runInBand jest はデフォルトでワーカーを使い並列実行を行います。 しかし、このオプションをつけるとそれが直列実行できます。 理由としては、server の listen するテストが多く、mocha で書かれていたため、急に jest に移行してもコード自体が並列実行できるものではなかったからです。 PR test: don't use --runInBand and improve execution performance by hiroppy · Pull Request #2005 · webpack/webpack-dev-server This is a bugfix This is a feature
April 12, 2019The perfect unit testThere's a common theme I find with people who tell me that they don't find unit testing useful, and it's normally that they are writing bad tests. This is completely understandable, particularly if you're newer to unit testing. It's hard to write good tests and it takes practice to get there. All the things we're going to talk about today were learned the hard wa
It’s been almost a year since my posts on Excel workbook snapshot testing and PDF snapshot testing. Both of these have proven to be very valuable in our automated test suite and have allowed us to easily catch regressions, manually inspect the differences, and then update as needed. Another task on my current project has allowed me to revisit this approach—this time for snapshot testing of the HTM
Today we are happy to announce the next major release of Jest - version 24! It's been 4 months since the last minor release, and 8 months since Jest 23, so this upgrade is a big one, with something for everyone! Highlights include built-in support for TypeScript by upgrading the Jest internals to Babel 7, fixing some long-standing issues with missing console output and performance issues when comp
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く