LoginSignup
3
3

More than 5 years have passed since last update.

jest内でassertを使う

Posted at
const assert = require('assert');

test('expect', () => {
  expect(1 + 1).toBe(3)
})

test('assert', () => {
  assert.equal(1 + 1, 3)
})

以下のようにexpectと同じように正しくエラーが表示され、エラー数も同様にカウントされる。

スクリーンショット 2018-03-22 22.54.01.png

正しく修正すると以下。

スクリーンショット 2018-03-22 22.55.14.png

参考

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3