cibernox/ember-native-dom-helpers

Requirements to use this package?

Closed this issue · 4 comments

What are the requirements to use this package? I've tried with a brand new ember new app and I get this exception:

Died on test #1     at Module.callback (http://localhost:7357/assets/tests.js:145:24)
    at Module.exports (http://localhost:7357/assets/vendor.js:119:32)
    at requireModule (http://localhost:7357/assets/vendor.js:34:18)
    at TestLoader.require (http://localhost:7357/assets/test-support.js:7672:7)
    at TestLoader.loadModules (http://localhost:7357/assets/test-support.js:7664:14)
    at Function.TestLoader.load (http://localhost:7357/assets/test-support.js:7694:22)
    at http://localhost:7357/assets/test-support.js:7577:18: regeneratorRuntime is not defined@ 24 ms
Expected: 	
null
Message: 	Diff suppressed as the expected and actual results have an equivalent serialization
Source: 	
ReferenceError: regeneratorRuntime is not defined
    at Object.callee$0$0 (http://localhost:7357/assets/tests.js:146:5)
    at runTest (http://localhost:7357/assets/test-support.js:3852:30)
    at Test.run (http://localhost:7357/assets/test-support.js:3838:6)
    at http://localhost:7357/assets/test-support.js:4030:12
    at Object.advance (http://localhost:7357/assets/test-support.js:3515:26)
    at begin (http://localhost:7357/assets/test-support.js:5206:20)
    at http://localhost:7357/assets/test-support.js:4400:6

I'm assuming that it's because ember-cli 2.12.x doesn't have the new beta version of babel 6?

If there is documentation somewhere on this, I'm happy to create a PR to more clearly state what the requirements are to use this package in the README.md or another file.

Steps:

ember new new-test-app

ember-cli: 2.12.2
node: 4.8.2
os: darwin x64

ember install ember-native-dom-helpers
ember g component foo-bar
ember t -s
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import { click } from 'ember-native-dom-helpers';

moduleForComponent('foo-bar', 'Integration | Component | foo bar', {
  integration: true
});

test('it works with endh', async function(assert) {
  this.render(hbs`{{foo-bar}}`);
  await click('button');
});

When using async/await you will need to either add https://github.com/machty/ember-maybe-import-regenerator or add 'ember-cli-babel': { includePolyfill: true } to your ember-cli-build.js file.

I talk a bit about it during my talk at Ember NYC in march: https://youtu.be/QV9rfsRZiWM?t=27m4s too, if that helps at all...

I've updated the readme with a note about this. I just recommend using https://github.com/machty/ember-maybe-import-regenerator since if you have the polyfill it's just a noop, and if you only want this the polyfill is just overkill.

Thank you both for the quick responses on this - I'm looking forward to trying this out.