Repository: ember-cli/ember-cli
Pull request #7536 (2018-01-02 15:33:57)

Avoid bower usage in config/ember-try.js.

rwjblue: You can see this passing in https://github.com/emberjs/ember-test-helpers/pull/298.  

For example, in that PR when running `ember-release` you can see that it used the correct Ember version:

```
Scenario ember-release: SUCCESS
Command run: ember test
┌────────────────────┬────────────────────┬──────────────────────────────┬──────────┐
│ Dependency         │ Expected           │ Used                         │ Type     │
├────────────────────┼────────────────────┼──────────────────────────────┼──────────┤
│ ember-source       │ http://builds.emb… │ 2.18.0-release+dee84b06      │ yarn     │
└────────────────────┴────────────────────┴──────────────────────────────┴──────────┘
```
alexander-alvarez: Not sure if this is worth noting, but I tried this config in my app, and what was previously passing when pulling from bower now fails with weird errors (canary, beta, release)

My canary job passed on `3.0.0-alpha.1-null+213d4366` when using bower
```
ember-cli: 2.16.2
node: 8.9.3
os: linux x64
```
note I'm also using ember-concurrency.

some stacktraces
```
TypeError: _args.slice is not a function
at taskHelperClosure (http://localhost:7357/assets/vendor.js:183764:27)
at performHelper (http://localhost:7357/assets/iris-web.js:7186:43)
at SimpleHelperReference.compute (http://localhost:7357/assets/vendor.js:36562:20)
at SimpleHelperReference.value (http://localhost:7357/assets/vendor.js:36252:53)
at CapturedNamedArguments.value (http://localhost:7357/assets/vendor.js:16768:43)
at processComponentArgs (http://localhost:7357/assets/vendor.js:36159:31)
at CurlyComponentManager.create (http://localhost:7357/assets/vendor.js:29978:63)
at http://localhost:7357/assets/vendor.js:17751:33
at AppendOpcodes.evaluate (http://localhost:7357/assets/vendor.js:16150:13)

```
```
at Object.actions.onChange (http://localhost:7357/assets/tests.js:1259:16)
at Backburner._join (http://localhost:7357/assets/vendor.js:24953:31)
at Backburner.join (http://localhost:7357/assets/vendor.js:24702:25)
at Function.run.join (http://localhost:7357/assets/vendor.js:41466:30)
```
```
>
at Object.<anonymous> (http://localhost:7357/assets/tests.js:2888:14)
at <anonymous>
```

Let me know if there's any other context I can give
kategengler: I did some testing of this and found that the package is cached by npm by url, so this approach will not work unless the cache is cleared.

For example, Build #1 runs yesterday with `.../canary.tgz`, Build #2 runs today, without a cleared cache, will use the exact package from yesterday, making this not a successful way to test the latest canary. 

I observed the same behavior with yarn.
rwjblue: Yep, my current plan is to update ember-try to resolve promises  (still not certain of the exact API) so that we can fetch the current SHA (which is an immutable tarball for that SHA specific URL)...

kellyselden: Similar to #7468
rwjblue: Updated to match the concerns mentioned by @kategengler above, should be ready for another round of review...

Patch:
diff --git a/blueprints/addon/files/addon-config/ember-try.js b/blueprints/addon/files/addon-config/ember-try.js
index 1ab8ae562..ba5b2703e 100644
--- a/blueprints/addon/files/addon-config/ember-try.js
+++ b/blueprints/addon/files/addon-config/ember-try.js
@@ -1,75 +1,63 @@
-module.exports = {
-  <% if (yarn) { %>useYarn: true,
-  <% } %>scenarios: [
-    {
-      name: 'ember-lts-2.12',
-      npm: {
-        devDependencies: {
-          'ember-source': '~2.12.0'
-        }
-      }
-    },
-    {
-      name: 'ember-lts-2.16',
-      npm: {
-        devDependencies: {
-          'ember-source': '~2.16.0'
-        }
-      }
-    },
-    {
-      name: 'ember-release',
-      bower: {
-        dependencies: {
-          'ember': 'components/ember#release'
+'use strict';
+
+const getChannelURL = require('ember-source-channel-url');
+
+module.exports = function() {
+  return Promise.all([
+    getChannelURL('release'),
+    getChannelURL('beta'),
+    getChannelURL('canary'),
+  ]).then((urls) => {
+    return {
+      <% if (yarn) { %>useYarn: true,
+      <% } %>scenarios: [
+        {
+          name: 'ember-lts-2.12',
+          npm: {
+            devDependencies: {
+              'ember-source': '~2.12.0'
+            }
+          }
         },
-        resolutions: {
-          'ember': 'release'
-        }
-      },
-      npm: {
-        devDependencies: {
-          'ember-source': null
-        }
-      }
-    },
-    {
-      name: 'ember-beta',
-      bower: {
-        dependencies: {
-          'ember': 'components/ember#beta'
+        {
+          name: 'ember-lts-2.16',
+          npm: {
+            devDependencies: {
+              'ember-source': '~2.16.0'
+            }
+          }
         },
-        resolutions: {
-          'ember': 'beta'
-        }
-      },
-      npm: {
-        devDependencies: {
-          'ember-source': null
-        }
-      }
-    },
-    {
-      name: 'ember-canary',
-      bower: {
-        dependencies: {
-          'ember': 'components/ember#canary'
+        {
+          name: 'ember-release',
+          npm: {
+            devDependencies: {
+              'ember-source': urls[0]
+            }
+          }
         },
-        resolutions: {
-          'ember': 'canary'
-        }
-      },
-      npm: {
-        devDependencies: {
-          'ember-source': null
-        }
-      }
-    },
-    {
-      name: 'ember-default',
-      npm: {
-        devDependencies: {}
-      }
-    }
-  ]
+        {
+          name: 'ember-beta',
+          npm: {
+            devDependencies: {
+              'ember-source': urls[1]
+            }
+          }
+        },
+        {
+          name: 'ember-canary',
+          npm: {
+            devDependencies: {
+              'ember-source': urls[2]
+            }
+          }
+        },
+        {
+          name: 'ember-default',
+          npm: {
+            devDependencies: {}
+          }
+        }
+      ]
+    };
+  });
 };
diff --git a/blueprints/addon/index.js b/blueprints/addon/index.js
index a4874a732..89c18c65e 100644
--- a/blueprints/addon/index.js
+++ b/blueprints/addon/index.js
@@ -66,7 +66,10 @@ module.exports = {
     contents.devDependencies['eslint-plugin-node'] = '^5.2.1';
 
     // add ember-try
-    contents.devDependencies['ember-try'] = '^0.2.22';
+    contents.devDependencies['ember-try'] = '^0.2.23';
+
+    // add ember-source-channel-url
+    contents.devDependencies['ember-source-channel-url'] = '^1.0.1';
 
     // use `ember-try` as test script in addons by default
     contents.scripts.test = 'ember try:each';


Test patch:
diff --git a/tests/fixtures/addon/npm/config/ember-try.js b/tests/fixtures/addon/npm/config/ember-try.js
index 1c31c5491..97872be49 100644
--- a/tests/fixtures/addon/npm/config/ember-try.js
+++ b/tests/fixtures/addon/npm/config/ember-try.js
@@ -1,74 +1,62 @@
-module.exports = {
-  scenarios: [
-    {
-      name: 'ember-lts-2.12',
-      npm: {
-        devDependencies: {
-          'ember-source': '~2.12.0'
-        }
-      }
-    },
-    {
-      name: 'ember-lts-2.16',
-      npm: {
-        devDependencies: {
-          'ember-source': '~2.16.0'
-        }
-      }
-    },
-    {
-      name: 'ember-release',
-      bower: {
-        dependencies: {
-          'ember': 'components/ember#release'
+'use strict';
+
+const getChannelURL = require('ember-source-channel-url');
+
+module.exports = function() {
+  return Promise.all([
+    getChannelURL('release'),
+    getChannelURL('beta'),
+    getChannelURL('canary'),
+  ]).then((urls) => {
+    return {
+      scenarios: [
+        {
+          name: 'ember-lts-2.12',
+          npm: {
+            devDependencies: {
+              'ember-source': '~2.12.0'
+            }
+          }
         },
-        resolutions: {
-          'ember': 'release'
-        }
-      },
-      npm: {
-        devDependencies: {
-          'ember-source': null
-        }
-      }
-    },
-    {
-      name: 'ember-beta',
-      bower: {
-        dependencies: {
-          'ember': 'components/ember#beta'
+        {
+          name: 'ember-lts-2.16',
+          npm: {
+            devDependencies: {
+              'ember-source': '~2.16.0'
+            }
+          }
         },
-        resolutions: {
-          'ember': 'beta'
-        }
-      },
-      npm: {
-        devDependencies: {
-          'ember-source': null
-        }
-      }
-    },
-    {
-      name: 'ember-canary',
-      bower: {
-        dependencies: {
-          'ember': 'components/ember#canary'
+        {
+          name: 'ember-release',
+          npm: {
+            devDependencies: {
+              'ember-source': urls[0]
+            }
+          }
         },
-        resolutions: {
-          'ember': 'canary'
-        }
-      },
-      npm: {
-        devDependencies: {
-          'ember-source': null
-        }
-      }
-    },
-    {
-      name: 'ember-default',
-      npm: {
-        devDependencies: {}
-      }
-    }
-  ]
+        {
+          name: 'ember-beta',
+          npm: {
+            devDependencies: {
+              'ember-source': urls[1]
+            }
+          }
+        },
+        {
+          name: 'ember-canary',
+          npm: {
+            devDependencies: {
+              'ember-source': urls[2]
+            }
+          }
+        },
+        {
+          name: 'ember-default',
+          npm: {
+            devDependencies: {}
+          }
+        }
+      ]
+    };
+  });
 };
diff --git a/tests/fixtures/addon/npm/package.json b/tests/fixtures/addon/npm/package.json
index 1dc26c99b..64f1b9e75 100644
--- a/tests/fixtures/addon/npm/package.json
+++ b/tests/fixtures/addon/npm/package.json
@@ -40,7 +40,8 @@
     "ember-maybe-import-regenerator": "^0.1.6",
     "ember-resolver": "^4.0.0",
     "ember-source": "~3.0.0-beta.1",
-    "ember-try": "^0.2.22",
+    "ember-source-channel-url": "^1.0.1",
+    "ember-try": "^0.2.23",
     "eslint-plugin-ember": "^5.0.0",
     "eslint-plugin-node": "^5.2.1",
     "loader.js": "^4.2.3"
diff --git a/tests/fixtures/addon/yarn/config/ember-try.js b/tests/fixtures/addon/yarn/config/ember-try.js
index 1a4a5bbd3..38d08c9dd 100644
--- a/tests/fixtures/addon/yarn/config/ember-try.js
+++ b/tests/fixtures/addon/yarn/config/ember-try.js
@@ -1,75 +1,63 @@
-module.exports = {
-  useYarn: true,
-  scenarios: [
-    {
-      name: 'ember-lts-2.12',
-      npm: {
-        devDependencies: {
-          'ember-source': '~2.12.0'
-        }
-      }
-    },
-    {
-      name: 'ember-lts-2.16',
-      npm: {
-        devDependencies: {
-          'ember-source': '~2.16.0'
-        }
-      }
-    },
-    {
-      name: 'ember-release',
-      bower: {
-        dependencies: {
-          'ember': 'components/ember#release'
+'use strict';
+
+const getChannelURL = require('ember-source-channel-url');
+
+module.exports = function() {
+  return Promise.all([
+    getChannelURL('release'),
+    getChannelURL('beta'),
+    getChannelURL('canary'),
+  ]).then((urls) => {
+    return {
+      useYarn: true,
+      scenarios: [
+        {
+          name: 'ember-lts-2.12',
+          npm: {
+            devDependencies: {
+              'ember-source': '~2.12.0'
+            }
+          }
         },
-        resolutions: {
-          'ember': 'release'
-        }
-      },
-      npm: {
-        devDependencies: {
-          'ember-source': null
-        }
-      }
-    },
-    {
-      name: 'ember-beta',
-      bower: {
-        dependencies: {
-          'ember': 'components/ember#beta'
+        {
+          name: 'ember-lts-2.16',
+          npm: {
+            devDependencies: {
+              'ember-source': '~2.16.0'
+            }
+          }
         },
-        resolutions: {
-          'ember': 'beta'
-        }
-      },
-      npm: {
-        devDependencies: {
-          'ember-source': null
-        }
-      }
-    },
-    {
-      name: 'ember-canary',
-      bower: {
-        dependencies: {
-          'ember': 'components/ember#canary'
+        {
+          name: 'ember-release',
+          npm: {
+            devDependencies: {
+              'ember-source': urls[0]
+            }
+          }
         },
-        resolutions: {
-          'ember': 'canary'
-        }
-      },
-      npm: {
-        devDependencies: {
-          'ember-source': null
-        }
-      }
-    },
-    {
-      name: 'ember-default',
-      npm: {
-        devDependencies: {}
-      }
-    }
-  ]
+        {
+          name: 'ember-beta',
+          npm: {
+            devDependencies: {
+              'ember-source': urls[1]
+            }
+          }
+        },
+        {
+          name: 'ember-canary',
+          npm: {
+            devDependencies: {
+              'ember-source': urls[2]
+            }
+          }
+        },
+        {
+          name: 'ember-default',
+          npm: {
+            devDependencies: {}
+          }
+        }
+      ]
+    };
+  });
 };
diff --git a/tests/fixtures/addon/yarn/package.json b/tests/fixtures/addon/yarn/package.json
index 815604df8..10d879da5 100644
--- a/tests/fixtures/addon/yarn/package.json
+++ b/tests/fixtures/addon/yarn/package.json
@@ -40,7 +40,8 @@
     "ember-maybe-import-regenerator": "^0.1.6",
     "ember-resolver": "^4.0.0",
     "ember-source": "~3.0.0-beta.1",
-    "ember-try": "^0.2.22",
+    "ember-source-channel-url": "^1.0.1",
+    "ember-try": "^0.2.23",
     "ember-welcome-page": "^3.0.0",
     "eslint-plugin-ember": "^5.0.0",
     "eslint-plugin-node": "^5.2.1",
diff --git a/tests/unit/blueprints/addon-test.js b/tests/unit/blueprints/addon-test.js
index 944651acf..e41f23558 100644
--- a/tests/unit/blueprints/addon-test.js
+++ b/tests/unit/blueprints/addon-test.js
@@ -76,7 +76,8 @@ describe('blueprint - addon', function() {
   "dependencies": {},\n\
   "devDependencies": {\n\
     "ember-disable-prototype-extensions": "^1.1.2",\n\
-    "ember-try": "^0.2.22",\n\
+    "ember-source-channel-url": "^1.0.1",\n\
+    "ember-try": "^0.2.23",\n\
     "eslint-plugin-node": "^5.2.1"\n\
   },\n\
   "ember-addon": {\n\
@@ -174,6 +175,7 @@ describe('blueprint - addon', function() {
         delete json.devDependencies['ember-disable-prototype-extensions'];
         delete json.devDependencies['eslint-plugin-node'];
         delete json.devDependencies['ember-try'];
+        delete json.devDependencies['ember-source-channel-url'];
         expect(json.dependencies).to.deep.equal({ a: "1", b: "1" });
         expect(json.devDependencies).to.deep.equal({ a: "1", b: "1" });
       });