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

[BUGFIX lts] Compile Ember dynamically in consuming applications #18208

Merged
merged 2 commits into from
Aug 15, 2019
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
28 changes: 19 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cache:
yarn: true

stages:
- basic test
- basic tests
- additional tests
- name: deploy
if: type IN (push)
Expand All @@ -59,24 +59,34 @@ install:

jobs:
include:
- stage: basic test
env: TEST_SUITE=each-package-tests
- stage: Basic Tests
name: Debug and Prebuilt (All Tests by Package + Canary Features + Optional Jquery)
env: TEST_SUITE=each-package
script:
- yarn ember build
- yarn test

- name: Linting
script:
- yarn lint

- stage: additional tests
- stage: Additional Tests
name: Browserstack Tests (Safari, Edge, IE11)
env: SHOULD_TRANSPILE=true
script:
- yarn ember build -prod
- yarn ember build
- yarn test:browserstack

- env:
- TEST_SUITE=built-tests
- EMBER_ENV=production
- name: Production (All Tests + Canary Features)
script:
- yarn ember build -prod
- yarn test

- env: TEST_SUITE=old-jquery-and-extend-prototypes
- name: Old Jquery and Extend Prototypes
env: TEST_SUITE=old-jquery-and-extend-prototypes
script:
- yarn ember build
- yarn test

- name: Node.js Tests
node_js: "8"
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,15 @@ When you submit your PR (or later change that code), a Travis build will automat

Within the Travis build, you can see that we (currently) run six different test suites.

* The `each-package-tests` test suite is closest to what you normally run locally on your machine.
* The `each-package` 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 `browserstack` test suite runs tests against various supported browsers.

## Common Travis CI Build Issues

### Production Build Failures

If your build is failing on the 'production' suite, you may be relying on a debug-only function that does not even exist in a production build (`Ember.warn`, `Ember.deprecate`, `Ember.assert`, etc.). These will pass on the 'each-package-tests' suite (and locally) because those functions are present in development builds.
If your build is failing on the 'production' suite, you may be relying on a debug-only function that does not even exist in a production build (`Ember.warn`, `Ember.deprecate`, `Ember.assert`, etc.). These will pass on the 'each-package' suite (and locally) because those functions are present in development builds.

There are helpers for many of these functions, which will resolve this for you: `expectDeprecation`, `expectAssertion`, etc. Please use these helpers when dealing with these functions.

Expand Down
34 changes: 19 additions & 15 deletions bin/run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
'use strict';

const chalk = require('chalk');
const runInSequence = require('../lib/run-in-sequence');
const path = require('path');

const finalhandler = require('finalhandler');
Expand Down Expand Up @@ -55,7 +54,7 @@ function generateTestsFor(packageName) {
}

testFunctions.push(() => run('package=' + packageName));
testFunctions.push(() => run('package=' + packageName + '&dist=es'));
testFunctions.push(() => run('package=' + packageName + '&prebuilt=true'));
testFunctions.push(() => run('package=' + packageName + '&enableoptionalfeatures=true'));

// TODO: this should ultimately be deleted (when all packages can run with and
Expand All @@ -79,15 +78,9 @@ function generateEachPackageTests() {
.forEach(generateTestsFor);
}

function generateBuiltTests() {
function generateStandardTests() {
testFunctions.push(() => run(''));
testFunctions.push(() => run('dist=min&prod=true'));
testFunctions.push(() => run('dist=prod&prod=true'));
testFunctions.push(() => run('enableoptionalfeatures=true&dist=prod&prod=true'));
testFunctions.push(() => run('legacy=true'));
testFunctions.push(() => run('legacy=true&dist=min&prod=true'));
testFunctions.push(() => run('legacy=true&dist=prod&prod=true'));
testFunctions.push(() => run('legacy=true&enableoptionalfeatures=true&dist=prod&prod=true'));
testFunctions.push(() => run('enableoptionalfeatures=true'));
}

function generateOldJQueryTests() {
Expand All @@ -101,6 +94,18 @@ function generateExtendPrototypeTests() {
testFunctions.push(() => run('extendprototypes=true&enableoptionalfeatures=true'));
}

function runInSequence(tasks) {
var length = tasks.length;
var current = Promise.resolve();
var results = new Array(length);

for (var i = 0; i < length; ++i) {
current = results[i] = current.then(tasks[i]);
}

return Promise.all(results);
}

function runAndExit() {
runInSequence(testFunctions)
.then(function() {
Expand All @@ -121,9 +126,9 @@ switch (process.env.TEST_SUITE) {
generateTestsFor(p);
runAndExit();
break;
case 'built-tests':
console.log('suite: built-tests');
generateBuiltTests();
case 'each-package':
console.log('suite: each-package');
generateEachPackageTests();
runAndExit();
break;
case 'old-jquery-and-extend-prototypes':
Expand All @@ -134,14 +139,13 @@ switch (process.env.TEST_SUITE) {
break;
case 'all':
console.log('suite: all');
generateBuiltTests();
generateOldJQueryTests();
generateExtendPrototypeTests();
generateEachPackageTests();
runAndExit();
break;
default:
console.log('suite: default (generate each package)');
generateEachPackageTests();
generateStandardTests();
runAndExit();
}
37 changes: 0 additions & 37 deletions broccoli/bootstrap-modules.js

This file was deleted.

19 changes: 7 additions & 12 deletions broccoli/debug-macros.js → broccoli/canary-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,12 @@
const Babel = require('broccoli-babel-transpiler');
const FEATURES = require('./features');

module.exports = function debugMacros(tree, environment) {
let isDebug = environment !== 'production';

module.exports = function canaryFeatures(tree) {
let plugins = [
[
'debug-macros',
{
debugTools: {
source: '@ember/debug',
assertPredicateIndex: 1,
isDebug,
},
externalizeHelpers: {
module: true,
},
flags: [
{ source: '@glimmer/env', flags: { DEBUG: isDebug } },
{
source: '@ember/canary-features',
flags: Object.assign(
Expand All @@ -36,7 +25,13 @@ module.exports = function debugMacros(tree, environment) {
},
],
},
'debug-macros:canary-flags',
],

// These plugins are necessary for being able to run test code through this
// transform, since some tests use decorators and class fields
['@babel/plugin-proposal-decorators', { legacy: true }],
['@babel/plugin-proposal-class-properties', { loose: true }],
];

return new Babel(tree, { plugins });
Expand Down
32 changes: 0 additions & 32 deletions broccoli/concat-bundle.js

This file was deleted.

Loading