-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CHORE] Cron job to check for external deprecations (#6844)
* [CHORE] Move assert-all-deprecations to test-infra and apply to encapsulation apps * enable environment variable * find a way to generate a list of the encountered deprecations * add cron job * fix encapsulation tests * fix cron job? * Get cron job working Co-Authored-By: Chris Thoburn <runspired@users.noreply.github.com> * address feedback
- Loading branch information
Showing
15 changed files
with
226 additions
and
59 deletions.
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.