0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

node-v0でassert.deepStrictEqualを使うと`undefined is not a function`になるので

Posted at

assert-polyfill - an exterminate "TypeError: undefined is not a function" you encounter in node-v0.

polyfillを作成しました。mocha.optsに定義するか、power-assertrequire前に実行することで、deepStrictEqualnotDeepStrictEqualが未定義の時だけ、アサート関数を定義します。

require('assert-polyfill');
var assert = require('power-assert');

assert.deepStrictEqual(['foo'], ['foo']) // pass
assert.notDeepStrictEqual(['foo'], ['bar']) // pass

何の関数を定義しているのか

node-v4.1.2assert.jsのソースコードを引っ張ってきてそれを移植してるだけです
これだけで動作するようになります。

失敗時の出力

v4,5系と全く同じです。
foo.gif

動作サンプル

chopsticks-v0.2.0のtravisCI上で動作を確認しています。

0
0
1

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?