workmanw / ember-qunit-assert-helpers

An ember-addon that provides additional QUnit 2.0 assertions specific to Ember.js.
MIT License
13 stars 9 forks source link

Optionally suppress warnings and deprecations when expected. #5

Open workmanw opened 7 years ago

workmanw commented 7 years ago

I think we may need to optionally (possibly by default) suppress warnings and deprecations when they are expected. This means not invoking the next callback in this addons registered handlers (e.g. asserts/deprecation.js#L14).

I had not done so originally because it felt wrong for this addon to swallow warnings and deprecations without knowing what else could be out there wanting to consume them. But practically speaking, not doing so creates a lot a noise in a test that passes. Example:

ok 166 PhantomJS 2.1 - model-fragments shim module: test the shim modules
    ---
        Log: |
            { type: 'warn',
              text: '\'DEPRECATION: Importing from the `model-fragments` module is deprecated. Instead import from `ember-data-model-fragments`. [deprecation id: model-fragments-module-import]\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    raiseOnDeprecation@http://localhost:7357/assets/vendor.js:16116:17\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    http://localhost:7357/assets/test-support.js:4793:11\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    invoke@http://localhost:7357/assets/vendor.js:16213:21\\n    deprecate@http://localhost:7357/assets/vendor.js:16181:37\\n    deprecate@http://localhost:7357/assets/vendor.js:27940:42\\n    http://localhost:7357/assets/vendor.js:71104:22\\n    exports@http://localhost:7357/assets/vendor.js:140:37\\n    requireModule@http://localhost:7357/assets/vendor.js:32:25\\n    http://localhost:7357/assets/tests.js:3799:25\\n    runTest@http://localhost:7357/assets/test-support.js:1060:34\\n    run@http://localhost:7357/assets/test-support.js:1046:13\\n    http://localhost:7357/assets/test-support.js:1220:15\\n    process@http://localhost:7357/assets/test-support.js:2277:26\\n    begin@http://localhost:7357/assets/test-support.js:2260:11\\n    http://localhost:7357/assets/test-support.js:1634:11\'\n' }
            { type: 'warn',
              text: '\'DEPRECATION: Importing from the `model-fragments` module is deprecated. Instead import from `ember-data-model-fragments`. [deprecation id: model-fragments-module-import]\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    raiseOnDeprecation@http://localhost:7357/assets/vendor.js:16116:17\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    http://localhost:7357/assets/test-support.js:4793:11\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    invoke@http://localhost:7357/assets/vendor.js:16213:21\\n    deprecate@http://localhost:7357/assets/vendor.js:16181:37\\n    deprecate@http://localhost:7357/assets/vendor.js:27940:42\\n    http://localhost:7357/assets/vendor.js:71104:22\\n    exports@http://localhost:7357/assets/vendor.js:140:37\\n    requireModule@http://localhost:7357/assets/vendor.js:32:25\\n    http://localhost:7357/assets/tests.js:3800:25\\n    runTest@http://localhost:7357/assets/test-support.js:1060:34\\n    run@http://localhost:7357/assets/test-support.js:1046:13\\n    http://localhost:7357/assets/test-support.js:1220:15\\n    process@http://localhost:7357/assets/test-support.js:2277:26\\n    begin@http://localhost:7357/assets/test-support.js:2260:11\\n    http://localhost:7357/assets/test-support.js:1634:11\'\n' }
            { type: 'warn',
              text: '\'DEPRECATION: Importing from the `model-fragments` module is deprecated. Instead import from `ember-data-model-fragments`. [deprecation id: model-fragments-module-import]\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    raiseOnDeprecation@http://localhost:7357/assets/vendor.js:16116:17\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    http://localhost:7357/assets/test-support.js:4793:11\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    invoke@http://localhost:7357/assets/vendor.js:16213:21\\n    deprecate@http://localhost:7357/assets/vendor.js:16181:37\\n    deprecate@http://localhost:7357/assets/vendor.js:27940:42\\n    http://localhost:7357/assets/vendor.js:71104:22\\n    exports@http://localhost:7357/assets/vendor.js:140:37\\n    requireModule@http://localhost:7357/assets/vendor.js:32:25\\n    http://localhost:7357/assets/tests.js:3801:25\\n    runTest@http://localhost:7357/assets/test-support.js:1060:34\\n    run@http://localhost:7357/assets/test-support.js:1046:13\\n    http://localhost:7357/assets/test-support.js:1220:15\\n    process@http://localhost:7357/assets/test-support.js:2277:26\\n    begin@http://localhost:7357/assets/test-support.js:2260:11\\n    http://localhost:7357/assets/test-support.js:1634:11\'\n' }
            { type: 'warn',
              text: '\'DEPRECATION: Importing from the `model-fragments` module is deprecated. Instead import from `ember-data-model-fragments`. [deprecation id: model-fragments-module-import]\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    raiseOnDeprecation@http://localhost:7357/assets/vendor.js:16116:17\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    http://localhost:7357/assets/test-support.js:4793:11\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    invoke@http://localhost:7357/assets/vendor.js:16213:21\\n    deprecate@http://localhost:7357/assets/vendor.js:16181:37\\n    deprecate@http://localhost:7357/assets/vendor.js:27940:42\\n    http://localhost:7357/assets/vendor.js:71104:22\\n    exports@http://localhost:7357/assets/vendor.js:140:37\\n    requireModule@http://localhost:7357/assets/vendor.js:32:25\\n    http://localhost:7357/assets/tests.js:3802:25\\n    runTest@http://localhost:7357/assets/test-support.js:1060:34\\n    run@http://localhost:7357/assets/test-support.js:1046:13\\n    http://localhost:7357/assets/test-support.js:1220:15\\n    process@http://localhost:7357/assets/test-support.js:2277:26\\n    begin@http://localhost:7357/assets/test-support.js:2260:11\\n    http://localhost:7357/assets/test-support.js:1634:11\'\n' }
            { type: 'warn',
              text: '\'DEPRECATION: Importing from the `model-fragments` module is deprecated. Instead import from `ember-data-model-fragments`. [deprecation id: model-fragments-module-import]\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    raiseOnDeprecation@http://localhost:7357/assets/vendor.js:16116:17\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    http://localhost:7357/assets/test-support.js:4793:11\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    invoke@http://localhost:7357/assets/vendor.js:16213:21\\n    deprecate@http://localhost:7357/assets/vendor.js:16181:37\\n    deprecate@http://localhost:7357/assets/vendor.js:27940:42\\n    http://localhost:7357/assets/vendor.js:71104:22\\n    exports@http://localhost:7357/assets/vendor.js:140:37\\n    requireModule@http://localhost:7357/assets/vendor.js:32:25\\n    http://localhost:7357/assets/tests.js:3803:25\\n    runTest@http://localhost:7357/assets/test-support.js:1060:34\\n    run@http://localhost:7357/assets/test-support.js:1046:13\\n    http://localhost:7357/assets/test-support.js:1220:15\\n    process@http://localhost:7357/assets/test-support.js:2277:26\\n    begin@http://localhost:7357/assets/test-support.js:2260:11\\n    http://localhost:7357/assets/test-support.js:1634:11\'\n' }
            { type: 'warn',
              text: '\'DEPRECATION: Importing from the `model-fragments` module is deprecated. Instead import from `ember-data-model-fragments`. [deprecation id: model-fragments-module-import]\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    raiseOnDeprecation@http://localhost:7357/assets/vendor.js:16116:17\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    http://localhost:7357/assets/test-support.js:4793:11\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    invoke@http://localhost:7357/assets/vendor.js:16213:21\\n    deprecate@http://localhost:7357/assets/vendor.js:16181:37\\n    deprecate@http://localhost:7357/assets/vendor.js:27940:42\\n    http://localhost:7357/assets/vendor.js:71104:22\\n    exports@http://localhost:7357/assets/vendor.js:140:37\\n    requireModule@http://localhost:7357/assets/vendor.js:32:25\\n    http://localhost:7357/assets/tests.js:3804:25\\n    runTest@http://localhost:7357/assets/test-support.js:1060:34\\n    run@http://localhost:7357/assets/test-support.js:1046:13\\n    http://localhost:7357/assets/test-support.js:1220:15\\n    process@http://localhost:7357/assets/test-support.js:2277:26\\n    begin@http://localhost:7357/assets/test-support.js:2260:11\\n    http://localhost:7357/assets/test-support.js:1634:11\'\n' }
            { type: 'warn',
              text: '\'DEPRECATION: Importing from the `model-fragments` module is deprecated. Instead import from `ember-data-model-fragments`. [deprecation id: model-fragments-module-import]\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    raiseOnDeprecation@http://localhost:7357/assets/vendor.js:16116:17\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    http://localhost:7357/assets/test-support.js:4793:11\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    invoke@http://localhost:7357/assets/vendor.js:16213:21\\n    deprecate@http://localhost:7357/assets/vendor.js:16181:37\\n    deprecate@http://localhost:7357/assets/vendor.js:27940:42\\n    http://localhost:7357/assets/vendor.js:71104:22\\n    exports@http://localhost:7357/assets/vendor.js:140:37\\n    requireModule@http://localhost:7357/assets/vendor.js:32:25\\n    http://localhost:7357/assets/tests.js:3805:25\\n    runTest@http://localhost:7357/assets/test-support.js:1060:34\\n    run@http://localhost:7357/assets/test-support.js:1046:13\\n    http://localhost:7357/assets/test-support.js:1220:15\\n    process@http://localhost:7357/assets/test-support.js:2277:26\\n    begin@http://localhost:7357/assets/test-support.js:2260:11\\n    http://localhost:7357/assets/test-support.js:1634:11\'\n' }
            { type: 'warn',
              text: '\'DEPRECATION: Importing from the `model-fragments` module is deprecated. Instead import from `ember-data-model-fragments`. [deprecation id: model-fragments-module-import]\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    raiseOnDeprecation@http://localhost:7357/assets/vendor.js:16116:17\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    http://localhost:7357/assets/test-support.js:4793:11\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    invoke@http://localhost:7357/assets/vendor.js:16213:21\\n    deprecate@http://localhost:7357/assets/vendor.js:16181:37\\n    deprecate@http://localhost:7357/assets/vendor.js:27940:42\\n    http://localhost:7357/assets/vendor.js:71104:22\\n    exports@http://localhost:7357/assets/vendor.js:140:37\\n    requireModule@http://localhost:7357/assets/vendor.js:32:25\\n    http://localhost:7357/assets/tests.js:3809:25\\n    runTest@http://localhost:7357/assets/test-support.js:1060:34\\n    run@http://localhost:7357/assets/test-support.js:1046:13\\n    http://localhost:7357/assets/test-support.js:1220:15\\n    process@http://localhost:7357/assets/test-support.js:2277:26\\n    begin@http://localhost:7357/assets/test-support.js:2260:11\\n    http://localhost:7357/assets/test-support.js:1634:11\'\n' }
            { type: 'warn',
              text: '\'DEPRECATION: Importing from the `model-fragments` module is deprecated. Instead import from `ember-data-model-fragments`. [deprecation id: model-fragments-module-import]\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    raiseOnDeprecation@http://localhost:7357/assets/vendor.js:16116:17\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    http://localhost:7357/assets/test-support.js:4793:11\\n    http://localhost:7357/assets/vendor.js:16197:15\\n    invoke@http://localhost:7357/assets/vendor.js:16213:21\\n    deprecate@http://localhost:7357/assets/vendor.js:16181:37\\n    deprecate@http://localhost:7357/assets/vendor.js:27940:42\\n    http://localhost:7357/assets/vendor.js:71104:22\\n    exports@http://localhost:7357/assets/vendor.js:140:37\\n    requireModule@http://localhost:7357/assets/vendor.js:32:25\\n    http://localhost:7357/assets/tests.js:3810:25\\n    runTest@http://localhost:7357/assets/test-support.js:1060:34\\n    run@http://localhost:7357/assets/test-support.js:1046:13\\n    http://localhost:7357/assets/test-support.js:1220:15\\n    process@http://localhost:7357/assets/test-support.js:2277:26\\n    begin@http://localhost:7357/assets/test-support.js:2260:11\\n    http://localhost:7357/assets/test-support.js:1634:11\'\n' }
    ...
rwjblue commented 7 years ago

Confirm. We should not emit the deprecations that were expected to the console.