0
Go to list of users who liked
0
Share on X(Twitter)
Share on Facebook
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-assertのrequire前に実行することで、deepStrictEqualとnotDeepStrictEqualが未定義の時だけ、アサート関数を定義します。
require('assert-polyfill');varassert=require('power-assert');assert.deepStrictEqual(['foo'],['foo'])// passassert.notDeepStrictEqual(['foo'],['bar'])// pass何の関数を定義しているのか
node-v4.1.2のassert.jsのソースコードを引っ張ってきて、それを移植してるだけです。
これだけで動作するようになります。
失敗時の出力
動作サンプル
chopsticks-v0.2.0のtravisCI上で動作を確認しています。
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
