From ccfe851a83791c011561f09f98b879547e4cb2c3 Mon Sep 17 00:00:00 2001 From: Jacob Jewell Date: Sun, 30 Oct 2016 20:53:03 -0400 Subject: [PATCH 01/11] update broccoli-coffee to 0.7.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 700a4d4..c7c709f 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "blueprints" ], "dependencies": { - "broccoli-coffee": "~0.6.0", + "broccoli-coffee": "~0.7.0", "broccoli-persistent-filter": "^1.1.0", "chalk": "^1.0.0", "coffeelint": "^1.6.1", From d15c447b1cf59bb68469f11101e71104f51ac021 Mon Sep 17 00:00:00 2001 From: Jacob Jewell Date: Sun, 30 Oct 2016 21:09:19 -0400 Subject: [PATCH 02/11] backticks are not needed anymore --- README.md | 49 +------------------ .../tests/acceptance/__name__-test.coffee | 6 +-- .../files/tests/unit/__path__/__test__.coffee | 2 +- .../files/__root__/__path__/__name__.coffee | 4 +- .../files/__root__/__path__/__name__.coffee | 2 +- .../files/__root__/__path__/__name__.coffee | 2 +- .../__testType__/__path__/__test__.coffee | 2 +- blueprints/component-test/index.js | 2 +- .../files/__root__/__path__/__name__.coffee | 4 +- blueprints/component/index.js | 6 --- .../files/tests/unit/__path__/__test__.coffee | 2 +- .../files/__root__/__path__/__name__.coffee | 4 +- .../files/__root__/__path__/__name__.coffee | 2 +- .../tests/unit/helpers/__name__-test.coffee | 4 +- .../files/__root__/helpers/__name__.coffee | 6 +-- .../files/__root__/__path__/__name__.coffee | 2 +- .../unit/initializers/__name__-test.coffee | 6 +-- .../__root__/initializers/__name__.coffee | 4 +- .../tests/unit/mixins/__name__-test.coffee | 6 +-- .../files/__root__/mixins/__name__.coffee | 4 +- .../files/tests/unit/__path__/__test__.coffee | 2 +- .../files/__root__/__path__/__name__.coffee | 4 +- .../files/__root__/__path__/__name__.coffee | 2 +- .../__templatepath__/__templatename__.coffee | 2 +- .../tests/unit/__path__/__test__.coffee | 2 +- .../files/__root__/__path__/__name__.coffee | 4 +- .../tests/unit/__path__/__test__.coffee | 2 +- .../files/__root__/__path__/__name__.coffee | 4 +- .../tests/unit/services/__name__-test.coffee | 2 +- .../files/__root__/__path__/__name__.coffee | 4 +- .../files/tests/helpers/__name__.coffee | 4 +- .../tests/unit/__path__/__test__.coffee | 2 +- .../files/__root__/__path__/__name__.coffee | 4 +- .../tests/unit/utils/__name__-test.coffee | 4 +- .../util/files/__root__/utils/__name__.coffee | 2 +- .../tests/unit/__path__/__test__.coffee | 2 +- .../files/__root__/__path__/__name__.coffee | 4 +- tests/dummy/app/app.coffee | 10 ++-- tests/dummy/app/router.coffee | 6 +-- tests/dummy/app/routes/index.coffee | 4 +- 40 files changed, 68 insertions(+), 121 deletions(-) diff --git a/README.md b/README.md index b110c4d..439b037 100644 --- a/README.md +++ b/README.md @@ -17,41 +17,6 @@ earlier versions, but I wouldn't know. ### How to use -#### CoffeeScript and ember-cli -There is one thing to note when using CoffeeScript with ember-cli: the syntax for _ES6-modules_. -In ember-cli-apps written in JavaScript, this is a common pattern: - -```js -// app/components/my-component.js -import Ember from 'ember'; - -export default Ember.Component.extend({ - tagName: 'div' -}); -``` - -Writing `import` or `export` in a CoffeeScript-file causes an error, so we'll need -to escape these lines with backticks so they run as JavaScript. - -We also need to store the export in a variable to export at the end, we can't export -directly as done above. Please note that the name of this variable does not affect -the name of the component itself - that is based entirely on the file name and placement. - -Here's the above file in CoffeeScript: - -```coffee -# app/components/my-component.coffee -`import Ember from 'ember'` - -MyComponent = Ember.Component.extend - tagName: 'div' - -`export default MyComponent` -``` - -Luckily, all the blueprints included with ember-cli-coffeescript do this for you! Which -leads to… - #### Blueprints Run `ember help generate` to get a list of available blueprints. Use them by running `ember g `. For instance, to generate the above component: @@ -89,19 +54,7 @@ ENV.coffeeOptions = { } ``` -You can set `lint` to `true` to enable linting with the default configurations, but you will probably -want to add a `coffeelint.json` file to the root of your project either way, for instance to turn -off the error for backticks. - -Example `coffeelint.json`: - -```json -{ - "no_backticks": { - "level": "ignore" - } -} -``` +You can set `lint` to `true` to enable linting with the default configurations You can find all the [available options on the website for `coffeelint`](http://www.coffeelint.org/#options). diff --git a/blueprints/acceptance-test/files/tests/acceptance/__name__-test.coffee b/blueprints/acceptance-test/files/tests/acceptance/__name__-test.coffee index 5784531..13993ae 100644 --- a/blueprints/acceptance-test/files/tests/acceptance/__name__-test.coffee +++ b/blueprints/acceptance-test/files/tests/acceptance/__name__-test.coffee @@ -1,6 +1,6 @@ -`import Ember from 'ember'` -`import { module, test } from 'qunit'` -`import startApp from '<%= testFolderRoot %>/tests/helpers/start-app'` +import Ember from 'ember' +import { module, test } from 'qunit' +import startApp from '<%= testFolderRoot %>/tests/helpers/start-app' module 'Acceptance: <%= classifiedModuleName %>', beforeEach: -> diff --git a/blueprints/adapter-test/files/tests/unit/__path__/__test__.coffee b/blueprints/adapter-test/files/tests/unit/__path__/__test__.coffee index 3f9eec6..662585f 100644 --- a/blueprints/adapter-test/files/tests/unit/__path__/__test__.coffee +++ b/blueprints/adapter-test/files/tests/unit/__path__/__test__.coffee @@ -1,4 +1,4 @@ -`import { moduleFor, test } from 'ember-qunit'` +import { moduleFor, test } from 'ember-qunit' moduleFor 'adapter:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', { # Specify the other units that are required for this test. diff --git a/blueprints/adapter/files/__root__/__path__/__name__.coffee b/blueprints/adapter/files/__root__/__path__/__name__.coffee index 7b5fe01..d2dea46 100644 --- a/blueprints/adapter/files/__root__/__path__/__name__.coffee +++ b/blueprints/adapter/files/__root__/__path__/__name__.coffee @@ -1,5 +1,5 @@ -`<%= importStatement %>` +<%= importStatement %> <%= classifiedModuleName %>Adapter = <%= baseClass %>.extend() -`export default <%= classifiedModuleName %>Adapter` +export default <%= classifiedModuleName %>Adapter diff --git a/blueprints/addon-import/files/__root__/__path__/__name__.coffee b/blueprints/addon-import/files/__root__/__path__/__name__.coffee index a8d18e0..f9b6ee1 100644 --- a/blueprints/addon-import/files/__root__/__path__/__name__.coffee +++ b/blueprints/addon-import/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -`export { default } from '<%= modulePath %>'` +export { default } from '<%= modulePath %>' diff --git a/blueprints/component-addon/files/__root__/__path__/__name__.coffee b/blueprints/component-addon/files/__root__/__path__/__name__.coffee index a8d18e0..f9b6ee1 100644 --- a/blueprints/component-addon/files/__root__/__path__/__name__.coffee +++ b/blueprints/component-addon/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -`export { default } from '<%= modulePath %>'` +export { default } from '<%= modulePath %>' diff --git a/blueprints/component-test/files/tests/__testType__/__path__/__test__.coffee b/blueprints/component-test/files/tests/__testType__/__path__/__test__.coffee index d330751..34293af 100644 --- a/blueprints/component-test/files/tests/__testType__/__path__/__test__.coffee +++ b/blueprints/component-test/files/tests/__testType__/__path__/__test__.coffee @@ -1,4 +1,4 @@ -`import { test, moduleForComponent } from 'ember-qunit'`<%= testImports %> +import { test, moduleForComponent } from 'ember-qunit'<%= testImports %> moduleForComponent '<%= componentPathName %>', '<%= friendlyTestDescription %>', { <%= testOptions %> diff --git a/blueprints/component-test/index.js b/blueprints/component-test/index.js index 9b47bff..666a6da 100644 --- a/blueprints/component-test/index.js +++ b/blueprints/component-test/index.js @@ -30,7 +30,7 @@ module.exports = { var locals = blueprint.locals.apply(blueprint, arguments); var dasherizedModuleName = stringUtils.dasherize(options.entity.name); - var testImports = EOL + "`import hbs from 'htmlbars-inline-precompile'`"; + var testImports = EOL + "import hbs from 'htmlbars-inline-precompile'"; var testOptions = "integration: true"; var testContent = "assert.expect 2" + EOL + EOL + diff --git a/blueprints/component/files/__root__/__path__/__name__.coffee b/blueprints/component/files/__root__/__path__/__name__.coffee index 85c137b..41a8781 100644 --- a/blueprints/component/files/__root__/__path__/__name__.coffee +++ b/blueprints/component/files/__root__/__path__/__name__.coffee @@ -1,5 +1,5 @@ -`import Ember from 'ember'` +import Ember from 'ember' <%= importTemplate %> <%= classifiedModuleName %>Component = Ember.Component.extend(<%=contents%>) -`export default <%= classifiedModuleName %>Component` +export default <%= classifiedModuleName %>Component diff --git a/blueprints/component/index.js b/blueprints/component/index.js index efa1c79..6ebf491 100644 --- a/blueprints/component/index.js +++ b/blueprints/component/index.js @@ -39,13 +39,7 @@ module.exports = { newContents = locals.contents + '\n'; } - var newImport = ''; - if (locals.importTemplate) { - newImport = "`" + locals.importTemplate.replace(/;/, '`'); - } - locals.contents = newContents; - locals.importTemplate = newImport; return locals; } diff --git a/blueprints/controller-test/files/tests/unit/__path__/__test__.coffee b/blueprints/controller-test/files/tests/unit/__path__/__test__.coffee index 94c6c62..ed141da 100644 --- a/blueprints/controller-test/files/tests/unit/__path__/__test__.coffee +++ b/blueprints/controller-test/files/tests/unit/__path__/__test__.coffee @@ -1,4 +1,4 @@ -`import { moduleFor, test } from 'ember-qunit'` +import { moduleFor, test } from 'ember-qunit' moduleFor 'controller:<%= dasherizedModuleName %>', { # Specify the other units that are required for this test. diff --git a/blueprints/controller/files/__root__/__path__/__name__.coffee b/blueprints/controller/files/__root__/__path__/__name__.coffee index aace91d..6b340fe 100644 --- a/blueprints/controller/files/__root__/__path__/__name__.coffee +++ b/blueprints/controller/files/__root__/__path__/__name__.coffee @@ -1,5 +1,5 @@ -`import Ember from 'ember'` +import Ember from 'ember' <%= classifiedModuleName %>Controller = Ember.Controller.extend() -`export default <%= classifiedModuleName %>Controller` +export default <%= classifiedModuleName %>Controller diff --git a/blueprints/helper-addon/files/__root__/__path__/__name__.coffee b/blueprints/helper-addon/files/__root__/__path__/__name__.coffee index a87da13..100e0d5 100644 --- a/blueprints/helper-addon/files/__root__/__path__/__name__.coffee +++ b/blueprints/helper-addon/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -`export { default, <%= camelizedModuleName %> } from '<%= modulePath %>'` +export { default, <%= camelizedModuleName %> } from '<%= modulePath %>' diff --git a/blueprints/helper-test/files/tests/unit/helpers/__name__-test.coffee b/blueprints/helper-test/files/tests/unit/helpers/__name__-test.coffee index 30ac441..8e8412d 100644 --- a/blueprints/helper-test/files/tests/unit/helpers/__name__-test.coffee +++ b/blueprints/helper-test/files/tests/unit/helpers/__name__-test.coffee @@ -1,5 +1,5 @@ -`import { <%= camelizedModuleName %> } from '<%= dasherizedModulePrefix %>/helpers/<%= dasherizedModuleName %>'` -`import { module, test } from 'qunit'` +import { <%= camelizedModuleName %> } from '<%= dasherizedModulePrefix %>/helpers/<%= dasherizedModuleName %>' +import { module, test } from 'qunit' module '<%= friendlyTestName %>' diff --git a/blueprints/helper/files/__root__/helpers/__name__.coffee b/blueprints/helper/files/__root__/helpers/__name__.coffee index 307a648..f29565a 100644 --- a/blueprints/helper/files/__root__/helpers/__name__.coffee +++ b/blueprints/helper/files/__root__/helpers/__name__.coffee @@ -1,4 +1,4 @@ -`import Ember from 'ember'` +import Ember from 'ember' # This function receives the params `params, hash` <%= camelizedModuleName %> = (params) -> @@ -6,6 +6,6 @@ <%= classifiedModuleName %>Helper = Ember.Helper.helper <%= camelizedModuleName %> -`export { <%= camelizedModuleName %> }` +export { <%= camelizedModuleName %> } -`export default <%= classifiedModuleName %>Helper` +export default <%= classifiedModuleName %>Helper diff --git a/blueprints/initializer-addon/files/__root__/__path__/__name__.coffee b/blueprints/initializer-addon/files/__root__/__path__/__name__.coffee index a7b812f..c7b0415 100644 --- a/blueprints/initializer-addon/files/__root__/__path__/__name__.coffee +++ b/blueprints/initializer-addon/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -`export { default, initialize } from '<%= modulePath %>'` +export { default, initialize } from '<%= modulePath %>' diff --git a/blueprints/initializer-test/files/tests/unit/initializers/__name__-test.coffee b/blueprints/initializer-test/files/tests/unit/initializers/__name__-test.coffee index b922c13..39787dd 100644 --- a/blueprints/initializer-test/files/tests/unit/initializers/__name__-test.coffee +++ b/blueprints/initializer-test/files/tests/unit/initializers/__name__-test.coffee @@ -1,6 +1,6 @@ -`import Ember from 'ember'` -`import { initialize } from '<%= dasherizedModulePrefix %>/initializers/<%= dasherizedModuleName %>'` -`import { module, test } from 'qunit'` +import Ember from 'ember' +import { initialize } from '<%= dasherizedModulePrefix %>/initializers/<%= dasherizedModuleName %>' +import { module, test } from 'qunit' application = null registry = null diff --git a/blueprints/initializer/files/__root__/initializers/__name__.coffee b/blueprints/initializer/files/__root__/initializers/__name__.coffee index d209163..6305b2a 100644 --- a/blueprints/initializer/files/__root__/initializers/__name__.coffee +++ b/blueprints/initializer/files/__root__/initializers/__name__.coffee @@ -6,5 +6,5 @@ initialize = () -> name: '<%= dasherizedModuleName %>' initialize: initialize -`export {initialize}` -`export default <%= classifiedModuleName %>Initializer` +export {initialize} +export default <%= classifiedModuleName %>Initializer diff --git a/blueprints/mixin-test/files/tests/unit/mixins/__name__-test.coffee b/blueprints/mixin-test/files/tests/unit/mixins/__name__-test.coffee index 4aca172..d2c6015 100644 --- a/blueprints/mixin-test/files/tests/unit/mixins/__name__-test.coffee +++ b/blueprints/mixin-test/files/tests/unit/mixins/__name__-test.coffee @@ -1,6 +1,6 @@ -`import Ember from 'ember'` -`import <%= classifiedModuleName %>Mixin from '../../../mixins/<%= dasherizedModuleName %>'` -`import { module, test } from 'qunit'` +import Ember from 'ember' +import <%= classifiedModuleName %>Mixin from '../../../mixins/<%= dasherizedModuleName %>' +import { module, test } from 'qunit' module '<%= friendlyTestName %>' diff --git a/blueprints/mixin/files/__root__/mixins/__name__.coffee b/blueprints/mixin/files/__root__/mixins/__name__.coffee index 662a503..016027b 100644 --- a/blueprints/mixin/files/__root__/mixins/__name__.coffee +++ b/blueprints/mixin/files/__root__/mixins/__name__.coffee @@ -1,5 +1,5 @@ -`import Ember from 'ember'` +import Ember from 'ember' <%= classifiedModuleName %>Mixin = Ember.Mixin.create() -`export default <%= classifiedModuleName %>Mixin` +export default <%= classifiedModuleName %>Mixin diff --git a/blueprints/model-test/files/tests/unit/__path__/__test__.coffee b/blueprints/model-test/files/tests/unit/__path__/__test__.coffee index ba33f4d..36884a3 100644 --- a/blueprints/model-test/files/tests/unit/__path__/__test__.coffee +++ b/blueprints/model-test/files/tests/unit/__path__/__test__.coffee @@ -1,4 +1,4 @@ -`import { moduleForModel, test } from 'ember-qunit'` +import { moduleForModel, test } from 'ember-qunit' moduleForModel '<%= dasherizedModuleName %>', '<%= friendlyDescription %>', { # Specify the other units that are required for this test. diff --git a/blueprints/model/files/__root__/__path__/__name__.coffee b/blueprints/model/files/__root__/__path__/__name__.coffee index 16b213e..9ffcef1 100644 --- a/blueprints/model/files/__root__/__path__/__name__.coffee +++ b/blueprints/model/files/__root__/__path__/__name__.coffee @@ -1,7 +1,7 @@ -`import DS from 'ember-data'` +import DS from 'ember-data' <%= classifiedModuleName %> = DS.Model.extend { <%= attrs %> } -`export default <%= classifiedModuleName %>` +export default <%= classifiedModuleName %> diff --git a/blueprints/route-addon/files/__root__/__path__/__name__.coffee b/blueprints/route-addon/files/__root__/__path__/__name__.coffee index 6df5eef..c1d6480 100644 --- a/blueprints/route-addon/files/__root__/__path__/__name__.coffee +++ b/blueprints/route-addon/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -`export { default } from '<%= routeModulePath %>'` +export { default } from '<%= routeModulePath %>' diff --git a/blueprints/route-addon/files/__root__/__templatepath__/__templatename__.coffee b/blueprints/route-addon/files/__root__/__templatepath__/__templatename__.coffee index ad09add..2eaee36 100644 --- a/blueprints/route-addon/files/__root__/__templatepath__/__templatename__.coffee +++ b/blueprints/route-addon/files/__root__/__templatepath__/__templatename__.coffee @@ -1 +1 @@ -`export { default } from '<%= templateModulePath %>'` +export { default } from '<%= templateModulePath %>' diff --git a/blueprints/route-test/qunit-files/tests/unit/__path__/__test__.coffee b/blueprints/route-test/qunit-files/tests/unit/__path__/__test__.coffee index 26f7da2..aede7e1 100644 --- a/blueprints/route-test/qunit-files/tests/unit/__path__/__test__.coffee +++ b/blueprints/route-test/qunit-files/tests/unit/__path__/__test__.coffee @@ -1,4 +1,4 @@ -`import { moduleFor, test } from 'ember-qunit'` +import { moduleFor, test } from 'ember-qunit' moduleFor 'route:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', { # Specify the other units that are required for this test. diff --git a/blueprints/route/files/__root__/__path__/__name__.coffee b/blueprints/route/files/__root__/__path__/__name__.coffee index 50edd0a..3e5ec5b 100644 --- a/blueprints/route/files/__root__/__path__/__name__.coffee +++ b/blueprints/route/files/__root__/__path__/__name__.coffee @@ -1,5 +1,5 @@ -`import Ember from 'ember'` +import Ember from 'ember' <%= classifiedModuleName %>Route = Ember.Route.extend() -`export default <%= classifiedModuleName %>Route` +export default <%= classifiedModuleName %>Route diff --git a/blueprints/serializer-test/qunit-files/tests/unit/__path__/__test__.coffee b/blueprints/serializer-test/qunit-files/tests/unit/__path__/__test__.coffee index d1503e9..421c6b4 100644 --- a/blueprints/serializer-test/qunit-files/tests/unit/__path__/__test__.coffee +++ b/blueprints/serializer-test/qunit-files/tests/unit/__path__/__test__.coffee @@ -1,4 +1,4 @@ -`import { moduleForModel, test } from 'ember-qunit'` +import { moduleForModel, test } from 'ember-qunit' moduleForModel '<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', # Specify the other units that are required for this test. diff --git a/blueprints/serializer/files/__root__/__path__/__name__.coffee b/blueprints/serializer/files/__root__/__path__/__name__.coffee index 0e6f405..1443828 100644 --- a/blueprints/serializer/files/__root__/__path__/__name__.coffee +++ b/blueprints/serializer/files/__root__/__path__/__name__.coffee @@ -1,5 +1,5 @@ -`import DS from 'ember-data'` +import DS from 'ember-data' <%= classifiedModuleName %>Serializer = DS.RESTSerializer.extend() -`export default <%= classifiedModuleName %>Serializer` +export default <%= classifiedModuleName %>Serializer diff --git a/blueprints/service-test/qunit-files/tests/unit/services/__name__-test.coffee b/blueprints/service-test/qunit-files/tests/unit/services/__name__-test.coffee index 6d8ff69..1bc0c40 100644 --- a/blueprints/service-test/qunit-files/tests/unit/services/__name__-test.coffee +++ b/blueprints/service-test/qunit-files/tests/unit/services/__name__-test.coffee @@ -1,4 +1,4 @@ -`import { moduleFor, test } from 'ember-qunit'` +import { moduleFor, test } from 'ember-qunit' moduleFor 'service:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', { # Specify the other units that are required for this test. diff --git a/blueprints/service/files/__root__/__path__/__name__.coffee b/blueprints/service/files/__root__/__path__/__name__.coffee index 7ad84fa..649c7ff 100644 --- a/blueprints/service/files/__root__/__path__/__name__.coffee +++ b/blueprints/service/files/__root__/__path__/__name__.coffee @@ -1,5 +1,5 @@ -`import Ember from 'ember'` +import Ember from 'ember' <%= classifiedModuleName %>Service = Ember.Service.extend() -`export default <%= classifiedModuleName %>Service` +export default <%= classifiedModuleName %>Service diff --git a/blueprints/test-helper/files/tests/helpers/__name__.coffee b/blueprints/test-helper/files/tests/helpers/__name__.coffee index 304f8fd..b66be90 100644 --- a/blueprints/test-helper/files/tests/helpers/__name__.coffee +++ b/blueprints/test-helper/files/tests/helpers/__name__.coffee @@ -1,5 +1,5 @@ -`import Ember from 'ember'` +import Ember from 'ember' <%= camelizedModuleName %> = (app) -> -`export default Ember.Test.registerAsyncHelper('<%= camelizedModuleName %>', <%= camelizedModuleName %>)` +export default Ember.Test.registerAsyncHelper('<%= camelizedModuleName %>', <%= camelizedModuleName %>) diff --git a/blueprints/transform-test/qunit-files/tests/unit/__path__/__test__.coffee b/blueprints/transform-test/qunit-files/tests/unit/__path__/__test__.coffee index e9e56e1..6006b13 100644 --- a/blueprints/transform-test/qunit-files/tests/unit/__path__/__test__.coffee +++ b/blueprints/transform-test/qunit-files/tests/unit/__path__/__test__.coffee @@ -1,4 +1,4 @@ -`import { moduleFor, test } from 'ember-qunit'` +import { moduleFor, test } from 'ember-qunit' moduleFor 'transform:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', { # Specify the other units that are required for this test. diff --git a/blueprints/transform/files/__root__/__path__/__name__.coffee b/blueprints/transform/files/__root__/__path__/__name__.coffee index dd3cc19..cbafb96 100644 --- a/blueprints/transform/files/__root__/__path__/__name__.coffee +++ b/blueprints/transform/files/__root__/__path__/__name__.coffee @@ -1,4 +1,4 @@ -`import DS from 'ember-data'` +import DS from 'ember-data' <%= classifiedModuleName %>Transform = DS.Transform.extend deserialize: (serialized) -> @@ -7,4 +7,4 @@ serialize: (deserialized) -> deserialized -`export default <%= classifiedModuleName %>Transform` +export default <%= classifiedModuleName %>Transform diff --git a/blueprints/util-test/qunit-files/tests/unit/utils/__name__-test.coffee b/blueprints/util-test/qunit-files/tests/unit/utils/__name__-test.coffee index d1545c5..4a84902 100644 --- a/blueprints/util-test/qunit-files/tests/unit/utils/__name__-test.coffee +++ b/blueprints/util-test/qunit-files/tests/unit/utils/__name__-test.coffee @@ -1,5 +1,5 @@ -`import <%= camelizedModuleName %> from '../../../utils/<%= dasherizedModuleName %>'` -`import { module, test } from 'qunit'` +import <%= camelizedModuleName %> from '../../../utils/<%= dasherizedModuleName %>' +import { module, test } from 'qunit' module '<%= friendlyTestName %>' diff --git a/blueprints/util/files/__root__/utils/__name__.coffee b/blueprints/util/files/__root__/utils/__name__.coffee index f4bc4d1..43bc1a0 100644 --- a/blueprints/util/files/__root__/utils/__name__.coffee +++ b/blueprints/util/files/__root__/utils/__name__.coffee @@ -1,4 +1,4 @@ <%= camelizedModuleName %> = () -> true -`export default <%= camelizedModuleName %>` +export default <%= camelizedModuleName %> diff --git a/blueprints/view-test/qunit-files/tests/unit/__path__/__test__.coffee b/blueprints/view-test/qunit-files/tests/unit/__path__/__test__.coffee index 0ec6667..6c7bb09 100644 --- a/blueprints/view-test/qunit-files/tests/unit/__path__/__test__.coffee +++ b/blueprints/view-test/qunit-files/tests/unit/__path__/__test__.coffee @@ -1,4 +1,4 @@ -`import { moduleFor, test } from 'ember-qunit'` +import { moduleFor, test } from 'ember-qunit' moduleFor 'view:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>' diff --git a/blueprints/view/files/__root__/__path__/__name__.coffee b/blueprints/view/files/__root__/__path__/__name__.coffee index baffc1a..4e341be 100644 --- a/blueprints/view/files/__root__/__path__/__name__.coffee +++ b/blueprints/view/files/__root__/__path__/__name__.coffee @@ -1,5 +1,5 @@ -`import Ember from 'ember'` +import Ember from 'ember' <%= classifiedModuleName %>View = Ember.View.extend() -`export default <%= classifiedModuleName %>View` +export default <%= classifiedModuleName %>View diff --git a/tests/dummy/app/app.coffee b/tests/dummy/app/app.coffee index 8adab3f..d5787b7 100644 --- a/tests/dummy/app/app.coffee +++ b/tests/dummy/app/app.coffee @@ -1,7 +1,7 @@ -`import Ember from 'ember'` -`import Resolver from './resolver'` -`import loadInitializers from 'ember-load-initializers'` -`import config from './config/environment'` +import Ember from 'ember' +import Resolver from './resolver' +import loadInitializers from 'ember-load-initializers' +import config from './config/environment' App = null @@ -14,4 +14,4 @@ App = Ember.Application.extend loadInitializers App, config.modulePrefix -`export default App` +export default App diff --git a/tests/dummy/app/router.coffee b/tests/dummy/app/router.coffee index bb6db84..cfaefca 100644 --- a/tests/dummy/app/router.coffee +++ b/tests/dummy/app/router.coffee @@ -1,9 +1,9 @@ -`import Ember from 'ember'` -`import config from './config/environment'` +import Ember from 'ember' +import config from './config/environment' Router = Ember.Router.extend location: config.locationType Router.map -> -`export default Router` +export default Router diff --git a/tests/dummy/app/routes/index.coffee b/tests/dummy/app/routes/index.coffee index d55fe22..af4965b 100644 --- a/tests/dummy/app/routes/index.coffee +++ b/tests/dummy/app/routes/index.coffee @@ -1,7 +1,7 @@ -`import Ember from 'ember'` +import Ember from 'ember' IndexController = Ember.Route.extend model: -> 'Howdy' -`export default IndexController` +export default IndexController From 9bba9d4cf2be7e3f435bf4f050db648fdf3124a1 Mon Sep 17 00:00:00 2001 From: Jacob Jewell Date: Sat, 26 Nov 2016 13:50:57 -0500 Subject: [PATCH 03/11] remove semicolons from component blueprints --- blueprints/component/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/blueprints/component/index.js b/blueprints/component/index.js index 6ebf491..74f0911 100644 --- a/blueprints/component/index.js +++ b/blueprints/component/index.js @@ -40,6 +40,7 @@ module.exports = { } locals.contents = newContents; + locals.importTemplate = locals.importTemplate.replace(/;/, ''); return locals; } From 452f83dc7d442f4823177e1bf977cc93c4c5a426 Mon Sep 17 00:00:00 2001 From: Jacob Jewell Date: Sat, 26 Nov 2016 14:10:03 -0500 Subject: [PATCH 04/11] restore backticks when default is used as an alias --- blueprints/addon-import/files/__root__/__path__/__name__.coffee | 2 +- .../component-addon/files/__root__/__path__/__name__.coffee | 2 +- blueprints/helper-addon/files/__root__/__path__/__name__.coffee | 2 +- .../initializer-addon/files/__root__/__path__/__name__.coffee | 2 +- blueprints/route-addon/files/__root__/__path__/__name__.coffee | 2 +- .../files/__root__/__templatepath__/__templatename__.coffee | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/blueprints/addon-import/files/__root__/__path__/__name__.coffee b/blueprints/addon-import/files/__root__/__path__/__name__.coffee index f9b6ee1..a8d18e0 100644 --- a/blueprints/addon-import/files/__root__/__path__/__name__.coffee +++ b/blueprints/addon-import/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -export { default } from '<%= modulePath %>' +`export { default } from '<%= modulePath %>'` diff --git a/blueprints/component-addon/files/__root__/__path__/__name__.coffee b/blueprints/component-addon/files/__root__/__path__/__name__.coffee index f9b6ee1..a8d18e0 100644 --- a/blueprints/component-addon/files/__root__/__path__/__name__.coffee +++ b/blueprints/component-addon/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -export { default } from '<%= modulePath %>' +`export { default } from '<%= modulePath %>'` diff --git a/blueprints/helper-addon/files/__root__/__path__/__name__.coffee b/blueprints/helper-addon/files/__root__/__path__/__name__.coffee index 100e0d5..a87da13 100644 --- a/blueprints/helper-addon/files/__root__/__path__/__name__.coffee +++ b/blueprints/helper-addon/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -export { default, <%= camelizedModuleName %> } from '<%= modulePath %>' +`export { default, <%= camelizedModuleName %> } from '<%= modulePath %>'` diff --git a/blueprints/initializer-addon/files/__root__/__path__/__name__.coffee b/blueprints/initializer-addon/files/__root__/__path__/__name__.coffee index c7b0415..a7b812f 100644 --- a/blueprints/initializer-addon/files/__root__/__path__/__name__.coffee +++ b/blueprints/initializer-addon/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -export { default, initialize } from '<%= modulePath %>' +`export { default, initialize } from '<%= modulePath %>'` diff --git a/blueprints/route-addon/files/__root__/__path__/__name__.coffee b/blueprints/route-addon/files/__root__/__path__/__name__.coffee index c1d6480..6df5eef 100644 --- a/blueprints/route-addon/files/__root__/__path__/__name__.coffee +++ b/blueprints/route-addon/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -export { default } from '<%= routeModulePath %>' +`export { default } from '<%= routeModulePath %>'` diff --git a/blueprints/route-addon/files/__root__/__templatepath__/__templatename__.coffee b/blueprints/route-addon/files/__root__/__templatepath__/__templatename__.coffee index 2eaee36..ad09add 100644 --- a/blueprints/route-addon/files/__root__/__templatepath__/__templatename__.coffee +++ b/blueprints/route-addon/files/__root__/__templatepath__/__templatename__.coffee @@ -1 +1 @@ -export { default } from '<%= templateModulePath %>' +`export { default } from '<%= templateModulePath %>'` From 7ae54de7a2ec33149df50e697cd0979f2d85c26a Mon Sep 17 00:00:00 2001 From: Jacob Jewell Date: Mon, 9 Jan 2017 12:00:52 -0500 Subject: [PATCH 05/11] bump broccoli-coffee --- blueprints/addon-import/files/__root__/__path__/__name__.coffee | 2 +- .../component-addon/files/__root__/__path__/__name__.coffee | 2 +- blueprints/helper-addon/files/__root__/__path__/__name__.coffee | 2 +- .../initializer-addon/files/__root__/__path__/__name__.coffee | 2 +- blueprints/route-addon/files/__root__/__path__/__name__.coffee | 2 +- .../files/__root__/__templatepath__/__templatename__.coffee | 2 +- package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/blueprints/addon-import/files/__root__/__path__/__name__.coffee b/blueprints/addon-import/files/__root__/__path__/__name__.coffee index a8d18e0..f9b6ee1 100644 --- a/blueprints/addon-import/files/__root__/__path__/__name__.coffee +++ b/blueprints/addon-import/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -`export { default } from '<%= modulePath %>'` +export { default } from '<%= modulePath %>' diff --git a/blueprints/component-addon/files/__root__/__path__/__name__.coffee b/blueprints/component-addon/files/__root__/__path__/__name__.coffee index a8d18e0..f9b6ee1 100644 --- a/blueprints/component-addon/files/__root__/__path__/__name__.coffee +++ b/blueprints/component-addon/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -`export { default } from '<%= modulePath %>'` +export { default } from '<%= modulePath %>' diff --git a/blueprints/helper-addon/files/__root__/__path__/__name__.coffee b/blueprints/helper-addon/files/__root__/__path__/__name__.coffee index a87da13..100e0d5 100644 --- a/blueprints/helper-addon/files/__root__/__path__/__name__.coffee +++ b/blueprints/helper-addon/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -`export { default, <%= camelizedModuleName %> } from '<%= modulePath %>'` +export { default, <%= camelizedModuleName %> } from '<%= modulePath %>' diff --git a/blueprints/initializer-addon/files/__root__/__path__/__name__.coffee b/blueprints/initializer-addon/files/__root__/__path__/__name__.coffee index a7b812f..c7b0415 100644 --- a/blueprints/initializer-addon/files/__root__/__path__/__name__.coffee +++ b/blueprints/initializer-addon/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -`export { default, initialize } from '<%= modulePath %>'` +export { default, initialize } from '<%= modulePath %>' diff --git a/blueprints/route-addon/files/__root__/__path__/__name__.coffee b/blueprints/route-addon/files/__root__/__path__/__name__.coffee index 6df5eef..c1d6480 100644 --- a/blueprints/route-addon/files/__root__/__path__/__name__.coffee +++ b/blueprints/route-addon/files/__root__/__path__/__name__.coffee @@ -1 +1 @@ -`export { default } from '<%= routeModulePath %>'` +export { default } from '<%= routeModulePath %>' diff --git a/blueprints/route-addon/files/__root__/__templatepath__/__templatename__.coffee b/blueprints/route-addon/files/__root__/__templatepath__/__templatename__.coffee index ad09add..2eaee36 100644 --- a/blueprints/route-addon/files/__root__/__templatepath__/__templatename__.coffee +++ b/blueprints/route-addon/files/__root__/__templatepath__/__templatename__.coffee @@ -1 +1 @@ -`export { default } from '<%= templateModulePath %>'` +export { default } from '<%= templateModulePath %>' diff --git a/package.json b/package.json index c7c709f..ec86c5f 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "blueprints" ], "dependencies": { - "broccoli-coffee": "~0.7.0", + "broccoli-coffee": "~0.8.0", "broccoli-persistent-filter": "^1.1.0", "chalk": "^1.0.0", "coffeelint": "^1.6.1", From 0a320f859714bf98f3da0ce215d426e6f583fa2b Mon Sep 17 00:00:00 2001 From: Jacob Jewell Date: Wed, 1 Feb 2017 20:02:24 -0500 Subject: [PATCH 06/11] remove backticks from blueprint tests --- node-tests/blueprints/acceptance-test-test.js | 6 +++--- node-tests/blueprints/adapter-test.js | 6 +++--- node-tests/blueprints/addon-import-test.js | 2 +- node-tests/blueprints/component-addon-test.js | 2 +- node-tests/blueprints/component-test.js | 8 ++++---- node-tests/blueprints/controller-test.js | 6 +++--- node-tests/blueprints/helper-addon-test.js | 2 +- node-tests/blueprints/helper-test.js | 8 ++++---- node-tests/blueprints/initializer-addon-test.js | 2 +- node-tests/blueprints/initializer-test.js | 10 +++++----- node-tests/blueprints/mixin-test.js | 16 ++++++++-------- node-tests/blueprints/model-test.js | 6 +++--- node-tests/blueprints/resource-test.js | 10 +++++----- node-tests/blueprints/route-addon-test.js | 4 ++-- node-tests/blueprints/route-test.js | 8 ++++---- node-tests/blueprints/serializer-test.js | 8 ++++---- node-tests/blueprints/service-test.js | 8 ++++---- node-tests/blueprints/test-helper-test.js | 4 ++-- node-tests/blueprints/transform-test.js | 8 ++++---- node-tests/blueprints/util-test.js | 10 +++++----- node-tests/blueprints/view-test.js | 8 ++++---- 21 files changed, 71 insertions(+), 71 deletions(-) diff --git a/node-tests/blueprints/acceptance-test-test.js b/node-tests/blueprints/acceptance-test-test.js index 285c34b..3e04e12 100644 --- a/node-tests/blueprints/acceptance-test-test.js +++ b/node-tests/blueprints/acceptance-test-test.js @@ -16,9 +16,9 @@ describe('Acceptance: ember generate and destroy acceptance-test', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('tests/acceptance/foo-test.coffee')) - .to.contain("`import Ember from 'ember'`") - .to.contain("`import { module, test } from 'qunit'`") - .to.contain("`import startApp from 'my-app/tests/helpers/start-app'`") + .to.contain("import Ember from 'ember") + .to.contain("import { module, test } from 'qunit'") + .to.contain("import startApp from 'my-app/tests/helpers/start-app'") .to.contain("module 'Acceptance: Foo',") .to.contain("test 'visiting /foo', (assert) ->") .to.contain("visit '/foo'") diff --git a/node-tests/blueprints/adapter-test.js b/node-tests/blueprints/adapter-test.js index 98d6263..e19b004 100644 --- a/node-tests/blueprints/adapter-test.js +++ b/node-tests/blueprints/adapter-test.js @@ -16,9 +16,9 @@ describe('Acceptance: ember generate and destroy adapter', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/adapters/foo.coffee')) - .to.contain("`import ApplicationAdapter from './application'`") + .to.contain("import ApplicationAdapter from './application'") .to.contain("FooAdapter = ApplicationAdapter.extend()") - .to.contain("`export default FooAdapter`"); + .to.contain("export default FooAdapter"); expect(file('tests/unit/adapters/foo-test.coffee')) .to.contain("moduleFor 'adapter:foo'") @@ -31,7 +31,7 @@ describe('Acceptance: ember generate and destroy adapter', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('tests/unit/adapters/foo-test.coffee')) - .to.contain("`import { moduleFor, test } from 'ember-qunit'`") + .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'adapter:foo'") })); }); diff --git a/node-tests/blueprints/addon-import-test.js b/node-tests/blueprints/addon-import-test.js index fc0a611..6316e9a 100644 --- a/node-tests/blueprints/addon-import-test.js +++ b/node-tests/blueprints/addon-import-test.js @@ -16,7 +16,7 @@ describe('Acceptance: ember generate and destroy addon-import', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/addon-imports/foo.coffee')) - .to.contain(`export { default } from 'my-app/addon-imports/foo'`); + .to.contain("export { default } from 'my-app/addon-imports/foo'"); })); }); }); diff --git a/node-tests/blueprints/component-addon-test.js b/node-tests/blueprints/component-addon-test.js index 65f5a78..66b9116 100644 --- a/node-tests/blueprints/component-addon-test.js +++ b/node-tests/blueprints/component-addon-test.js @@ -16,7 +16,7 @@ describe('Acceptance: ember generate and destroy component-addon', function() { return emberNew({target: 'addon'}) .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/components/foo-bar.coffee')) - .to.contain("`export { default } from 'my-addon/components/foo-bar'`"); + .to.contain("export { default } from 'my-addon/components/foo-bar'"); })); }); }); diff --git a/node-tests/blueprints/component-test.js b/node-tests/blueprints/component-test.js index a30110e..53aa1df 100644 --- a/node-tests/blueprints/component-test.js +++ b/node-tests/blueprints/component-test.js @@ -16,17 +16,17 @@ describe('Acceptance: ember generate and destroy component', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/components/x-foo.coffee')) - .to.contain("`import Ember from 'ember'`") + .to.contain("import Ember from 'ember'") .to.contain('XFooComponent = Ember.Component.extend()') - .to.contain('`export default XFooComponent`') + .to.contain('export default XFooComponent') .to.not.contain('layout'); expect(file('app/templates/components/x-foo.hbs')) .to.contain('{{yield}}'); expect(file('tests/integration/components/x-foo-test.coffee')) - .to.contain("`import { test, moduleForComponent } from 'ember-qunit'`") - .to.contain("`import hbs from 'htmlbars-inline-precompile'`") + .to.contain("import { test, moduleForComponent } from 'ember-qunit'") + .to.contain("import hbs from 'htmlbars-inline-precompile'") .to.contain("moduleForComponent 'x-foo', 'Integration | Component | x foo'") .to.contain('integration: true') .to.contain('{{x-foo}}') diff --git a/node-tests/blueprints/controller-test.js b/node-tests/blueprints/controller-test.js index fdbf43b..6497aff 100644 --- a/node-tests/blueprints/controller-test.js +++ b/node-tests/blueprints/controller-test.js @@ -16,12 +16,12 @@ describe('Acceptance: ember generate and destroy controller', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/controllers/foo.coffee')) - .to.contain("`import Ember from 'ember'`") + .to.contain("import Ember from 'ember'") .to.contain('FooController = Ember.Controller.extend()') - .to.contain("`export default FooController`"); + .to.contain("export default FooController"); expect(file('tests/unit/controllers/foo-test.coffee')) - .to.contain("`import { moduleFor, test } from 'ember-qunit'`") + .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'controller:foo'"); })); }); diff --git a/node-tests/blueprints/helper-addon-test.js b/node-tests/blueprints/helper-addon-test.js index a403fa7..24d5338 100644 --- a/node-tests/blueprints/helper-addon-test.js +++ b/node-tests/blueprints/helper-addon-test.js @@ -16,7 +16,7 @@ describe('Acceptance: ember generate and destroy helper-addon', function() { return emberNew({target: 'addon'}) .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/helpers/foo-bar.coffee')) - .to.contain("`export { default, fooBar } from 'my-addon/helpers/foo-bar'`"); + .to.contain("export { default, fooBar } from 'my-addon/helpers/foo-bar'"); })); }); }); diff --git a/node-tests/blueprints/helper-test.js b/node-tests/blueprints/helper-test.js index e9145bc..861a80b 100644 --- a/node-tests/blueprints/helper-test.js +++ b/node-tests/blueprints/helper-test.js @@ -16,14 +16,14 @@ describe('Acceptance: ember generate and destroy helper', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/helpers/foo-bar.coffee')) - .to.contain("`import Ember from 'ember'`") + .to.contain("import Ember from 'ember'") .to.contain('fooBar = (params) ->') .to.contain('FooBarHelper = Ember.Helper.helper fooBar') - .to.contain("`export { fooBar }`") - .to.contain("`export default FooBarHelper`"); + .to.contain("export { fooBar }") + .to.contain("export default FooBarHelper"); expect(file('tests/unit/helpers/foo-bar-test.coffee')) - .to.contain("`import { fooBar } from 'my-app/helpers/foo-bar'`") + .to.contain("import { fooBar } from 'my-app/helpers/foo-bar'") .to.contain("module 'Unit | Helper | foo bar'") .to.contain("result = fooBar 42"); })); diff --git a/node-tests/blueprints/initializer-addon-test.js b/node-tests/blueprints/initializer-addon-test.js index 79036ff..937284f 100644 --- a/node-tests/blueprints/initializer-addon-test.js +++ b/node-tests/blueprints/initializer-addon-test.js @@ -16,7 +16,7 @@ describe('Acceptance: ember generate and destroy initializer-addon', function() return emberNew({ target: 'addon' }) .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/initializers/foo-bar.coffee')) - .to.contain("`export { default, initialize } from 'my-addon/initializers/foo-bar'`"); + .to.contain("export { default, initialize } from 'my-addon/initializers/foo-bar'"); })); }); }); diff --git a/node-tests/blueprints/initializer-test.js b/node-tests/blueprints/initializer-test.js index 0f985a1..15ec708 100644 --- a/node-tests/blueprints/initializer-test.js +++ b/node-tests/blueprints/initializer-test.js @@ -19,13 +19,13 @@ describe('Acceptance: ember generate and destroy initializer', function() { .to.contain('initialize = () ->') .to.contain('FooBarInitializer =') .to.contain("name: 'foo-bar'") - .to.contain("`export {initialize}`") - .to.contain("`export default FooBarInitializer`"); + .to.contain("export {initialize}") + .to.contain("export default FooBarInitializer"); expect(file('tests/unit/initializers/foo-bar-test.coffee')) - .to.contain("`import Ember from 'ember'`") - .to.contain("`import { initialize } from 'my-app/initializers/foo-bar'`") - .to.contain("`import { module, test } from 'qunit'`") + .to.contain("import Ember from 'ember'") + .to.contain("import { initialize } from 'my-app/initializers/foo-bar'") + .to.contain("import { module, test } from 'qunit'") .to.contain("module 'Unit | Initializer | foo bar'"); })); }); diff --git a/node-tests/blueprints/mixin-test.js b/node-tests/blueprints/mixin-test.js index b1d2af3..6148437 100644 --- a/node-tests/blueprints/mixin-test.js +++ b/node-tests/blueprints/mixin-test.js @@ -16,15 +16,15 @@ describe('Acceptance: ember generate and destroy mixin', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/mixins/foo-bar.coffee')) - .to.contain("`import Ember from 'ember'`") + .to.contain("import Ember from 'ember'") .to.contain('FooBarMixin = Ember.Mixin.create()') - .to.contain("`export default FooBarMixin`"); + .to.contain("export default FooBarMixin"); expect(file('tests/unit/mixins/foo-bar-test.coffee')) - .to.contain("`import Ember from 'ember'`") + .to.contain("import Ember from 'ember'") // TODO: Fix this import - it should be absolute - .to.contain("`import FooBarMixin from '../../../mixins/foo-bar'`") - .to.contain("`import { module, test } from 'qunit'`") + .to.contain("import FooBarMixin from '../../../mixins/foo-bar'") + .to.contain("import { module, test } from 'qunit'") .to.contain("module 'Unit | Mixin | foo bar'") .to.contain('FooBarObject = Ember.Object.extend FooBarMixin') .to.contain('subject = FooBarObject.create()'); @@ -37,9 +37,9 @@ describe('Acceptance: ember generate and destroy mixin', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('tests/unit/mixins/foo-bar-test.coffee')) - .to.contain("`import Ember from 'ember'`") - .to.contain("`import FooBarMixin from '../../../mixins/foo-bar'`") - .to.contain("`import { module, test } from 'qunit'`") + .to.contain("import Ember from 'ember'") + .to.contain("import FooBarMixin from '../../../mixins/foo-bar'") + .to.contain("import { module, test } from 'qunit'") .to.contain("module 'Unit | Mixin | foo bar'") .to.contain('FooBarObject = Ember.Object.extend FooBarMixin') .to.contain('subject = FooBarObject.create()'); diff --git a/node-tests/blueprints/model-test.js b/node-tests/blueprints/model-test.js index dc5f4d0..a432537 100644 --- a/node-tests/blueprints/model-test.js +++ b/node-tests/blueprints/model-test.js @@ -16,12 +16,12 @@ describe('Acceptance: ember generate and destroy model', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/models/foo.coffee')) - .to.contain("`import DS from 'ember-data'`") + .to.contain("import DS from 'ember-data'") .to.contain('Foo = DS.Model.extend {') - .to.contain("`export default Foo`"); + .to.contain("export default Foo"); expect(file('tests/unit/models/foo-test.coffee')) - .to.contain("`import { moduleForModel, test } from 'ember-qunit'`") + .to.contain("import { moduleForModel, test } from 'ember-qunit'") .to.contain("moduleForModel 'foo', 'Unit | Model | foo', {") .to.contain("needs: []"); })); diff --git a/node-tests/blueprints/resource-test.js b/node-tests/blueprints/resource-test.js index 5cb0e9e..59de39f 100644 --- a/node-tests/blueprints/resource-test.js +++ b/node-tests/blueprints/resource-test.js @@ -18,21 +18,21 @@ describe('Acceptance: ember generate and destroy resource', function() { return emberNew() .then(() => emberGenerateDestroy(args, (_file) => { expect(_file('app/routes/foo.coffee')) - .to.contain("`import Ember from 'ember'`") + .to.contain("import Ember from 'ember'") .to.contain('FooRoute = Ember.Route.extend()') - .to.contain("`export default FooRoute`"); + .to.contain("export default FooRoute"); expect(_file('app/templates/foo.hbs')) .to.contain('{{outlet}}'); expect(_file('tests/unit/routes/foo-test.coffee')) - .to.contain("`import { moduleFor, test } from 'ember-qunit'`") + .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'route:foo'"); expect(_file('app/models/foo.coffee')) - .to.contain("`import DS from 'ember-data'`") + .to.contain("import DS from 'ember-data'") .to.contain('Foo = DS.Model.extend {') - .to.contain("`export default Foo`"); + .to.contain("export default Foo"); expect(_file('tests/unit/models/foo-test.coffee')) .to.contain("moduleForModel 'foo'"); diff --git a/node-tests/blueprints/route-addon-test.js b/node-tests/blueprints/route-addon-test.js index cbad166..d66934b 100644 --- a/node-tests/blueprints/route-addon-test.js +++ b/node-tests/blueprints/route-addon-test.js @@ -16,10 +16,10 @@ describe('Acceptance: ember generate and destroy route-addon', function() { return emberNew({ target: 'addon' }) .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/routes/foo.coffee')) - .to.contain("`export { default } from 'my-addon/routes/foo'`"); + .to.contain("export { default } from 'my-addon/routes/foo'"); expect(file('app/templates/foo.coffee')) - .to.contain("`export { default } from 'my-addon/templates/foo'`"); + .to.contain("export { default } from 'my-addon/templates/foo'"); })); }); }); diff --git a/node-tests/blueprints/route-test.js b/node-tests/blueprints/route-test.js index b4fb4ec..cc4b7bb 100644 --- a/node-tests/blueprints/route-test.js +++ b/node-tests/blueprints/route-test.js @@ -18,15 +18,15 @@ describe('Acceptance: ember generate and destroy route', function() { return emberNew() .then(() => emberGenerateDestroy(args, (_file) => { expect(_file('app/routes/foo.coffee')) - .to.contain("`import Ember from 'ember'`") + .to.contain("import Ember from 'ember'") .to.contain('FooRoute = Ember.Route.extend()') - .to.contain("`export default FooRoute`"); + .to.contain("export default FooRoute"); expect(_file('app/templates/foo.hbs')) .to.contain('{{outlet}}'); expect(_file('tests/unit/routes/foo-test.coffee')) - .to.contain("`import { moduleFor, test } from 'ember-qunit'`") + .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'route:foo', 'Unit | Route | foo', {"); expect(file('app/router.coffee')) @@ -43,7 +43,7 @@ describe('Acceptance: ember generate and destroy route', function() { return emberNew() .then(() => emberGenerateDestroy(args, (_file) => { expect(_file('tests/unit/routes/foo-test.coffee')) - .to.contain("`import { moduleFor, test } from 'ember-qunit'`") + .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'route:foo', 'Unit | Route | foo', {"); })); }); diff --git a/node-tests/blueprints/serializer-test.js b/node-tests/blueprints/serializer-test.js index 20ef261..f383ced 100644 --- a/node-tests/blueprints/serializer-test.js +++ b/node-tests/blueprints/serializer-test.js @@ -16,12 +16,12 @@ describe('Acceptance: ember generate and destroy serializer', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/serializers/foo.coffee')) - .to.contain("`import DS from 'ember-data'`") + .to.contain("import DS from 'ember-data'") .to.contain('FooSerializer = DS.RESTSerializer.extend()') - .to.contain("`export default FooSerializer`"); + .to.contain("export default FooSerializer"); expect(file('tests/unit/serializers/foo-test.coffee')) - .to.contain("`import { moduleForModel, test } from 'ember-qunit'`") + .to.contain("import { moduleForModel, test } from 'ember-qunit'") .to.contain("moduleForModel 'foo', 'Unit | Serializer | foo',") .to.contain("needs: ['serializer:foo']"); })); @@ -33,7 +33,7 @@ describe('Acceptance: ember generate and destroy serializer', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('tests/unit/serializers/foo-test.coffee')) - .to.contain("`import { moduleForModel, test } from 'ember-qunit'`") + .to.contain("import { moduleForModel, test } from 'ember-qunit'") .to.contain("moduleForModel 'foo', 'Unit | Serializer | foo',") .to.contain("needs: ['serializer:foo']"); })); diff --git a/node-tests/blueprints/service-test.js b/node-tests/blueprints/service-test.js index 4fb4b8b..d67ce75 100644 --- a/node-tests/blueprints/service-test.js +++ b/node-tests/blueprints/service-test.js @@ -16,12 +16,12 @@ describe('Acceptance: ember generate and destroy service', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/services/foo.coffee')) - .to.contain("`import Ember from 'ember'`") + .to.contain("import Ember from 'ember'") .to.contain('FooService = Ember.Service.extend()') - .to.contain("`export default FooService`"); + .to.contain("export default FooService"); expect(file('tests/unit/services/foo-test.coffee')) - .to.contain("`import { moduleFor, test } from 'ember-qunit'`") + .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'service:foo', 'Unit | Service | foo', {"); })); }); @@ -32,7 +32,7 @@ describe('Acceptance: ember generate and destroy service', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('tests/unit/services/foo-test.coffee')) - .to.contain("`import { moduleFor, test } from 'ember-qunit'`") + .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'service:foo', 'Unit | Service | foo', {"); })); }); diff --git a/node-tests/blueprints/test-helper-test.js b/node-tests/blueprints/test-helper-test.js index 36e200d..1f9dc9d 100644 --- a/node-tests/blueprints/test-helper-test.js +++ b/node-tests/blueprints/test-helper-test.js @@ -16,9 +16,9 @@ describe('Acceptance: ember generate and destroy test-helper', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('tests/helpers/foo.coffee')) - .to.contain("`import Ember from 'ember'`") + .to.contain("import Ember from 'ember'") .to.contain('foo = (app) ->') - .to.contain("`export default Ember.Test.registerAsyncHelper('foo', foo)`"); + .to.contain("export default Ember.Test.registerAsyncHelper('foo', foo)"); })); }); }); diff --git a/node-tests/blueprints/transform-test.js b/node-tests/blueprints/transform-test.js index f5aa205..0bb7563 100644 --- a/node-tests/blueprints/transform-test.js +++ b/node-tests/blueprints/transform-test.js @@ -16,12 +16,12 @@ describe('Acceptance: ember generate and destroy transform', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/transforms/foo.coffee')) - .to.contain("`import DS from 'ember-data'`") + .to.contain("import DS from 'ember-data'") .to.contain('FooTransform = DS.Transform.extend') - .to.contain("`export default FooTransform`"); + .to.contain("export default FooTransform"); expect(file('tests/unit/transforms/foo-test.coffee')) - .to.contain("`import { moduleFor, test } from 'ember-qunit'`") + .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'transform:foo', 'Unit | Transform | foo', {"); })); }); @@ -32,7 +32,7 @@ describe('Acceptance: ember generate and destroy transform', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('tests/unit/transforms/foo-test.coffee')) - .to.contain("`import { moduleFor, test } from 'ember-qunit'`") + .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'transform:foo', 'Unit | Transform | foo', {"); })); }); diff --git a/node-tests/blueprints/util-test.js b/node-tests/blueprints/util-test.js index 1ddcd74..008a85c 100644 --- a/node-tests/blueprints/util-test.js +++ b/node-tests/blueprints/util-test.js @@ -17,12 +17,12 @@ describe('Acceptance: ember generate and destroy util', function() { .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/utils/foo-bar.coffee')) .to.contain('fooBar = () ->') - .to.contain("`export default fooBar`"); + .to.contain("export default fooBar"); expect(file('tests/unit/utils/foo-bar-test.coffee')) // TODO: This import should use absolute imports - .to.contain("`import fooBar from '../../../utils/foo-bar'`") - .to.contain("`import { module, test } from 'qunit'`") + .to.contain("import fooBar from '../../../utils/foo-bar'") + .to.contain("import { module, test } from 'qunit'") .to.contain("module 'Unit | Utility | foo bar'") .to.contain('result = fooBar()'); })); @@ -34,8 +34,8 @@ describe('Acceptance: ember generate and destroy util', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('tests/unit/utils/foo-bar-test.coffee')) - .to.contain("`import fooBar from '../../../utils/foo-bar'`") - .to.contain("`import { module, test } from 'qunit'`") + .to.contain("import fooBar from '../../../utils/foo-bar'") + .to.contain("import { module, test } from 'qunit'") .to.contain("module 'Unit | Utility | foo bar'") .to.contain('result = fooBar()'); })); diff --git a/node-tests/blueprints/view-test.js b/node-tests/blueprints/view-test.js index 85d56a1..cbd34f8 100644 --- a/node-tests/blueprints/view-test.js +++ b/node-tests/blueprints/view-test.js @@ -16,12 +16,12 @@ describe('Acceptance: ember generate and destroy view', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('app/views/foo.coffee')) - .to.contain("`import Ember from 'ember'`") + .to.contain("import Ember from 'ember'") .to.contain('FooView = Ember.View.extend()') - .to.contain("`export default FooView`"); + .to.contain("export default FooView"); expect(file('tests/unit/views/foo-test.coffee')) - .to.contain("`import { moduleFor, test } from 'ember-qunit'`") + .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'view:foo', 'Unit | View | foo'"); })); }); @@ -32,7 +32,7 @@ describe('Acceptance: ember generate and destroy view', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('tests/unit/views/foo-test.coffee')) - .to.contain("`import { moduleFor, test } from 'ember-qunit'`") + .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'view:foo', 'Unit | View | foo'"); })); }); From 6f4e394f1659193d243f7cde19027b0a14546b52 Mon Sep 17 00:00:00 2001 From: Jacob Jewell Date: Thu, 2 Feb 2017 09:16:15 -0500 Subject: [PATCH 07/11] fix typo --- node-tests/blueprints/acceptance-test-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-tests/blueprints/acceptance-test-test.js b/node-tests/blueprints/acceptance-test-test.js index 3e04e12..5262eaa 100644 --- a/node-tests/blueprints/acceptance-test-test.js +++ b/node-tests/blueprints/acceptance-test-test.js @@ -16,7 +16,7 @@ describe('Acceptance: ember generate and destroy acceptance-test', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { expect(file('tests/acceptance/foo-test.coffee')) - .to.contain("import Ember from 'ember") + .to.contain("import Ember from 'ember'") .to.contain("import { module, test } from 'qunit'") .to.contain("import startApp from 'my-app/tests/helpers/start-app'") .to.contain("module 'Acceptance: Foo',") From ccbd0f0c3ff6f5b9f9883f8d539e80cbf7b22fce Mon Sep 17 00:00:00 2001 From: Jacob Jewell Date: Sun, 5 Feb 2017 18:13:53 -0500 Subject: [PATCH 08/11] verify coffeescript in blueprint tests --- node-tests/blueprints/acceptance-test-test.js | 7 ++++++- node-tests/blueprints/adapter-test.js | 19 ++++++++++++++++--- node-tests/blueprints/addon-import-test.js | 7 ++++++- node-tests/blueprints/component-addon-test.js | 5 +++++ node-tests/blueprints/component-test.js | 13 +++++++++++-- node-tests/blueprints/controller-test.js | 13 +++++++++++-- node-tests/blueprints/helper-addon-test.js | 7 ++++++- node-tests/blueprints/helper-test.js | 13 +++++++++++-- .../blueprints/initializer-addon-test.js | 7 ++++++- node-tests/blueprints/initializer-test.js | 11 ++++++++++- node-tests/blueprints/mixin-test.js | 19 ++++++++++++++++--- node-tests/blueprints/model-test.js | 19 ++++++++++++++++--- node-tests/blueprints/route-addon-test.js | 13 +++++++++++-- node-tests/blueprints/route-test.js | 7 ++++++- node-tests/blueprints/serializer-test.js | 19 ++++++++++++++++--- node-tests/blueprints/service-test.js | 19 ++++++++++++++++--- node-tests/blueprints/test-helper-test.js | 7 ++++++- node-tests/blueprints/transform-test.js | 19 ++++++++++++++++--- node-tests/blueprints/util-test.js | 19 ++++++++++++++++--- node-tests/blueprints/view-test.js | 19 ++++++++++++++++--- node-tests/helpers/expect-coffee.js | 10 ++++++++++ 21 files changed, 233 insertions(+), 39 deletions(-) create mode 100644 node-tests/helpers/expect-coffee.js diff --git a/node-tests/blueprints/acceptance-test-test.js b/node-tests/blueprints/acceptance-test-test.js index 5262eaa..15f6ba9 100644 --- a/node-tests/blueprints/acceptance-test-test.js +++ b/node-tests/blueprints/acceptance-test-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy acceptance-test', function() { setupTestHooks(this); @@ -15,7 +16,9 @@ describe('Acceptance: ember generate and destroy acceptance-test', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('tests/acceptance/foo-test.coffee')) + var acceptanceFile = file('tests/acceptance/foo-test.coffee'); + + expect(acceptanceFile) .to.contain("import Ember from 'ember'") .to.contain("import { module, test } from 'qunit'") .to.contain("import startApp from 'my-app/tests/helpers/start-app'") @@ -24,6 +27,8 @@ describe('Acceptance: ember generate and destroy acceptance-test', function() { .to.contain("visit '/foo'") .to.contain("andThen ->") .to.contain("assert.equal currentURL(), '/foo'"); + + expectCoffee(acceptanceFile); })); }); }); diff --git a/node-tests/blueprints/adapter-test.js b/node-tests/blueprints/adapter-test.js index e19b004..db4f5b9 100644 --- a/node-tests/blueprints/adapter-test.js +++ b/node-tests/blueprints/adapter-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy adapter', function() { setupTestHooks(this); @@ -15,13 +16,21 @@ describe('Acceptance: ember generate and destroy adapter', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/adapters/foo.coffee')) + var adapterFile = file('app/adapters/foo.coffee'); + + expect(adapterFile) .to.contain("import ApplicationAdapter from './application'") .to.contain("FooAdapter = ApplicationAdapter.extend()") .to.contain("export default FooAdapter"); - expect(file('tests/unit/adapters/foo-test.coffee')) + expectCoffee(adapterFile); + + var adapterTestFile = file('tests/unit/adapters/foo-test.coffee'); + + expect(adapterTestFile) .to.contain("moduleFor 'adapter:foo'") + + expectCoffee(adapterTestFile); })); }); @@ -30,9 +39,13 @@ describe('Acceptance: ember generate and destroy adapter', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('tests/unit/adapters/foo-test.coffee')) + var adapterTestFile = file('tests/unit/adapters/foo-test.coffee'); + + expect(adapterTestFile) .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'adapter:foo'") + + expectCoffee(adapterTestFile); })); }); }); diff --git a/node-tests/blueprints/addon-import-test.js b/node-tests/blueprints/addon-import-test.js index 6316e9a..c06408b 100644 --- a/node-tests/blueprints/addon-import-test.js +++ b/node-tests/blueprints/addon-import-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy addon-import', function() { setupTestHooks(this); @@ -15,8 +16,12 @@ describe('Acceptance: ember generate and destroy addon-import', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/addon-imports/foo.coffee')) + var importFile = file('app/addon-imports/foo.coffee'); + + expect(importFile) .to.contain("export { default } from 'my-app/addon-imports/foo'"); + + expectCoffee(importFile); })); }); }); diff --git a/node-tests/blueprints/component-addon-test.js b/node-tests/blueprints/component-addon-test.js index 66b9116..aba755f 100644 --- a/node-tests/blueprints/component-addon-test.js +++ b/node-tests/blueprints/component-addon-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy component-addon', function() { setupTestHooks(this); @@ -15,8 +16,12 @@ describe('Acceptance: ember generate and destroy component-addon', function() { return emberNew({target: 'addon'}) .then(() => emberGenerateDestroy(args, (file) => { + var componentFile = file('app/components/foo-bar.coffee'); + expect(file('app/components/foo-bar.coffee')) .to.contain("export { default } from 'my-addon/components/foo-bar'"); + + expectCoffee(componentFile); })); }); }); diff --git a/node-tests/blueprints/component-test.js b/node-tests/blueprints/component-test.js index 53aa1df..1aab03f 100644 --- a/node-tests/blueprints/component-test.js +++ b/node-tests/blueprints/component-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy component', function() { setupTestHooks(this); @@ -15,22 +16,30 @@ describe('Acceptance: ember generate and destroy component', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/components/x-foo.coffee')) + var componentFile = file('app/components/x-foo.coffee'); + + expect(componentFile) .to.contain("import Ember from 'ember'") .to.contain('XFooComponent = Ember.Component.extend()') .to.contain('export default XFooComponent') .to.not.contain('layout'); + expectCoffee(componentFile); + expect(file('app/templates/components/x-foo.hbs')) .to.contain('{{yield}}'); - expect(file('tests/integration/components/x-foo-test.coffee')) + var componentTestFile = file('tests/integration/components/x-foo-test.coffee'); + + expect(componentTestFile) .to.contain("import { test, moduleForComponent } from 'ember-qunit'") .to.contain("import hbs from 'htmlbars-inline-precompile'") .to.contain("moduleForComponent 'x-foo', 'Integration | Component | x foo'") .to.contain('integration: true') .to.contain('{{x-foo}}') .to.contain('{{#x-foo}}'); + + expectCoffee(componentTestFile); })); }); }); diff --git a/node-tests/blueprints/controller-test.js b/node-tests/blueprints/controller-test.js index 6497aff..352cbff 100644 --- a/node-tests/blueprints/controller-test.js +++ b/node-tests/blueprints/controller-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy controller', function() { setupTestHooks(this); @@ -15,14 +16,22 @@ describe('Acceptance: ember generate and destroy controller', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/controllers/foo.coffee')) + var controllerFile = file('app/controllers/foo.coffee'); + + expect(controllerFile) .to.contain("import Ember from 'ember'") .to.contain('FooController = Ember.Controller.extend()') .to.contain("export default FooController"); - expect(file('tests/unit/controllers/foo-test.coffee')) + expectCoffee(controllerFile); + + var controllerTestFile = file('tests/unit/controllers/foo-test.coffee'); + + expect(controllerTestFile) .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'controller:foo'"); + + expectCoffee(controllerTestFile); })); }); }); diff --git a/node-tests/blueprints/helper-addon-test.js b/node-tests/blueprints/helper-addon-test.js index 24d5338..11e3a82 100644 --- a/node-tests/blueprints/helper-addon-test.js +++ b/node-tests/blueprints/helper-addon-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy helper-addon', function() { setupTestHooks(this); @@ -15,8 +16,12 @@ describe('Acceptance: ember generate and destroy helper-addon', function() { return emberNew({target: 'addon'}) .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/helpers/foo-bar.coffee')) + var helperFile = file('app/helpers/foo-bar.coffee'); + + expect(helperFile) .to.contain("export { default, fooBar } from 'my-addon/helpers/foo-bar'"); + + expectCoffee(helperFile); })); }); }); diff --git a/node-tests/blueprints/helper-test.js b/node-tests/blueprints/helper-test.js index 861a80b..72ae9b9 100644 --- a/node-tests/blueprints/helper-test.js +++ b/node-tests/blueprints/helper-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy helper', function() { setupTestHooks(this); @@ -15,17 +16,25 @@ describe('Acceptance: ember generate and destroy helper', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/helpers/foo-bar.coffee')) + var helperFile = file('app/helpers/foo-bar.coffee'); + + expect(helperFile) .to.contain("import Ember from 'ember'") .to.contain('fooBar = (params) ->') .to.contain('FooBarHelper = Ember.Helper.helper fooBar') .to.contain("export { fooBar }") .to.contain("export default FooBarHelper"); - expect(file('tests/unit/helpers/foo-bar-test.coffee')) + expectCoffee(helperFile); + + var helperTestFile = file('tests/unit/helpers/foo-bar-test.coffee'); + + expect(helperTestFile) .to.contain("import { fooBar } from 'my-app/helpers/foo-bar'") .to.contain("module 'Unit | Helper | foo bar'") .to.contain("result = fooBar 42"); + + expectCoffee(helperTestFile); })); }); }); diff --git a/node-tests/blueprints/initializer-addon-test.js b/node-tests/blueprints/initializer-addon-test.js index 937284f..84500c2 100644 --- a/node-tests/blueprints/initializer-addon-test.js +++ b/node-tests/blueprints/initializer-addon-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy initializer-addon', function() { setupTestHooks(this); @@ -15,8 +16,12 @@ describe('Acceptance: ember generate and destroy initializer-addon', function() return emberNew({ target: 'addon' }) .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/initializers/foo-bar.coffee')) + var initializerFile = file('app/initializers/foo-bar.coffee'); + + expect(initializerFile) .to.contain("export { default, initialize } from 'my-addon/initializers/foo-bar'"); + + expectCoffee(initializerFile); })); }); }); diff --git a/node-tests/blueprints/initializer-test.js b/node-tests/blueprints/initializer-test.js index 15ec708..3fe978d 100644 --- a/node-tests/blueprints/initializer-test.js +++ b/node-tests/blueprints/initializer-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy initializer', function() { setupTestHooks(this); @@ -15,6 +16,8 @@ describe('Acceptance: ember generate and destroy initializer', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { + var initializerFile = file('app/initializers/foo-bar.coffee'); + expect(file('app/initializers/foo-bar.coffee')) .to.contain('initialize = () ->') .to.contain('FooBarInitializer =') @@ -22,11 +25,17 @@ describe('Acceptance: ember generate and destroy initializer', function() { .to.contain("export {initialize}") .to.contain("export default FooBarInitializer"); - expect(file('tests/unit/initializers/foo-bar-test.coffee')) + expectCoffee(initializerFile); + + var initializerTestFile = file('tests/unit/initializers/foo-bar-test.coffee'); + + expect(initializerTestFile) .to.contain("import Ember from 'ember'") .to.contain("import { initialize } from 'my-app/initializers/foo-bar'") .to.contain("import { module, test } from 'qunit'") .to.contain("module 'Unit | Initializer | foo bar'"); + + expectCoffee(initializerTestFile); })); }); }); diff --git a/node-tests/blueprints/mixin-test.js b/node-tests/blueprints/mixin-test.js index 6148437..c8ea460 100644 --- a/node-tests/blueprints/mixin-test.js +++ b/node-tests/blueprints/mixin-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy mixin', function() { setupTestHooks(this); @@ -15,12 +16,18 @@ describe('Acceptance: ember generate and destroy mixin', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/mixins/foo-bar.coffee')) + var mixinFile = file('app/mixins/foo-bar.coffee'); + + expect(mixinFile) .to.contain("import Ember from 'ember'") .to.contain('FooBarMixin = Ember.Mixin.create()') .to.contain("export default FooBarMixin"); - expect(file('tests/unit/mixins/foo-bar-test.coffee')) + expectCoffee(mixinFile); + + var mixinTestFile = file('tests/unit/mixins/foo-bar-test.coffee'); + + expect(mixinTestFile) .to.contain("import Ember from 'ember'") // TODO: Fix this import - it should be absolute .to.contain("import FooBarMixin from '../../../mixins/foo-bar'") @@ -28,6 +35,8 @@ describe('Acceptance: ember generate and destroy mixin', function() { .to.contain("module 'Unit | Mixin | foo bar'") .to.contain('FooBarObject = Ember.Object.extend FooBarMixin') .to.contain('subject = FooBarObject.create()'); + + expectCoffee(mixinTestFile); })); }); @@ -36,13 +45,17 @@ describe('Acceptance: ember generate and destroy mixin', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('tests/unit/mixins/foo-bar-test.coffee')) + var mixinTestFile = file('tests/unit/mixins/foo-bar-test.coffee'); + + expect(mixinTestFile) .to.contain("import Ember from 'ember'") .to.contain("import FooBarMixin from '../../../mixins/foo-bar'") .to.contain("import { module, test } from 'qunit'") .to.contain("module 'Unit | Mixin | foo bar'") .to.contain('FooBarObject = Ember.Object.extend FooBarMixin') .to.contain('subject = FooBarObject.create()'); + + expectCoffee(mixinTestFile); })); }); }); diff --git a/node-tests/blueprints/model-test.js b/node-tests/blueprints/model-test.js index a432537..95febe6 100644 --- a/node-tests/blueprints/model-test.js +++ b/node-tests/blueprints/model-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy model', function() { setupTestHooks(this); @@ -15,15 +16,23 @@ describe('Acceptance: ember generate and destroy model', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/models/foo.coffee')) + var modelFile = file('app/models/foo.coffee'); + + expect(modelFile) .to.contain("import DS from 'ember-data'") .to.contain('Foo = DS.Model.extend {') .to.contain("export default Foo"); - expect(file('tests/unit/models/foo-test.coffee')) + expectCoffee(modelFile); + + var modelTestFile = file('tests/unit/models/foo-test.coffee'); + + expect(modelTestFile) .to.contain("import { moduleForModel, test } from 'ember-qunit'") .to.contain("moduleForModel 'foo', 'Unit | Model | foo', {") .to.contain("needs: []"); + + expectCoffee(modelTestFile); })); }); @@ -32,8 +41,12 @@ describe('Acceptance: ember generate and destroy model', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('tests/unit/models/foo-test.coffee')) + var modelTestFile = file('tests/unit/models/foo-test.coffee'); + + expect(modelTestFile) .to.contain("moduleForModel 'foo'"); + + expectCoffee(modelTestFile); })); }); }); diff --git a/node-tests/blueprints/route-addon-test.js b/node-tests/blueprints/route-addon-test.js index d66934b..cad3619 100644 --- a/node-tests/blueprints/route-addon-test.js +++ b/node-tests/blueprints/route-addon-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy route-addon', function() { setupTestHooks(this); @@ -15,11 +16,19 @@ describe('Acceptance: ember generate and destroy route-addon', function() { return emberNew({ target: 'addon' }) .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/routes/foo.coffee')) + var routeFile = file('app/routes/foo.coffee'); + + expect(routeFile) .to.contain("export { default } from 'my-addon/routes/foo'"); - expect(file('app/templates/foo.coffee')) + expectCoffee(routeFile); + + var templateFile = file('app/templates/foo.coffee'); + + expect(templateFile) .to.contain("export { default } from 'my-addon/templates/foo'"); + + expectCoffee(templateFile); })); }); }); diff --git a/node-tests/blueprints/route-test.js b/node-tests/blueprints/route-test.js index cc4b7bb..716edc7 100644 --- a/node-tests/blueprints/route-test.js +++ b/node-tests/blueprints/route-test.js @@ -8,6 +8,7 @@ var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var chai = require('ember-cli-blueprint-test-helpers/chai'); var expect = chai.expect; var file = chai.file; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy route', function() { setupTestHooks(this); @@ -42,9 +43,13 @@ describe('Acceptance: ember generate and destroy route', function() { return emberNew() .then(() => emberGenerateDestroy(args, (_file) => { - expect(_file('tests/unit/routes/foo-test.coffee')) + var testFile = _file('tests/unit/routes/foo-test.coffee'); + + expect(testFile) .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'route:foo', 'Unit | Route | foo', {"); + + expectCoffee(testFile); })); }); }); diff --git a/node-tests/blueprints/serializer-test.js b/node-tests/blueprints/serializer-test.js index f383ced..233a685 100644 --- a/node-tests/blueprints/serializer-test.js +++ b/node-tests/blueprints/serializer-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy serializer', function() { setupTestHooks(this); @@ -15,15 +16,23 @@ describe('Acceptance: ember generate and destroy serializer', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/serializers/foo.coffee')) + var serializerFile = file('app/serializers/foo.coffee'); + + expect(serializerFile) .to.contain("import DS from 'ember-data'") .to.contain('FooSerializer = DS.RESTSerializer.extend()') .to.contain("export default FooSerializer"); - expect(file('tests/unit/serializers/foo-test.coffee')) + expectCoffee(serializerFile); + + var serializerTestFile = file('tests/unit/serializers/foo-test.coffee'); + + expect(serializerTestFile) .to.contain("import { moduleForModel, test } from 'ember-qunit'") .to.contain("moduleForModel 'foo', 'Unit | Serializer | foo',") .to.contain("needs: ['serializer:foo']"); + + expectCoffee(serializerTestFile); })); }); @@ -32,10 +41,14 @@ describe('Acceptance: ember generate and destroy serializer', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('tests/unit/serializers/foo-test.coffee')) + var testFile = file('tests/unit/serializers/foo-test.coffee'); + + expect(testFile) .to.contain("import { moduleForModel, test } from 'ember-qunit'") .to.contain("moduleForModel 'foo', 'Unit | Serializer | foo',") .to.contain("needs: ['serializer:foo']"); + + expectCoffee(testFile); })); }); }); diff --git a/node-tests/blueprints/service-test.js b/node-tests/blueprints/service-test.js index d67ce75..e092bae 100644 --- a/node-tests/blueprints/service-test.js +++ b/node-tests/blueprints/service-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy service', function() { setupTestHooks(this); @@ -15,14 +16,22 @@ describe('Acceptance: ember generate and destroy service', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/services/foo.coffee')) + var serviceFile = file('app/services/foo.coffee'); + + expect(serviceFile) .to.contain("import Ember from 'ember'") .to.contain('FooService = Ember.Service.extend()') .to.contain("export default FooService"); - expect(file('tests/unit/services/foo-test.coffee')) + expectCoffee(serviceFile); + + var serviceTestFile = file('tests/unit/services/foo-test.coffee'); + + expect(serviceTestFile) .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'service:foo', 'Unit | Service | foo', {"); + + expectCoffee(serviceTestFile); })); }); @@ -31,9 +40,13 @@ describe('Acceptance: ember generate and destroy service', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('tests/unit/services/foo-test.coffee')) + var serviceTestFile = file('tests/unit/services/foo-test.coffee'); + + expect(serviceTestFile) .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'service:foo', 'Unit | Service | foo', {"); + + expectCoffee(serviceTestFile); })); }); }); diff --git a/node-tests/blueprints/test-helper-test.js b/node-tests/blueprints/test-helper-test.js index 1f9dc9d..54d201c 100644 --- a/node-tests/blueprints/test-helper-test.js +++ b/node-tests/blueprints/test-helper-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy test-helper', function() { setupTestHooks(this); @@ -15,10 +16,14 @@ describe('Acceptance: ember generate and destroy test-helper', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('tests/helpers/foo.coffee')) + var testHelperFile = file('tests/helpers/foo.coffee'); + + expect(testHelperFile) .to.contain("import Ember from 'ember'") .to.contain('foo = (app) ->') .to.contain("export default Ember.Test.registerAsyncHelper('foo', foo)"); + + expectCoffee(testHelperFile); })); }); }); diff --git a/node-tests/blueprints/transform-test.js b/node-tests/blueprints/transform-test.js index 0bb7563..ec70ec4 100644 --- a/node-tests/blueprints/transform-test.js +++ b/node-tests/blueprints/transform-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy transform', function() { setupTestHooks(this); @@ -15,14 +16,22 @@ describe('Acceptance: ember generate and destroy transform', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/transforms/foo.coffee')) + var transformFile = file('app/transforms/foo.coffee'); + + expect(transformFile) .to.contain("import DS from 'ember-data'") .to.contain('FooTransform = DS.Transform.extend') .to.contain("export default FooTransform"); - expect(file('tests/unit/transforms/foo-test.coffee')) + expectCoffee(transformFile); + + var transformTestFile = file('tests/unit/transforms/foo-test.coffee'); + + expect(transformTestFile) .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'transform:foo', 'Unit | Transform | foo', {"); + + expectCoffee(transformTestFile); })); }); @@ -31,9 +40,13 @@ describe('Acceptance: ember generate and destroy transform', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('tests/unit/transforms/foo-test.coffee')) + var testFile = file('tests/unit/transforms/foo-test.coffee'); + + expect(testFile) .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'transform:foo', 'Unit | Transform | foo', {"); + + expectCoffee(testFile); })); }); }); diff --git a/node-tests/blueprints/util-test.js b/node-tests/blueprints/util-test.js index 008a85c..5ec9dd5 100644 --- a/node-tests/blueprints/util-test.js +++ b/node-tests/blueprints/util-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy util', function() { setupTestHooks(this); @@ -15,16 +16,24 @@ describe('Acceptance: ember generate and destroy util', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/utils/foo-bar.coffee')) + var utilFile = file('app/utils/foo-bar.coffee'); + + expect(utilFile) .to.contain('fooBar = () ->') .to.contain("export default fooBar"); - expect(file('tests/unit/utils/foo-bar-test.coffee')) + expectCoffee(utilFile); + + var utilTestFile = file('tests/unit/utils/foo-bar-test.coffee'); + + expect(utilTestFile) // TODO: This import should use absolute imports .to.contain("import fooBar from '../../../utils/foo-bar'") .to.contain("import { module, test } from 'qunit'") .to.contain("module 'Unit | Utility | foo bar'") .to.contain('result = fooBar()'); + + expectCoffee(utilTestFile); })); }); @@ -33,11 +42,15 @@ describe('Acceptance: ember generate and destroy util', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('tests/unit/utils/foo-bar-test.coffee')) + var testFile = file('tests/unit/utils/foo-bar-test.coffee'); + + expect(testFile) .to.contain("import fooBar from '../../../utils/foo-bar'") .to.contain("import { module, test } from 'qunit'") .to.contain("module 'Unit | Utility | foo bar'") .to.contain('result = fooBar()'); + + expectCoffee(testFile); })); }); }); diff --git a/node-tests/blueprints/view-test.js b/node-tests/blueprints/view-test.js index cbd34f8..8e3bec4 100644 --- a/node-tests/blueprints/view-test.js +++ b/node-tests/blueprints/view-test.js @@ -6,6 +6,7 @@ var emberNew = blueprintHelpers.emberNew; var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('../helpers/expect-coffee'); describe('Acceptance: ember generate and destroy view', function() { setupTestHooks(this); @@ -15,14 +16,22 @@ describe('Acceptance: ember generate and destroy view', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('app/views/foo.coffee')) + var viewFile = file('app/views/foo.coffee'); + + expect(viewFile) .to.contain("import Ember from 'ember'") .to.contain('FooView = Ember.View.extend()') .to.contain("export default FooView"); - expect(file('tests/unit/views/foo-test.coffee')) + expectCoffee(viewFile); + + var viewTestFile = file('tests/unit/views/foo-test.coffee'); + + expect(viewTestFile) .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'view:foo', 'Unit | View | foo'"); + + expectCoffee(viewTestFile); })); }); @@ -31,9 +40,13 @@ describe('Acceptance: ember generate and destroy view', function() { return emberNew() .then(() => emberGenerateDestroy(args, (file) => { - expect(file('tests/unit/views/foo-test.coffee')) + var testFile = file('tests/unit/views/foo-test.coffee'); + + expect(testFile) .to.contain("import { moduleFor, test } from 'ember-qunit'") .to.contain("moduleFor 'view:foo', 'Unit | View | foo'"); + + expectCoffee(testFile); })); }); }); diff --git a/node-tests/helpers/expect-coffee.js b/node-tests/helpers/expect-coffee.js new file mode 100644 index 0000000..3c61e18 --- /dev/null +++ b/node-tests/helpers/expect-coffee.js @@ -0,0 +1,10 @@ +var coffeescript = require('coffee-script'); +var expect = require('ember-cli-blueprint-test-helpers/chai').expect; + +module.exports = function(file) { + var compileFunc = function() { + coffeescript.compile(file.content); + } + + expect(compileFunc).to.not.throw(Error); +} From 7e7798ff9573d2a269344738daed13f18526dc36 Mon Sep 17 00:00:00 2001 From: Jacob Jewell Date: Sun, 5 Feb 2017 18:25:00 -0500 Subject: [PATCH 09/11] add coffee-script to dev dependencies --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index b07bffb..762a266 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "license": "MIT", "devDependencies": { "broccoli-asset-rev": "^2.2.0", + "coffee-script": "^1.12.3", "ember-ajax": "0.7.1", "ember-cli": "2.6.2", "ember-cli-app-version": "^1.0.0", From a28149740b3eeeeb4bbf36d1c4a26bee42c4ef92 Mon Sep 17 00:00:00 2001 From: Jacob Jewell Date: Mon, 6 Feb 2017 09:26:44 -0500 Subject: [PATCH 10/11] fix variable reference --- node-tests/blueprints/component-addon-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-tests/blueprints/component-addon-test.js b/node-tests/blueprints/component-addon-test.js index aba755f..3afb8ed 100644 --- a/node-tests/blueprints/component-addon-test.js +++ b/node-tests/blueprints/component-addon-test.js @@ -18,7 +18,7 @@ describe('Acceptance: ember generate and destroy component-addon', function() { .then(() => emberGenerateDestroy(args, (file) => { var componentFile = file('app/components/foo-bar.coffee'); - expect(file('app/components/foo-bar.coffee')) + expect(componentFile) .to.contain("export { default } from 'my-addon/components/foo-bar'"); expectCoffee(componentFile); From 5bdf4c25a8c39dbbdbd4672b4be98098c274183d Mon Sep 17 00:00:00 2001 From: Jacob Jewell Date: Mon, 6 Feb 2017 09:55:06 -0500 Subject: [PATCH 11/11] add tests for expect-coffee helper --- node-tests/expect-coffee-test.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 node-tests/expect-coffee-test.js diff --git a/node-tests/expect-coffee-test.js b/node-tests/expect-coffee-test.js new file mode 100644 index 0000000..c52b395 --- /dev/null +++ b/node-tests/expect-coffee-test.js @@ -0,0 +1,22 @@ +'use strict'; + +var expect = require('ember-cli-blueprint-test-helpers/chai').expect; +var expectCoffee = require('./helpers/expect-coffee'); + +describe('Unit: expect-coffee', function() { + it('throws on invalid coffee-script', function() { + var testFunc = function() { + expectCoffee({ content: 'var x = 1;' }); + } + + expect(testFunc).to.throw(Error); + }); + + it('does not throw on valid coffee-script', function() { + var testFunc = function() { + expectCoffee({ content: 'x = 1' }); + } + + expect(testFunc).to.not.throw(Error); + }); +});