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

Setup Questions #74

Closed
dschinkel opened this issue Feb 5, 2016 · 2 comments
Closed

Setup Questions #74

dschinkel opened this issue Feb 5, 2016 · 2 comments

Comments

@dschinkel
Copy link

The docs are lacking. If you're new to ember, your docs aren't very understandable, there are some things inferred that I'm not familiar yet with ember. Yes I've looked at the Ember docs, still, ember-mocha doesn't help much in terms of install instructions.

also it looks like if I just install mocha, I can use it or do I still need to use this plugin? Maybe it's that webstorm is resoving mocha syntax because I've got mocha installed but still need to be using ember-mocha??

I ran ember install ember-cli-mocha from terminal in the root folder of my ember app.

Then tried to setup a test like so:

/tests/my-test.js

import { describeModule, it } from 'ember-mocha';

let chai = require('chai'),
    expect = chai.should();

describeModule('Companies - List', () => {
  it('should display a list of companies ', () => {
    expect($('tr.companies').to.have.length(2));
  });
});

I don't know what I'm missing here. This test is in /tests in my Ember app.

I get the error Unexpected token import for my import line above after running mocha test command in my terminal.

Obviously I'm not setting this up right, and I don't really know about how resolvers work with Ember yet, so your docs are lacking. How do I set this up correctly?

Did I setup my test ok? what am I missing?

And..how does this resolver work? Where do I actually put this code?

import resolver from './helpers/resolver';
import { setResolver } from 'ember-mocha';

setResolver(resolver);

pretend I've never used Ember...can you please give more details on what I'm missing or doing wrong here?

@dgeb
Copy link
Member

dgeb commented Feb 5, 2016

When running ember install ember-cli-mocha, make sure to type Y when prompted "Overwrite tests/test-helper.js". This file will then be changed to contain:

import resolver from './helpers/resolver';
import { setResolver } from 'ember-mocha';

setResolver(resolver);

Everything else should be taken care of by installing ember-cli-mocha.

You should then be able to use the ember cli generators to create modules and corresponding tests (which will use mocha). For example: ember g controller articles will create tests/unit/controllers/articles-test.js

I believe this is explained in the ember-cli-mocha readme, but please file an issue or PR there if any clarification is needed.

I've just created a bare bones ember-mocha-example project so you can compare your project's settings in case you have questions.

@dgeb dgeb closed this as completed Feb 5, 2016
@dschinkel
Copy link
Author

Thanks much dgeb! Really appreciate it.

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