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

Fix deprecation-without-for and deprecation-without-since deprecation warnings #121

Merged
merged 1 commit into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions tests/acceptance/workflow-config-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ module('workflow config', function (hooks) {
});

test('deprecation silenced with string matcher', (assert) => {
deprecate('silence-me', false, { until: 'forever', id: 'test' });
deprecate('silence-me', false, {
since: '2.0.0',
until: 'forever',
id: 'test',
for: 'testing',
});
assert.ok(true, 'Deprecation did not raise');
});

Expand All @@ -31,13 +36,23 @@ module('workflow config', function (hooks) {
'deprecation logs'
);
};
deprecate(message, false, { until: 'forever', id: 'test' });
deprecate(message, false, {
since: '2.0.0',
until: 'forever',
id: 'test',
for: 'testing',
});
});

test('deprecation thrown with string matcher', (assert) => {
Ember.ENV.RAISE_ON_DEPRECATION = true;
assert.throws(function () {
deprecate('throw-me', false, { until: 'forever', id: 'test' });
deprecate('throw-me', false, {
since: '2.0.0',
until: 'forever',
id: 'test',
for: 'testing',
});
}, 'deprecation throws');
});

Expand All @@ -46,7 +61,12 @@ module('workflow config', function (hooks) {

let message = 'log-id';
let id = 'ember.workflow';
let options = { id, since: '2.0.0', until: '3.0.0', for: 'testing' };
let options = {
id,
since: '2.0.0',
until: '3.0.0',
for: 'testing',
};
let expected = `DEPRECATION: ${message}`;
window.Testem.handleConsoleMessage = function (passedMessage) {
assert.equal(
Expand All @@ -63,7 +83,12 @@ module('workflow config', function (hooks) {

let message = 'log-id';
let id = 'ember.workflow';
let options = { id, since: '2.0.0', until: '3.0.0', for: 'testing' };
let options = {
id,
since: '2.0.0',
until: '3.0.0',
for: 'testing',
};
let expected = `DEPRECATION: ${message}`;

let count = 0;
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/deprecation-collector-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ self.deprecationWorkflow.config = {
});

test('deprecation does not choke when called without soon-to-be-required options', (assert) => {
deprecate('silence-me', undefined, { id: 'silence-me', until: 'forever' });
deprecate('silence-me', undefined, {
id: 'silence-me',
since: 'the beginning',
until: 'forever',
for: 'testing',
});
assert.ok(true, 'Deprecation did not raise');
});

Expand Down Expand Up @@ -134,6 +139,7 @@ self.deprecationWorkflow.config = {

deprecate('Sshhhhh!!', false, {
id: 'quiet',
since: 'the beginning',
until: 'forever',
for: 'testing',
});
Expand Down