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

Partially application of ember init to “modernize” code-base #1096

Merged
merged 1 commit into from
Aug 5, 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
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

root = true


[*]
end_of_line = lf
charset = utf-8
Expand Down
5 changes: 4 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.*/
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try/
/bower.json.ember-try
/package.json.ember-try
15 changes: 13 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ module.exports = {
},
overrides: [
{
files: ['.eslintrc.js', '.prettierrc.js', 'index.js', 'config/ember-try.js', 'scripts/**'],
files: [
'.eslintrc.js',
'.prettierrc.js',
'.template-lintrc.js',
'index.js',
'config/ember-try.js',
'config/environment.js',
'testem.js',
'scripts/**',
],
excludedFiles: ['addon-test-support/**', 'tests/**'],
parserOptions: {
ecmaVersion: 2017,
Expand Down Expand Up @@ -71,7 +80,9 @@ module.exports = {
},
},
{
files: ['addon-test-support/@ember/test-helpers/-internal/promise-polyfill.js'],
files: [
'addon-test-support/@ember/test-helpers/-internal/promise-polyfill.js',
],
rules: {
'require-jsdoc': 'off',
'valid-jsdoc': 'off',
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@
/tmp/

# dependencies
/node_modules/
/bower_components/
/node_modules/

# misc
/.env*
/.pnp*
/.sass-cache
/.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log
/.eslintcache

# ember-try
/.node_modules.ember-try/
Expand Down
13 changes: 13 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,37 @@
/dist/
/tmp/

# dependencies
/bower_components/

# misc
/.bowerrc
/.editorconfig
/.ember-cli
/.env*
/.eslintcache
/.eslintignore
/.eslintrc.js
/.git/
/.gitignore
/.prettierignore
/.prettierrc.js
/.template-lintrc.js
/.travis.yml
/.watchmanconfig
/bower.json
/config/ember-try.js
/CONTRIBUTING.md
/ember-cli-build.js
/testem.js
/tests/
/yarn-error.log
/yarn.lock
.gitkeep

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try

# typescript
Expand Down
21 changes: 21 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
5 changes: 2 additions & 3 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

module.exports = {
arrowParens: 'avoid',
singleQuote: true,
trailingComma: 'es5',
printWidth: 100,
};
6 changes: 6 additions & 0 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

// eslint-ignore-next-line no-undef
module.exports = {
extends: 'recommended',
};
64 changes: 64 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
Copy link
Member

Choose a reason for hiding this comment

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

@stefanpenner - Should be deleted

Copy link
Member Author

@stefanpenner stefanpenner Aug 5, 2021

Choose a reason for hiding this comment

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

thanks -> #1098

language: node_js
node_js:
# we recommend testing addons with the same minimum supported node version as Ember CLI
# so that your addon works for all apps
- "10"

dist: xenial

addons:
chrome: stable

cache:
yarn: true

env:
global:
# See https://git.io/vdao3 for details.
- JOBS=1

branches:
only:
- master
# npm version tags
- /^v\d+\.\d+\.\d+/

jobs:
fast_finish: true
allow_failures:
- env: EMBER_TRY_SCENARIO=ember-canary

include:
# runs linting and tests with current locked deps
- stage: "Tests"
name: "Tests"
script:
- yarn lint
- yarn test:ember

- stage: "Additional Tests"
name: "Floating Dependencies"
install:
- yarn install --no-lockfile --non-interactive
script:
- yarn test:ember

# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- env: EMBER_TRY_SCENARIO=ember-lts-3.20
- env: EMBER_TRY_SCENARIO=ember-lts-3.24
- env: EMBER_TRY_SCENARIO=ember-release
- env: EMBER_TRY_SCENARIO=ember-beta
- env: EMBER_TRY_SCENARIO=ember-canary
- env: EMBER_TRY_SCENARIO=ember-default-with-jquery
- env: EMBER_TRY_SCENARIO=ember-classic
- env: EMBER_TRY_SCENARIO=embroider-safe
- env: EMBER_TRY_SCENARIO=embroider-optimized

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH

script:
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# How To Contribute

## Installation

* `git clone <repository-url>`
* `cd @ember/test-helpers`
* `yarn install`

## Linting

* `yarn lint`
* `yarn lint:fix`

## Running tests

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions

## Running the dummy application

* `ember serve`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ export default function (resolver: Resolver) {

fallbackRegistry = (Application as any).buildRegistry(namespace);
// TODO: only do this on Ember < 3.13
fallbackRegistry.register('component-lookup:main', (Ember as any).ComponentLookup);
fallbackRegistry.register(
'component-lookup:main',
(Ember as any).ComponentLookup
);

registry = new (Ember as any).Registry({
fallback: fallbackRegistry,
Expand Down
80 changes: 50 additions & 30 deletions addon-test-support/@ember/test-helpers/-internal/debug-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ export class TestDebugInfo implements DebugInfo {
private _debugInfo: MaybeDebugInfo;
private _summaryInfo: SummaryInfo | undefined = undefined;

constructor(settledState: SettledState, debugInfo: MaybeDebugInfo = getDebugInfo()) {
constructor(
settledState: SettledState,
debugInfo: MaybeDebugInfo = getDebugInfo()
) {
this._settledState = settledState;
this._debugInfo = debugInfo;
}
Expand All @@ -99,13 +102,14 @@ export class TestDebugInfo implements DebugInfo {
this._debugInfo.autorun && this._debugInfo.autorun.stack;
this._summaryInfo.pendingTimersCount = this._debugInfo.timers.length;
this._summaryInfo.hasPendingTimers =
this._settledState.hasPendingTimers && this._summaryInfo.pendingTimersCount > 0;
this._settledState.hasPendingTimers &&
this._summaryInfo.pendingTimersCount > 0;
this._summaryInfo.pendingTimersStackTraces = this._debugInfo.timers.map(
timer => timer.stack
(timer) => timer.stack
);

this._summaryInfo.pendingScheduledQueueItemCount = this._debugInfo.instanceStack
.filter(q => q)
.filter((q) => q)
.reduce((total: Number, item) => {
Object.keys(item).forEach((queueName: string) => {
total += item[queueName].length;
Expand All @@ -114,15 +118,19 @@ export class TestDebugInfo implements DebugInfo {
return total;
}, 0);
this._summaryInfo.pendingScheduledQueueItemStackTraces = this._debugInfo.instanceStack
.filter(q => q)
.reduce((stacks: string[], deferredActionQueues: DeferredActionQueues) => {
Object.keys(deferredActionQueues).forEach(queue => {
deferredActionQueues[queue].forEach(
(queueItem: QueueItem) => queueItem.stack && stacks.push(queueItem.stack)
);
});
return stacks;
}, []);
.filter((q) => q)
.reduce(
(stacks: string[], deferredActionQueues: DeferredActionQueues) => {
Object.keys(deferredActionQueues).forEach((queue) => {
deferredActionQueues[queue].forEach(
(queueItem: QueueItem) =>
queueItem.stack && stacks.push(queueItem.stack)
);
});
return stacks;
},
[]
);
}

if (this._summaryInfo.hasPendingTestWaiters) {
Expand All @@ -149,31 +157,43 @@ export class TestDebugInfo implements DebugInfo {
_console.log(PENDING_TEST_WAITERS);
}

Object.keys(summary.pendingTestWaiterInfo.waiters).forEach(waiterName => {
let waiterDebugInfo: WaiterDebugInfo = summary.pendingTestWaiterInfo.waiters[waiterName];

if (Array.isArray(waiterDebugInfo)) {
_console.group(waiterName);
waiterDebugInfo.forEach((debugInfo: TestWaiterDebugInfo) => {
_console.log(`${debugInfo.label ? debugInfo.label : 'stack'}: ${debugInfo.stack}`);
});
_console.groupEnd();
} else {
_console.log(waiterName);
Object.keys(summary.pendingTestWaiterInfo.waiters).forEach(
(waiterName) => {
let waiterDebugInfo: WaiterDebugInfo =
summary.pendingTestWaiterInfo.waiters[waiterName];

if (Array.isArray(waiterDebugInfo)) {
_console.group(waiterName);
waiterDebugInfo.forEach((debugInfo: TestWaiterDebugInfo) => {
_console.log(
`${debugInfo.label ? debugInfo.label : 'stack'}: ${
debugInfo.stack
}`
);
});
_console.groupEnd();
} else {
_console.log(waiterName);
}
}
});
);
}

if (summary.hasPendingTimers || summary.pendingScheduledQueueItemCount > 0) {
if (
summary.hasPendingTimers ||
summary.pendingScheduledQueueItemCount > 0
) {
_console.group(SCHEDULED_ASYNC);

summary.pendingTimersStackTraces.forEach(timerStack => {
summary.pendingTimersStackTraces.forEach((timerStack) => {
_console.log(timerStack);
});

summary.pendingScheduledQueueItemStackTraces.forEach(scheduleQueueItemStack => {
_console.log(scheduleQueueItemStack);
});
summary.pendingScheduledQueueItemStackTraces.forEach(
(scheduleQueueItemStack) => {
_console.log(scheduleQueueItemStack);
}
);

_console.groupEnd();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const DEPRECATIONS = new WeakMap<BaseContext, Array<DeprecationFailure>>();
* @param {BaseContext} [context] the test context
* @return {Array<DeprecationFailure>} the Deprecation Failures associated with the corresponding BaseContext;
*/
export function getDeprecationsForContext(context: BaseContext): Array<DeprecationFailure> {
export function getDeprecationsForContext(
context: BaseContext
): Array<DeprecationFailure> {
if (!context) {
throw new TypeError(
`[@ember/test-helpers] could not get deprecations for an invalid test context: '${context}'`
Expand Down
Loading