Giter VIP home page Giter VIP logo

ember-qunit-assert-helpers's People

Contributors

cibernox avatar ember-tomster avatar kturney avatar michalbryxi avatar rwjblue avatar sly7-7 avatar turbo87 avatar workmanw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ember-qunit-assert-helpers's Issues

Incompatible with Ember 2.0 and below

The registerDeprecationHandler() method does not exist in Ember 2.0 and below. Since the deprecation tracking setup is using the method unconditionally it will break the test even if the expectDeprecation() method is never used. This makes it impossible to use this addon in an ember-try scenario that targets an older Ember version.

expectAssertion string match

// component.js
...
Ember.assert('{{#th-order-by}} must pass value argument: ["foo", "bar"]', myCheck);
...
// component-test.js
...
assert.expectAssertion(
    () => {
      this.render(hbs`{{th-order-by}}`);
    },
    "Assertion Failed: {{#th-order-by}} must pass value argument: [\"foo\", \"bar\"]"
  );
});
...

Produces:

screen shot 2017-06-30 at 11 23 07

  • Tests say that expected and actual are the same and yet the test itself fails.
  • I guess the problem is that the helper automatically assumes that matcher parameter is regular expression. So internally it will let the test assertion fail. Because I'm using characters that are special for regular expressions (hash, bracket, ...). But then when the strings are passed to testing environment, they really match and thus I'm getting the message that everything is ok.
  1. Would be sweet to have clear message to the user that does not produce false positives (actual == expected, yet test fails)
  2. Would be awesome to have this explicitly stated in documentation as an example. That the helper expects regular expression.
  3. Ban passing anything that is not regular expression into the helper? Or allow simplifies string matching (===) when string is passed as matcher?

Optionally suppress warnings and deprecations when expected.

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' }
    ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.