Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the bare minimum required to test a ember.object in isolation? #30

Closed
toranb opened this issue Apr 2, 2014 · 3 comments
Closed

Comments

@toranb
Copy link

toranb commented Apr 2, 2014

I'm migrating from a pure globals setup and I'm trying to understand what is required in my simple "test helper"

When I look at EAK I see a few additional items (and I just want to confirm they are /are not needed with this new ember-qunit project)

Number 1 on my list (do I need isolatedContainer) ?

window.isolatedContainer = require('ember-qunit/isolated-container')['default'];

Number 2 on my list (to use a custom resolver or not) ?

In the readme is states "if you don't have a custom resolver..."

When should you have a custom resolver? What are the benefits? I see that EAK has a simple resolver like so

import Resolver from 'ember/resolver';

var resolver = Resolver.create();

resolver.namespace = {
  modulePrefix: 'appkit'
};

export default resolver;

Is it preferred to use something like this or follow the readme to the letter?

import Resolver from './path/to/resolver';
import {setResolver} from 'ember-qunit';
setResolver(Resolver.create());

This brings up number 3 on my list ...

Because this has ES6 import statements, should my grunt build transpile all of my tests and dump those into karam/testem ? What if I have some tests/helpers that are not ES6? Will this be an issue?

I'm working on a EAK-lite like blog post series and I have integration testing down w/ something like the following

import Application from 'js/app';
import Router from 'js/router';

function startApp() {
  var App;

  var attributes = {
    rootElement: '#ember-testing',
    LOG_ACTIVE_GENERATION:false,
    LOG_VIEW_LOOKUPS: false
  };

  Router.reopen({
    location: 'none'
  });

  Ember.run(function(){
    App = Application.create(attributes);
    App.setupForTesting();
    App.injectTestHelpers();
  });

  App.reset();

  return App;
}

export default startApp;

(almost identical to what's in EAK now for integration testing)

What I'm having a hard time w/ today is mixing tests that need my startApp and using this ember-qunit project. Thanks for the help (this is literally the final step required to help my team start migrating to ES6)

@toranb
Copy link
Author

toranb commented Apr 3, 2014

Decided this topic was way to involved / complex for this particular project (sorry)

@toranb toranb closed this as completed Apr 3, 2014
@coderberry
Copy link

Why are you trying to make things difficult @toranb???

@toranb
Copy link
Author

toranb commented Apr 3, 2014

haha, actually I'm just trying to provide an "alternative" to EAK while we wait for ember-cli + broccoli to mature a little. (the top 2 requirements are 1) ES6 2) testing both unit/integration)

Also I'm blogging the "build up" so people know what all is required / how a grunt file is built up over time to encapsulate things like

1.) ES6 transpilation
2.) testing with karma or testem
3.) concat for local builds/test builds
4.) deployment
5.) how to deal w/ multiple static "ember" builds all in 1 grunt configuration (something I'd like to share at a user group or conference at some point -surpised ZenDesk didn't share at EmberConf to be honest)

**see I had good intentions :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants