ember-cli ignores my coffeescript test files - coffeescript

I'm an ember-cli newbie and I'm trying to start testing my dumb app with some dumb tests. It seems that ember-cli ignores any *test.js.coffee files in tests directory.
I'm using version 0.0.44 and installed coffescript adapter with npm install --save-dev ember-cli-coffeescript
Any idea why?

Did you install the coffeescript module?
npm install --save-dev ember-cli-coffeescript

Related

How to verify facebook jest is installed successfully

I followed the instructions to install Facebook jest on https://facebook.github.io/jest/docs/getting-started.html#content :
npm install --save-dev jest-cli
After the install command I typed jest in the terminal, and press enter but It popped:
bash: jest: command not found.
But when I run the getting started sample by using npm test in the terminal, it worked well.
So, how can I verify that Facebook jest is installed successfully?
Ways to install a package in npm
In node.js you have two ways to install a package: globally or locally.
The sintax is the following:
// globally
npm install -g [package_name]
// locally
npm install --save-dev [package_name]
So, now what it happens is that you run the local one which downloads the package in node_modules under your project folder.
To check you installed jest properly so you can check on your node_modules if there is a jest folder.
How to check if jest is installed
In addition to that npm is creating a shortcut in you local node_modules under the directory .bin son in there you should find a link to jest.
You can test that like that:
cd your_project_folder
./node_modules/.bin/jest
Why npm test works?
The reason why npm test works is because when you run it npm is going to look for the commands globally and locally.

How to compile and run an ES6 file with node when using babel6?

I installed the latest version 6 of babel, babel-core and babel-loader.
How can I run an ES6 file in Node with Babel6?
Previously I would run the command
babel-node server.js
but now I get this message:
The CLI has been moved into the package `babel-cli`. See http://babeljs.io/docs/usage/cli/.
None of the instructions on that page say how to do this.
The message could be clearer. You've installed the babel package and you should have installed the babel-cli package.
npm uninstall babel
npm install babel-cli
Upon installing babel-cli I also had to specify the es2015 loader and to specifically use my local babel-node package since I don't have it installed globally.
./node_modules/.bin/babel-node --presets es2015 server.js

How to use sinon on karma?

I'm trying to use karma, chai and sinon to test spy.
I did:
npm install karma-sinon --save-dev
I added:
frameworks: ['mocha','chai','chai-sinon']
I run:
karma start
But I'm getting this error:
Error: No provider for "framework:chai-sinon"! (Resolving: framework:chai-sinon)
I had the same problem by simply adding the chai entry to the Frameworks section of my karma.conf.js script did not solve the problem. Following this Github Issue I found that you need to install the karma-cli globally, and everything else can be local and work.
npm install --save-dev karma
npm install -g karma-cli
npm install --save-dev karma-phantomjs-launcher karma-chai karma-sinon
During going through PluralSight course on Gulp I've come into the same problem.
This issue was due to lack of npm modules that are required. The string that helped me is this:
npm install --save-dev karma karma-chai karma-chai-sinon karma-chrome-launcher karma-coverage karma-growl-reporter karma-mocha karma-phantomjs-launcher karma-sinon mocha mocha-clean sinon-chai sinon phantomjs
Initially I've misspelled the karma-chai-sinon as karma-chai sinon so it successfully installed every dependency but resulted in the error.
So please try it. I've got the same error.
Did you add the 'karma-chai-sinon' to your plugins in your karma.conf.js
My plugins looks like this:
plugins: [ 'karma-chai-sinon', 'karma-mocha', 'karma-phantomjs-launcher', 'karma-babel-preprocessor' ]
I've had the same problem by simply adding the chai entry to the Frameworks section of my karma.conf.js script did not solve the problem, it's the same other frameworks that you point into frameworks array.
Have you installed the "karma-sinon-chai" npm package
Have you tried it?
e.g. npm install karma-simon-chai --dev-save

Was there a change in the npm default location for coffee-script?

I found I was running an old version of coffeescript.
So I decided to reinstall it:
npm install -g coffee-script
But it did not seem to update coffee.
I noticed that npm installed coffee here:
usr/local/share/npm/bin/coffee ->
/usr/local/share/npm/lib/node_modules/coffee-script/bin/coffee
But my the coffee in my path is
/usr/local/bin/coffee ->
../lib/node_modules/coffee-script/bin/coffee
AFAIK, I used npm to originally install coffeescript (months ago).
But now npm is putting it in a completely new path.
Was there a change for the default location of coffeescript when installed by
via npm on Mac OS X?

`npm install <folder>` or `npm pack` does not install dependencies

I have an npm package that uses coffeescript source, which I want to precompile before pack or publish. However, my prepublish script depends on coffee-script as a devDependency, but npm isn't installing it before running the prepublish action. I have to run npm install separately first, which seems wrong. The same issue exists if I try to npm install the source folder into a different project.
I suspect that I'm "doing it wrong," but the only other guidence I've seen is to compile on install rather than publish. I'd rather not do that, so I'm hoping there are examples of prepublish compilation that I can crib from.