1
votes

I would like to run "ember test" without JShint. My ultimate goal is to set run jshint in development environment and not run it in production build.

I first started to turn off the option in Brocfile.js http://discuss.emberjs.com/t/disable-ember-cli-hinting/6731/2

var app = new EmberApp({
  hinting: false
});

It worked, so I decided to try

 var EmberApp = require('ember-cli/lib/broccoli/ember-app'),
  isProduction = ( process.env.EMBER_ENV || 'development' ) === 'production';


if( isProduction ){
   app.hinting = false;
}

Then I realize the process.env.EMBER_ENV, doesn't seem to work. But little did I know I was probably running the wrong command.

ember test

The command didn't specify any environment, so I tried

ember test --environment=production 
ember test --environment production

which result in an exception:

Build failed.
Path or pattern "test-loader.js" did not match any files
Error: Path or pattern "test-loader.js" did not match any files
  at Object.multiGlob (.../node_modules/ember-cli/node_modules/broccoli-kitchen-sink-helpers/index.js:202:13)

Next, I try to read node_modules/ember-cli/lib/broccoli/ember-app.js, I see:

  var isProduction = this.env === 'production';

  this.tests   = options.hasOwnProperty('tests')   ? options.tests   : !isProduction;
  this.hinting = options.hasOwnProperty('hinting') ? options.hinting : !isProduction;

But I don't really know how this.env get pass in the ember test and I can't get the environment within the Brocfil.js. I am assuming by default, hinting would respect the isProduction value if it isn't defined.

And searching further more, got me to https://github.com/rwjblue/ember-cli-test-loader, which seems to be related.

My questions are: 1. Is there a way to run ember test without jshint via CLI? 2. Can this be set using config/environment.js? 3. Can I set a breakpoint to debug the Brocfile.js file? I tried with chrome:localhost:4200, I don't any node_modules file being loaded.

Thanks in advance. I am an extreme newbie to javascript and ember..

1
Why are you running your tests in production?Buck Doyle
github.com/emberjs/ember.js/issues/9345 - related to ember test --environment=productionAlocus
I am running tests in production, just want to turn off jshint testsAlocus
I thought ember build --environment=production would build something for production, and ember test --environment=production would run unit/integration test, without jshint. (at least that's what I want when running maven build for production) Please advice.Alocus

1 Answers

0
votes

try

ember test --query=nolint

the latest ember-cli-qunit uses this query param to disable lint checks in tests

here is the commit where it was added if you are interested