-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[CHORE] Cron job to check for external deprecations #6844
Merged
runspired
merged 8 commits into
emberjs:master
from
Gaurav0:move_assert_all_deprecations
Dec 5, 2019
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
855b7b2
[CHORE] Move assert-all-deprecations to test-infra and apply to encap…
Gaurav0 0f77a89
enable environment variable
Gaurav0 e1176d0
find a way to generate a list of the encountered deprecations
Gaurav0 b70a44f
add cron job
Gaurav0 4bc0a2a
fix encapsulation tests
Gaurav0 2b2f164
fix cron job?
Gaurav0 8b8a27b
Get cron job working
Gaurav0 f5b9a36
address feedback
Gaurav0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: 'Nightly' | ||
|
||
on: | ||
schedule: | ||
- cron: '* 14 * * *' # 14:00 in UTC is 6am PST | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test-all-deprecations: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
scenario: [ember-beta, ember-canary] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Install dependencies for master | ||
run: yarn install | ||
- name: Basic Tests | ||
env: | ||
CI: true | ||
ASSERT_ALL_DEPRECATIONS: true | ||
run: yarn test | ||
- name: Encapsulation tests | ||
env: | ||
CI: true | ||
ASSERT_ALL_DEPRECATIONS: true | ||
run: yarn test:encapsulation | ||
|
||
test-all-deprecations-releases: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
scenario: [ember-beta, ember-canary] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Install dependencies for master | ||
run: yarn install | ||
- name: Basic Tests | ||
env: | ||
CI: true | ||
ASSERT_ALL_DEPRECATIONS: true | ||
run: yarn test:try-one ${{ matrix.scenario }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
packages/unpublished-test-infra/addon-test-support/assert-all-deprecations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* eslint-disable no-console */ | ||
import { DEBUG } from '@glimmer/env'; | ||
import QUnit from 'qunit'; | ||
import config from 'ember-get-config'; | ||
|
||
const { ASSERT_ALL_DEPRECATIONS } = config; | ||
|
||
const ALL_ASSERTED_DEPRECATIONS = {}; | ||
|
||
function pushDeprecation(deprecation) { | ||
if (deprecation in ALL_ASSERTED_DEPRECATIONS) { | ||
ALL_ASSERTED_DEPRECATIONS[deprecation]++; | ||
} else { | ||
ALL_ASSERTED_DEPRECATIONS[deprecation] = 1; | ||
} | ||
} | ||
|
||
export default function configureAssertAllDeprecations() { | ||
QUnit.begin(() => { | ||
function assertAllDeprecations(assert) { | ||
if (typeof assert.test.expected === 'number') { | ||
assert.test.expected += 1; | ||
} | ||
assert.expectNoDeprecation(undefined, undefined, deprecation => { | ||
// only assert EmberData deprecations | ||
const id = deprecation.options.id.toLowerCase(); | ||
const isEmberDataDeprecation = | ||
id.includes('ds.') || | ||
id.includes('emberdata') || | ||
id.includes('ember-data') || | ||
id.includes('mismatched-inverse-relationship-data-from-payload'); | ||
|
||
if (!isEmberDataDeprecation) { | ||
if (ASSERT_ALL_DEPRECATIONS) { | ||
pushDeprecation((deprecation.options && deprecation.options.id) || deprecation); | ||
} else { | ||
console.warn('Detected Non-Ember-Data Deprecation:', deprecation.message, deprecation.options.stacktrace); | ||
} | ||
} | ||
|
||
return ASSERT_ALL_DEPRECATIONS ? true : isEmberDataDeprecation; | ||
}); | ||
} | ||
// ensure we don't regress quietly | ||
// this plays nicely with `expectDeprecation` | ||
if (DEBUG) { | ||
QUnit.config.modules.forEach(mod => { | ||
const hooks = (mod.hooks.afterEach = mod.hooks.afterEach || []); | ||
|
||
if (mod.tests.length !== 0) { | ||
hooks.unshift(assertAllDeprecations); | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
QUnit.done(function() { | ||
if (ASSERT_ALL_DEPRECATIONS) { | ||
QUnit.config.deprecations = ALL_ASSERTED_DEPRECATIONS; | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/unpublished-test-infra/addon-test-support/legacy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { wait, asyncEqual, invokeAsync } from './async'; | ||
import QUnit from 'qunit'; | ||
|
||
const { assert } = QUnit; | ||
|
||
export default function additionalLegacyAsserts() { | ||
assert.wait = wait; | ||
assert.asyncEqual = asyncEqual; | ||
assert.invokeAsync = invokeAsync; | ||
|
||
assert.assertClean = function(promise) { | ||
return promise.then( | ||
this.wait(record => { | ||
this.equal(record.get('hasDirtyAttributes'), false, 'The record is now clean'); | ||
return record; | ||
}) | ||
); | ||
}; | ||
|
||
assert.contains = function(array, item) { | ||
this.ok(array.indexOf(item) !== -1, `array contains ${item}`); | ||
}; | ||
|
||
assert.without = function(array, item) { | ||
this.ok(array.indexOf(item) === -1, `array doesn't contain ${item}`); | ||
}; | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/unpublished-test-infra/addon-test-support/testem/custom-qunit-adapter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import QUnit from 'qunit'; | ||
|
||
export default function customQUnitAdapter(socket) { | ||
QUnit.done(function() { | ||
let deprecations = QUnit.config.deprecations; | ||
console.log(deprecations); // eslint-disable-line no-console | ||
|
||
socket.emit('test-metadata', 'deprecations', deprecations); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/unpublished-test-infra/src/testem/custom-dot-reporter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
let DotReporter = require('testem/lib/reporters/dot_reporter'); | ||
|
||
class CustomDotReporter extends DotReporter { | ||
finish() { | ||
super.finish(); | ||
|
||
if (process.env.ASSERT_ALL_DEPRECATIONS === 'true') { | ||
this.out.write('\n============ Deprecations ============\n'); | ||
this.out.write(JSON.stringify(this.deprecations, null, 2) + '\n'); | ||
this.out.write('======================================\n'); | ||
} | ||
} | ||
|
||
reportMetadata(tag, metadata) { | ||
if (tag === 'deprecations') { | ||
this.deprecations = metadata; | ||
} | ||
} | ||
} | ||
|
||
module.exports = CustomDotReporter; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a future PR we should also consider how to monitor for deprecations in the relationship-performance-test-app, but that can be ignored for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't set up fastboot tests and they aren't working right now, so not adding them currently. What are the fetch tests?
Added the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Gaurav0 can you clarify what you mean by:
I am happy to merge this and add fastboot and fetch tests in follow up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I reverted updating test-helper.js in fastboot-test-app to assert on deprecations. I think the code I wrote with the custom QUnitAdapter for testem doesn't work in fastboot, that may be why it fails.