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

Dependency upgrade bis #692

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

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

# ember-try
/.node_modules.ember-try/
Expand Down
33 changes: 17 additions & 16 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module'
ecmaVersion: 2018,
sourceType: 'module',
ecmafeatures: {
legacyDecorators: true
}
},
plugins: [
'ember'
Expand All @@ -17,25 +21,22 @@ module.exports = {
rules: {
'ember/new-module-imports': 'off',
'ember/no-restricted-resolver-tests': 'off',
'ember/no-test-import-export': 'off',
'ember/no-ember-testing-in-module-scope': 'off'
},
overrides: [
// node files
{
files: [
'.eslintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'index.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'tests/dummy/config/**/*.js'
],
excludedFiles: [
'addon/**',
'addon-test-support/**',
'app/**',
'tests/dummy/app/**'
'./.eslintrc.js',
'./.prettierrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./index.js',
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./tests/dummy/config/**/*.js',
],
parserOptions: {
sourceType: 'script',
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ testem.log
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
.DS_Store
41 changes: 31 additions & 10 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@

# compiled output
/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
/dist
/tests
/tmp
**/.gitkeep
.*
*.tgz
ember-cli-build.js
testem.js
yarn.lock
yarn-error.log
/CONTRIBUTING.md
/ember-cli-build.js
/testem.js
/tests/
/yarn-error.log
/yarn.lock
.gitkeep

# ember-try
.node_modules.ember-try/
Expand Down
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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
- "8"
- "12"

branches:
except:
Expand All @@ -23,8 +23,8 @@ env:
matrix:
# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- EMBER_TRY_SCENARIO=ember-lts-3.4
- EMBER_TRY_SCENARIO=ember-lts-3.8
- EMBER_TRY_SCENARIO=ember-lts-3.16
- EMBER_TRY_SCENARIO=ember-lts-3.20
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ helpers contained in
Compatibility
------------------------------------------------------------------------------

- Ember.js v3.4 or above
- Ember CLI v2.13 or above
- Node.js 8 or above
* Ember.js v3.24 or above
* Ember CLI v3.24 or above
* Node.js v12 or above


Installation
Expand Down
10 changes: 8 additions & 2 deletions addon-test-support/ember-mocha/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ import { loadTests } from './test-loader';
import setupTest from 'ember-mocha/setup-test';
import setupRenderingTest from 'ember-mocha/setup-rendering-test';
import setupApplicationTest from 'ember-mocha/setup-application-test';
import { it, afterEach } from 'mocha';
import { afterEach } from 'mocha';
import { setResolver, resetOnerror } from '@ember/test-helpers';

function setupMocha(options) {
mocha.setup(options || {});
}

/**
* Instruct Mocha to start the tests.
*/
Expand All @@ -27,9 +31,12 @@ function setupResetOnerror() {
* @param {Object} [options] Options to be used for enabling/disabling behaviors
* @param {Boolean} [options.loadTests] If `false` tests will not be loaded automatically.
* @param {Boolean} [options.startTests] If `false` tests will not be automatically started
* @param {Object} [options.mochaOptions] options to pass mocha setup method
* (you must run `startTests()` to kick them off).
*/
export function start(options = {}) {
setupMocha(options?.mochaOptions);

setupResetOnerror();

if (options.loadTests !== false) {
Expand All @@ -45,6 +52,5 @@ export {
setupTest,
setupRenderingTest,
setupApplicationTest,
it,
setResolver,
};
11 changes: 4 additions & 7 deletions addon-test-support/ember-mocha/setup-application-test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import {
setupApplicationContext,
teardownApplicationContext
setupApplicationContext
} from '@ember/test-helpers';
import setupTest from './setup-test';

export default function setupApplicationTest(options) {
export default function setupApplicationTest(_options) {
let options = _options === undefined ? { waitForSettled: true } : Object.assign({ waitForSettled: true }, _options);
let hooks = setupTest(options);

hooks.beforeEach(function() {
return setupApplicationContext(this);
});
hooks.afterEach(function() {
return teardownApplicationContext(this);
return setupApplicationContext(this._emberContext);
});

return hooks;
Expand Down
11 changes: 4 additions & 7 deletions addon-test-support/ember-mocha/setup-rendering-test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import {
setupRenderingContext,
teardownRenderingContext
setupRenderingContext
} from '@ember/test-helpers';
import setupTest from './setup-test';

export default function setupRenderingTest(options) {
export default function setupRenderingTest(_options) {
let options = _options === undefined ? { waitForSettled: true } : Object.assign({ waitForSettled: true }, _options);
let hooks = setupTest(options);

hooks.beforeEach(function() {
return setupRenderingContext(this);
});
hooks.afterEach(function() {
return teardownRenderingContext(this);
return setupRenderingContext(this._emberContext);
});

return hooks;
Expand Down
27 changes: 8 additions & 19 deletions addon-test-support/ember-mocha/setup-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@ import {
setupContext,
teardownContext
} from '@ember/test-helpers';
import { assign, merge } from '@ember/polyfills';
import { resolve } from 'rsvp';
import Ember from 'ember';

let teardownMandatorySetter;
if (Ember.__loader && Ember.__loader.registry && Ember.__loader.registry['@ember/-internals/utils/index']) {
teardownMandatorySetter = Ember.__loader.require('@ember/-internals/utils').teardownMandatorySetter;
}

const _assign = assign || merge;

function chainHooks(hooks, context) {
return hooks.reduce((promise, fn) => promise.then(fn.bind(context)), resolve());
Expand All @@ -30,37 +21,35 @@ function setupPauseTest(context) {
};
}

export default function setupTest(options) {
export default function setupTest(_options) {
let originalContext;
let beforeEachHooks = [];
let afterEachHooks = [];
let options = _options === undefined ? { waitForSettled: true } : Object.assign({ waitForSettled: true }, _options);

beforeEach(function() {
originalContext = _assign({}, this);
originalContext = Object.assign({}, this);
let context = new Proxy(this, {});
this._emberContext = context;

return setupContext(this, options)
return setupContext(this._emberContext, options)
.then(() => setupPauseTest(this))
.then(() => chainHooks(beforeEachHooks, this));
});

afterEach(function() {
return chainHooks(afterEachHooks, this)
.then(() => teardownContext(this))
.then(() => teardownContext(this._emberContext, options))
.then(() => {
// delete any extraneous properties
for (let key in this) {
if (!(key in originalContext)) {
// starting from Ember 3.13 this seems to be necessary
if (teardownMandatorySetter) {
teardownMandatorySetter(this, key);
}

delete this[key];
}
}

// copy over the original values
_assign(this, originalContext);
Object.assign(this, originalContext);
});
});

Expand Down
Loading