From 1fe9a2b7c864f1c5c75c905ea080b2e683a05bd9 Mon Sep 17 00:00:00 2001 From: Andrii Kostenko Date: Sun, 31 Mar 2019 23:41:47 +0300 Subject: [PATCH 1/6] .equal now checks for isImmutable instead of isIterable --- .travis.yml | 5 +++++ chai-immutable.js | 22 +++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6afdc3d..2ca7a65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,11 @@ notifications: on_success: never on_failure: always +before_script: + - 'if [ "$IMMUTABLE_VERSION" ]; then npm install immutable@$IMMUTABLE_VERSION; fi' +env: + - IMMUTABLE_VERSION=3 + - IMMUTABLE_VERSION=4.0.0-rc.12 # Identifies `a.b.c-xxx.n` tags as pre-releases, and `a.b.c` as stable releases before_deploy: | function dist_tag() { diff --git a/chai-immutable.js b/chai-immutable.js index 77f5842..c22df6c 100644 --- a/chai-immutable.js +++ b/chai-immutable.js @@ -13,6 +13,14 @@ context.chai.use(factory(context.Immutable)); } })(this, Immutable => (chai, utils) => { + function isImmutable(value) { + if (typeof Immutable.isImmutable === 'undefined') { + return Immutable.Iterable.isIterable(value); + } else { + return Immutable.isImmutable(value); + } + } + const { Assertion } = chai; function assertIsIterable(obj) { @@ -95,11 +103,11 @@ * @api public */ - function assertCollectionEqual(_super) { + function assertImmutableEqual(_super) { return function(collection) { const obj = this._obj; - if (Immutable.Iterable.isIterable(obj)) { + if (isImmutable(obj)) { this.assert( Immutable.is(obj, collection), 'expected #{act} to equal #{exp}', @@ -114,11 +122,11 @@ }; } - Assertion.overwriteMethod('equal', assertCollectionEqual); - Assertion.overwriteMethod('equals', assertCollectionEqual); - Assertion.overwriteMethod('eq', assertCollectionEqual); - Assertion.overwriteMethod('eql', assertCollectionEqual); - Assertion.overwriteMethod('eqls', assertCollectionEqual); + Assertion.overwriteMethod('equal', assertImmutableEqual); + Assertion.overwriteMethod('equals', assertImmutableEqual); + Assertion.overwriteMethod('eq', assertImmutableEqual); + Assertion.overwriteMethod('eql', assertImmutableEqual); + Assertion.overwriteMethod('eqls', assertImmutableEqual); /** * ### .include(value) From 150a010c8e88cd13edee3472abce5649ad69cd99 Mon Sep 17 00:00:00 2001 From: Andrii Kostenko Date: Mon, 15 Apr 2019 18:58:18 +0300 Subject: [PATCH 2/6] yarn, in-package version of immutable v3 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2ca7a65..2cda585 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,9 +23,9 @@ notifications: on_failure: always before_script: - - 'if [ "$IMMUTABLE_VERSION" ]; then npm install immutable@$IMMUTABLE_VERSION; fi' + - 'if [ "$IMMUTABLE_VERSION" ]; then yarn add immutable@$IMMUTABLE_VERSION; fi' env: - - IMMUTABLE_VERSION=3 + - IMMUTABLE_VERSION= - IMMUTABLE_VERSION=4.0.0-rc.12 # Identifies `a.b.c-xxx.n` tags as pre-releases, and `a.b.c` as stable releases before_deploy: | From bb2d31fcc5e38a7bfcb4f34863059ea71b4730dc Mon Sep 17 00:00:00 2001 From: Andrii Kostenko Date: Mon, 15 Apr 2019 19:56:58 +0300 Subject: [PATCH 3/6] include immutable v4 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2cda585..c1ba72c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,9 +24,9 @@ notifications: before_script: - 'if [ "$IMMUTABLE_VERSION" ]; then yarn add immutable@$IMMUTABLE_VERSION; fi' -env: - - IMMUTABLE_VERSION= - - IMMUTABLE_VERSION=4.0.0-rc.12 +matrix: + include: + - env: IMMUTABLE_VERSION=4.0.0-rc.12 # Identifies `a.b.c-xxx.n` tags as pre-releases, and `a.b.c` as stable releases before_deploy: | function dist_tag() { From 1201959900d84cdf917ef61aace982c61fdf1298 Mon Sep 17 00:00:00 2001 From: Andrii Kostenko Date: Mon, 15 Apr 2019 20:09:40 +0300 Subject: [PATCH 4/6] prettier --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index c1ba72c..0f455ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,9 +24,11 @@ notifications: before_script: - 'if [ "$IMMUTABLE_VERSION" ]; then yarn add immutable@$IMMUTABLE_VERSION; fi' + matrix: include: - env: IMMUTABLE_VERSION=4.0.0-rc.12 + # Identifies `a.b.c-xxx.n` tags as pre-releases, and `a.b.c` as stable releases before_deploy: | function dist_tag() { From f433c75296cc53ab0229f0d55d9a542f45abb88d Mon Sep 17 00:00:00 2001 From: Andrii Kostenko Date: Mon, 15 Apr 2019 20:29:53 +0300 Subject: [PATCH 5/6] prettier --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0f455ca..802f1a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ before_script: matrix: include: - - env: IMMUTABLE_VERSION=4.0.0-rc.12 + - env: IMMUTABLE_VERSION=4.0.0-rc.12 # Identifies `a.b.c-xxx.n` tags as pre-releases, and `a.b.c` as stable releases before_deploy: | From cc70c713e35699c368b8b8d1259726f75abc692a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Sun, 21 Apr 2019 00:41:22 -0400 Subject: [PATCH 6/6] Run against all RC versions of Immutable, and re-organize the Travis config file a little --- .travis.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 802f1a3..9a96a88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,16 @@ os: - linux - osx +matrix: + include: + - env: IMMUTABLE_VERSION=^4.0.0-rc + install: - yarn install --frozen-lockfile +before_script: + - if [ "$IMMUTABLE_VERSION" ]; then yarn add --dev immutable@$IMMUTABLE_VERSION; fi + after_script: - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_NODE_VERSION" == "11" ]]; then yarn coveralls; fi @@ -22,13 +29,6 @@ notifications: on_success: never on_failure: always -before_script: - - 'if [ "$IMMUTABLE_VERSION" ]; then yarn add immutable@$IMMUTABLE_VERSION; fi' - -matrix: - include: - - env: IMMUTABLE_VERSION=4.0.0-rc.12 - # Identifies `a.b.c-xxx.n` tags as pre-releases, and `a.b.c` as stable releases before_deploy: | function dist_tag() {