diff --git a/package.json b/package.json index 0d42976a24..622e7c2768 100644 --- a/package.json +++ b/package.json @@ -150,6 +150,7 @@ "update-notifier": "^0.7.0" }, "devDependencies": { + "babel-preset-react": "^6.5.0", "cli-table2": "^0.2.0", "coveralls": "^2.11.4", "delay": "^1.3.0", diff --git a/test/api.js b/test/api.js index 9201f4a06f..24ff653a25 100644 --- a/test/api.js +++ b/test/api.js @@ -650,9 +650,13 @@ function generateTests(prefix, apiCreator) { }); test(prefix + 'power-assert support', function (t) { - t.plan(3); + t.plan(5); - var api = apiCreator(); + var api = apiCreator({ + babelConfig: { + presets: ['react', 'es2015', 'stage-2'] + } + }); api.run([path.join(__dirname, 'fixture/power-assert.js')]) .then(function (result) { @@ -667,6 +671,16 @@ function generateTests(prefix, apiCreator) { result.errors[1].error.message, /with message\s+t\.true\(a === 'foo', 'with message'\)\s*\n\s+\|\s*\n\s+"bar"/m ); + + t.match( + result.errors[2].error.message, + /t\.true\(o === \{ ...o \}\)\s*\n\s+\|\s*\n\s+Object\{\}/m + ); + + t.match( + result.errors[3].error.message, + /t\.true\(
=== \)/m + ) }); }); diff --git a/test/fixture/power-assert.js b/test/fixture/power-assert.js index c1b940f5f4..c494e7258c 100644 --- a/test/fixture/power-assert.js +++ b/test/fixture/power-assert.js @@ -11,3 +11,15 @@ test.serial(t => { t.true(a === 'foo', 'with message'); }); + +test.serial(t => { + const o = {}; + + t.true(o === {...o}); +}); + +test.serial(t => { + const React = { createElement: function(type) { return type } } + + t.true(
=== ); +});