Skip to content

Commit

Permalink
[BUGFIX lts] Updates based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Garrett committed Aug 14, 2019
1 parent f51bf21 commit e526a04
Show file tree
Hide file tree
Showing 23 changed files with 635 additions and 300 deletions.
12 changes: 3 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,7 +59,8 @@ install:

jobs:
include:
- stage: basic test
- stage: Basic Tests
name: Debug and Prebuilt (All Tests by Package + Canary Features + Optional Jquery)
env: TEST_SUITE=each-package
script:
- yarn ember build
Expand All @@ -76,13 +77,7 @@ jobs:
- yarn ember build
- yarn test:browserstack

- name: Development (All Tests + Canary Features)
script:
- yarn ember build
- yarn test

- name: Production (All Tests + Canary Features)
env: SHOULD_TRANSPILE=true
script:
- yarn ember build -prod
- yarn test
Expand All @@ -95,7 +90,6 @@ jobs:

- name: Node.js Tests
node_js: "8"
env: SHOULD_TRANSPILE=true
script:
- yarn ember build -prod
- yarn test:node
Expand Down
9 changes: 4 additions & 5 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 RSVP = require('rsvp');
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 Down Expand Up @@ -97,14 +96,14 @@ function generateExtendPrototypeTests() {

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

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

return RSVP.Promise.all(results);
return Promise.all(results);
}

function runAndExit() {
Expand All @@ -128,7 +127,7 @@ switch (process.env.TEST_SUITE) {
runAndExit();
break;
case 'each-package':
console.log('suite: optional-features');
console.log('suite: each-package');
generateEachPackageTests();
runAndExit();
break;
Expand Down
5 changes: 5 additions & 0 deletions broccoli/canary-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ module.exports = function canaryFeatures(tree) {
},
'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
12 changes: 0 additions & 12 deletions broccoli/debug-macros.js

This file was deleted.

27 changes: 15 additions & 12 deletions broccoli/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const WriteFile = require('broccoli-file-creator');
const StringReplace = require('broccoli-string-replace');
const GlimmerTemplatePrecompiler = require('./glimmer-template-compiler');
const VERSION_PLACEHOLDER = /VERSION_STRING_PLACEHOLDER/g;
const transfromBabelPlugins = require('./transforms/transform-babel-plugins');
const canaryFeatures = require('./canary-features');
const injectNodeGlobals = require('./transforms/inject-node-globals');

Expand All @@ -37,6 +36,14 @@ module.exports.routerES = function _routerES() {
});
};

module.exports.jquery = function _jquery() {
return new Funnel(findLib('jquery'), {
files: ['jquery.js'],
destDir: 'jquery',
annotation: 'jquery',
});
};

module.exports.internalLoader = function _internalLoader() {
return new Funnel('packages/loader/lib', {
files: ['index.js'],
Expand Down Expand Up @@ -74,16 +81,12 @@ module.exports.getPackagesES = function getPackagesES() {
`get-packages-es:templates-output`
);

let nonTypeScriptContents = new Funnel(debuggedCompiledTemplatesAndTypeScript, {
srcDir: 'packages',
exclude: ['**/*.ts'],
});

// tsc / typescript handles decorators and class properties on its own
// so for non ts, transpile the proposal features (decorators, etc)
let transpiledProposals = debugTree(
transfromBabelPlugins(debugTree(nonTypeScriptContents, `get-packages-es:babel-plugins:input`)),
`get-packages-es:babel-plugins:output`
let nonTypeScriptContents = debugTree(
new Funnel(debuggedCompiledTemplatesAndTypeScript, {
srcDir: 'packages',
exclude: ['**/*.ts'],
}),
'get-packages-es:js:output'
);

let typescriptContents = new Funnel(debuggedCompiledTemplatesAndTypeScript, {
Expand All @@ -98,7 +101,7 @@ module.exports.getPackagesES = function getPackagesES() {

let debuggedCompiledTypescript = debugTree(typescriptCompiled, `get-packages-es:ts:output`);

let mergedFinalOutput = new MergeTrees([transpiledProposals, debuggedCompiledTypescript], {
let mergedFinalOutput = new MergeTrees([nonTypeScriptContents, debuggedCompiledTypescript], {
overwrite: true,
});

Expand Down
15 changes: 0 additions & 15 deletions broccoli/rename.js

This file was deleted.

1 change: 0 additions & 1 deletion broccoli/test-index-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const FEATURES = require('./features');
module.exports = function testIndexHTML() {
let index = new Funnel('tests', {
files: ['index.html'],
destDir: 'tests',
annotation: 'tests/index.html',
});
index = new StringReplace(index, {
Expand Down
33 changes: 0 additions & 33 deletions broccoli/to-es5.js

This file was deleted.

29 changes: 0 additions & 29 deletions broccoli/to-named-amd.js

This file was deleted.

13 changes: 0 additions & 13 deletions broccoli/transforms/test-babel-plugins.js

This file was deleted.

13 changes: 0 additions & 13 deletions broccoli/transforms/transform-babel-plugins.js

This file was deleted.

18 changes: 18 additions & 0 deletions config/browserlists.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const allSupportedBrowsers = [
'last 2 Chrome versions',
'last 2 Firefox versions',
'last 2 Safari versions',
'last 2 Edge versions',
'ie 11',
];

const modernBrowsers = [
'last 1 Chrome versions',
'last 1 Firefox versions',
'last 1 Safari versions',
];

module.exports = {
allSupportedBrowsers,
modernBrowsers,
};
9 changes: 9 additions & 0 deletions config/targets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';
const { allSupportedBrowsers, modernBrowsers } = require('./browserlists');

const isProduction = process.env.EMBER_ENV === 'production';
const shouldTranspile = Boolean(process.env.SHOULD_TRANSPILE);

module.exports = {
browsers: isProduction || shouldTranspile ? allSupportedBrowsers : modernBrowsers,
};
Loading

0 comments on commit e526a04

Please sign in to comment.