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

[Backport 2.18] CoreObject native class compatibility #16805

Closed
Closed
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
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ cache:

before_install:
- |
phantomjs --version
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start

Expand Down Expand Up @@ -47,8 +46,8 @@ branches:

env:
global:
- SAUCE_USERNAME=ember-ci
- SAUCE_ACCESS_KEY=b5cff982-069f-4a0d-ac34-b77e57c2e295
- BROWSERSTACK_USERNAME=emberjscoreteam1
- BROWSERSTACK_ACCESS_KEY=YsPxXKcahx9XszyHS2Gr
- DISABLE_SOURCE_MAPS=true
- BROCCOLI_ENV=production
- S3_BUCKET_NAME=builds.emberjs.com
Expand All @@ -66,10 +65,11 @@ env:
- secure: e0yxVfwVW61d3Mi/QBOsY6Rfd1mZd3VXUd9xNRoz/fkvQJRuVwDe7oG3NOuJ4LZzvMw7BJ+zpDV9D8nKhAyPEEOgpkkMHUB7Ds83pHG4qSMzm4EAwBCadDLXCQirldz8dzN5FAqgGucXoj5fj/p2SKOkO6qWIZveGr8pdBJEG1E=
matrix:
- TEST_SUITE=each-package-tests BUILD_TYPE=release PUBLISH=true
- TEST_SUITE=browserstack
- TEST_SUITE=built-tests EMBER_ENV=production DISABLE_JSCS=true DISABLE_JSHINT=true
- TEST_SUITE=old-jquery-and-extend-prototypes DISABLE_JSCS=true DISABLE_JSHINT=true
- TEST_SUITE=node DISABLE_JSCS=true DISABLE_JSHINT=true
- TEST_SUITE=blueprints
- TEST_SUITE=travis-browsers DISABLE_JSCS=true DISABLE_JSHINT=true
- TEST_SUITE=sauce
- TEST_SUITE=browserstack
- TEST_SUITE=allow-backtracking-rerender ALLOW_BACKTRACKING=true
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ Within the Travis build, you can see that we (currently) run six different test

* The `each-package-tests` test suite is closest to what you normally run locally on your machine.
* The `build-tests EMBER_ENV=production...` test suite runs tests against a production build.
* The `sauce` test suite runs tests against various supported browsers.
* The `browserstack` test suite runs tests against various supported browsers.

## Common Travis CI Build Issues

Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
<a href="https://ember-community-slackin.herokuapp.com"><img src="https://ember-community-slackin.herokuapp.com/badge.svg" alt="Build Status"></a>
</p>

<p align="center">
<a href="https://saucelabs.com/u/ember-ci"><img src="https://saucelabs.com/browser-matrix/ember-ci.svg" alt="Sauce Test Status"></a>
</p>

Ember.js is a JavaScript framework that greatly reduces the time, effort and resources needed
to build any web application. It is focused on making you, the developer, as productive as possible by doing all the common, repetitive, yet essential, tasks involved in most web development projects.

Expand All @@ -27,3 +23,9 @@ Ember.js also provides access to the most advanced features of JavaScript, HTML
# Contribution

See [CONTRIBUTING.md](https://github.com/emberjs/ember.js/blob/master/CONTRIBUTING.md)

---

Cross-browser testing provided by:

<a href="http://browserstack.com"><img height="70" src="https://p3.zdusercontent.com/attachment/1015988/PWfFdN71Aung2evRkIVQuKJpE?token=eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0..aUrNFb8clSXsFwgw5BUTcg.IJr5piuCen7PmSSBHSrOnqM9K5YZfxX3lvbp-5LCqoKOi4CjjgdA419iqjofs0nLtm26FMURvZ8JRTuKB4iHer6lGu5f8dXHtIkYAHjP5fXDWkl044Yg2mSdrhF6uPy62GdlBYoYxwvgkNrac8nN_In8GY-qOC7bYmlZyJT7tsTZUTYbNMQiXS86YA5LgdCEWzWreMvc3C6cvZtVXIrcVgpkroIhvsTQPm4vQA-Uq6iCbTPA4oX5cpEtMtrlg4jYBnnAE4BTw5UwU_dY83ep5g.7wpc1IKv0rSRGsvqCG_q3g" alt="BrowserStack"></a>
12 changes: 9 additions & 3 deletions bin/run-sauce-tests.js → bin/run-browserstack-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,22 @@ function run(command, _args) {

RSVP.resolve()
.then(function() {
return run('./node_modules/.bin/ember', [ 'sauce:connect' ]);
return run('./node_modules/.bin/ember', [ 'browserstack:connect' ]);
})
.then(function() {
// Calling testem directly here instead of `ember test` so that
// we do not have to do a double build (by the time this is run
// we have already ran `ember build`).
return run('./node_modules/.bin/testem', [ 'ci', '-f', 'testem.dist.json', '--port', '7000' ]);
return run('./node_modules/.bin/testem', [ 'ci', '-f', 'testem.dist.js', '--host', '127.0.0.1', '--port', '7774' ]);
})
.finally(function() {
return run('./node_modules/.bin/ember', [ 'sauce:disconnect' ]);
var promise = RSVP.resolve();
if (process.env.TRAVIS_JOB_NUMBER) {
promise = run('./node_modules/.bin/ember', ['browserstack:results']);
}
return promise.then(function() {
return run('./node_modules/.bin/ember', ['browserstack:disconnect']);
});
})
.catch(function(error) {
console.log('error');
Expand Down
185 changes: 133 additions & 52 deletions bin/run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,63 +27,145 @@ server.listen(PORT);
function run(queryString) {
return new RSVP.Promise(function(resolve, reject) {
var url = 'http://localhost:' + PORT + '/tests/?' + queryString;
runInPhantom(url, 3, resolve, reject);
runInBrowser(url, 3, resolve, reject);
});
}

function runInPhantom(url, retries, resolve, reject) {
var args = [require.resolve('qunit-phantomjs-runner'), url, '900'];
function runInBrowser(url, retries, resolve, reject) {
var result = {output: [], errors: [], code: null};

console.log('Running: phantomjs ' + args.join(' '));
console.log('Running Chrome headless: ' + url);

var crashed = false;
var child = spawn('phantomjs', args);
var result = {output: [], errors: [], code: null};
var puppeteer = require('puppeteer');

child.stdout.on('data', function (data) {
var string = data.toString();
var lines = string.split('\n');
puppeteer.launch().then(function(browser) {
browser.newPage().then(function(page) {
/* globals window */
var crashed;

lines.forEach(function(line) {
if (line.indexOf('0 failed.') > -1) {
console.log(chalk.green(line));
} else {
console.log(line);
}
});
result.output.push(string);
});
page.on('console', function(msg) {
console.log(msg.text);

child.stderr.on('data', function (data) {
var string = data.toString();
result.output.push(msg.text);
});

if (string.indexOf('PhantomJS has crashed.') > -1) {
crashed = true;
}
page.on('error', function(err) {
var string = err.toString();

result.errors.push(string);
console.error(chalk.red(string));
});
if (string.indexOf('Chrome headless has crashed.') > -1) {
crashed = true;
}

result.errors.push(string);
console.error(chalk.red(string));
});

var addLogging = function() {
window.document.addEventListener('DOMContentLoaded', function() {
var testsTotal = 0;
var testsPassed = 0;
var testsFailed = 0;
var currentTestAssertions = [];

QUnit.log(function (details) {
var response;

// Ignore passing assertions
if (details.result) {
return;
}

response = details.message || '';

if (typeof details.expected !== 'undefined') {
if (response) {
response += ', ';
}

response += 'expected: ' + details.expected + ', but was: ' + details.actual;
}

if (details.source) {
response += '\n' + details.source;
}

currentTestAssertions.push('Failed assertion: ' + response);
});

QUnit.testDone(function (result) {
var i,
len,
name = '';

if (result.module) {
name += result.module + ': ';
}
name += result.name;

testsTotal++;

child.on('close', function (code) {
result.code = code;

if (!crashed && code === 0) {
resolve(result);
} else if (crashed) {
console.log(chalk.red('Phantom crashed with exit code ' + code));

if (retries > 1) {
console.log(chalk.yellow('Retrying... ¯\_(ツ)_/¯'));
runInPhantom(url, retries - 1, resolve, reject);
} else {
console.log(chalk.red('Giving up! (╯°□°)╯︵ ┻━┻'));
console.log(chalk.yellow('This might be a known issue with PhantomJS 1.9.8, skipping for now'));
resolve(result);
}
} else {
reject(result);
}
if (result.failed) {
testsFailed++;
console.log('\n' + 'Test failed: ' + name);

for (i = 0, len = currentTestAssertions.length; i < len; i++) {
console.log(' ' + currentTestAssertions[i]);
}
} else {
testsPassed++;
}

currentTestAssertions.length = 0;
});

QUnit.done(function (result) {
console.log('\n' + 'Took ' + result.runtime + 'ms to run ' + testsTotal + ' tests. ' + testsPassed + ' passed, ' + testsFailed + ' failed.');

if (typeof window.callPhantom === 'function') {
window.callPhantom({
'name': 'QUnit.done',
'data': result
});
}
});
});
};

page.exposeFunction('callPhantom', function(message) {
if (message && message.name === 'QUnit.done') {
result = message.data;
var failed = !result || !result.total || result.failed;

if (!result.total) {
console.error('No tests were executed. Are you loading tests asynchronously?');
}

var code = failed ? 1 : 0;
result.code = code;

if (!crashed && code === 0) {
resolve(result);
} else if (crashed) {
console.log(chalk.red('Browser crashed with exit code ' + code));

if (retries > 1) {
console.log(chalk.yellow('Retrying... ¯\_(ツ)_/¯'));
runInBrowser(url, retries - 1, resolve, reject);
} else {
console.log(chalk.red('Giving up! (╯°□°)╯︵ ┻━┻'));
console.log(chalk.yellow('This might be a known issue with Chrome headless, skipping for now'));
resolve(result);
}
} else {
reject(result);
}
}
});

page.evaluateOnNewDocument(addLogging);

page.goto(url, { timeout: 900 });
});
});
}

Expand Down Expand Up @@ -173,12 +255,11 @@ switch (process.env.TEST_SUITE) {
case 'travis-browsers':
console.log('suite: travis-browsers');
require('./run-travis-browser-tests');
return;

case 'sauce':
console.log('suite: sauce');
require('./run-sauce-tests');
return;
break;
case 'browserstack':
console.log('suite: browserstack');
require('./run-browserstack-tests');
break;
default:
console.log('suite: default (generate each package)');
generateEachPackageTests();
Expand Down
24 changes: 24 additions & 0 deletions lib/failure-only-testem-reporter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var TapReporter = require('testem/lib/reporters/tap_reporter');

function FailureOnlyReporter() {
TapReporter.apply(this, arguments);
this._reportCount = 0;
}

FailureOnlyReporter.prototype = Object.create(TapReporter.prototype);
FailureOnlyReporter.prototype.constructor = FailureOnlyReporter;

FailureOnlyReporter.prototype.display = function(prefix, result) {
this._reportCount++;

if (!result.passed) {
TapReporter.prototype.display.apply(this, arguments);
}

if (this._reportCount > 100) {
this.out.write('pass count: ' + this.pass + '\n');
this._reportCount = 0;
}
};

module.exports = FailureOnlyReporter;
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@
"build": "ember build --environment production",
"docs": "ember ember-cli-yuidoc",
"link:glimmer": "node bin/yarn-link-glimmer.js",
"sauce:launch": "ember sauce:launch",
"start": "ember serve",
"pretest": "ember build",
"lint": "tslint -p tsconfig.json && eslint node-tests",
"test": "node bin/run-tests.js",
"test:blueprints": "node node-tests/nodetest-runner.js",
"test:node": "node bin/run-node-tests.js",
"test:sauce": "node bin/run-sauce-tests.js",
"test:testem": "testem -f testem.dist.json"
"test:browserstack": "node bin/run-browserstack-tests.js",
"test:testem": "testem -f testem.dist.js"
},
"dependencies": {
"broccoli-funnel": "^2.0.1",
Expand Down Expand Up @@ -98,8 +97,8 @@
"dag-map": "^2.0.2",
"ember-cli": "2.10.0",
"ember-cli-blueprint-test-helpers": "^0.12.0",
"ember-cli-browserstack": "^0.0.4",
"ember-cli-dependency-checker": "^2.0.1",
"ember-cli-sauce": "^2.1.0",
"ember-cli-yuidoc": "^0.8.8",
"ember-dev": "github:emberjs/ember-dev#eace534",
"ember-publisher": "0.0.7",
Expand All @@ -113,8 +112,8 @@
"html-differ": "^1.3.4",
"lodash.uniq": "^4.5.0",
"mocha": "^2.4.5",
"puppeteer": "^0.13.0",
"qunit-extras": "^1.5.0",
"qunit-phantomjs-runner": "^2.2.0",
"qunitjs": "^1.22.0",
"route-recognizer": "^0.3.3",
"router_js": "^2.0.0-beta.1",
Expand All @@ -123,7 +122,7 @@
"serve-static": "^1.12.2",
"simple-dom": "^0.3.0",
"simple-html-tokenizer": "^0.4.1",
"testem": "1.15.0",
"testem": "^1.18.4",
"tslint": "^5.8.0"
},
"ember-addon": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-application/lib/system/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ Engine.reopenClass({
@return {*} the resolved value for a given lookup
*/
function resolverFor(namespace) {
let ResolverClass = namespace.get('Resolver') || DefaultResolver;
let ResolverClass = get(namespace, 'Resolver') || DefaultResolver;

return ResolverClass.create({
namespace
Expand Down
Loading