Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise error on unhandled deprecation warnings #3335

Closed
wants to merge 7 commits into from
Closed

Raise error on unhandled deprecation warnings #3335

wants to merge 7 commits into from

Conversation

pangratz
Copy link
Member

This is my stab at enabling the ENV['RAISE_ON_DEPRACATION'] flag when the tests are run. By this, unhandled deprecation messages throw an error and hence it is not possible to use deprecated features within the tests of ember-data (an example being not using the deprecated Ember.Map.remove and use Ember.Map.delete instead).

Some minor deprecation warnings are fixed in the course of this PR, but there are two areas, which are addressed differently:

  • store.pushMany is deprecated in favor of store.push(object); since this is used throughout many tests, this deprecation warning is changed to be soft-deprecated, which means that the deprecation warning are logged but they do not result in a failed test/build
  • the same is true for Serializer#extract, which is deprecated when the ds-new-serializer-api feature is enabled.

Soft deprecating those features allows us to migrate the tests step-by-step migrate and make adaptions in smaller chunks.

Changing the log level for deprecations has been implemented in emberjs/ember.js#11419.

lastName: 'Smith',
phoneNumbers: [number1, number2]
});
}, /You tried to push a record 'Person'' with id '<PhoneNumber:.*>' and passed a DS.Model instance as a value for the relationship '1'. You should instead pass a numerical or string id to represent the record./);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This deprecation warning is updated in #3325 and needs to be updated once the other PR is merged.

@pangratz
Copy link
Member Author

As pointed out by @mixonic in emberjs/ember.js#11419 (comment), this PR uses a private API for changing the log level of certain deprecation messages. This might need to go through an RFC before it can be used in ember-data here ...

EDIT: opened an RFC: emberjs/rfcs#65

@bmac
Copy link
Member

bmac commented Sep 17, 2015

@pangratz do you mind rebasing this pr? (or starting it over if thats easier). I suspect we should be able to set RAISE_ON_DEPRECATION now on master.

@pangratz
Copy link
Member Author

@bmac There is an open PR #3233 by @fivetanley which only sets the RAISE_ON_DEPRECATION. So I would say you go ahead and merge that one, since it has the same effect, without the need for a new PR ...

@pangratz pangratz closed this Sep 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants