Cucumber Js - How to run the features [Windows] - node.js

I'm trying to learn cucumber and so far got a grip on installing nodejs, cucumber, creating package.json, storing features files and steps. But when I'm trying to run using windows command prompt, I'm getting the below shown error.
project structure
features
- example.feature
- step_definitions
- steps.js
- support (nothing here yet)
node_modules (cucumber installed locally)
package.json
I started executing commands from the bin folder to ensure cucumberjs works and it echo'd out the version number 3.1.0
C:\Test Project\node_modules\.bin>cucumberjs -v
and then began to run the feature file
C:\Test Project\node_modules\.bin>cucumberjs "C:\Test Project\features\example.feature"
and it errors here
Note: If i install the cucumber globally then it works, this error happens when I install cucumber locally
Any help pointing out where I'm going wrong will be much appreciated

I haven't figured out what's the reason behind the error but managed to run the features files by adding the following to the project package.json and running cli npm run cucumber
"scripts": {
"cucumber": "cucumberjs ./features"
},

Related

node 6.11.3 NODE_EXE not found in IntelliJ

I've updated my project to use node 6.11.3. When I now try to start a npm-script by using the Run-configurations provided from IntelliJ, I always receive the following error:
Error: Failed to replace env in config: ${NODE_EXE}
Important: This error appears only if I start npm from within my project. If I use the windows cmd, the error doesn't appear.
What could possibly have changed between node 6.11.2 and 6.11.3? Because with the prior version, everything worked fine.
A workaround for me is to add the NODE_EXE variable to my run configuration, but In my opinion, that shouldn't be needed, because it worked in 6.11.2 too.
Looks as if you have ${NODE_EXE} variable set in one of your npmrc files (see https://docs.npmjs.com/files/npmrc#files), and it can't be properly expanded for some reason when you run your script in the IDE.
is the issue specific to certain project?
how many npm versions do you have installed? Please check that npm chosen in Node.js Interpreters dialog is the same as you use in cmd shell?
please create an env.js file with console.log(process.env) and try running it via npm ("env" : "node env.js") in both cmd console and WebStorm - what is the result?

No ember-cli-build.js found

I'm trying run an Ember project locally : https://github.com/cosmicjs/ember-real-estate-website?files=1. I'm using pycharm 2017 using git-bash as my terminal in win7. I have npm , node and ember installed . In pycharm my project looks like the screenshot.
I've been advised to build the project (Emberjs: Failed to find a valid digest in the 'integrity' attribute , although this is not discussed in the instructions):
$ ember build
Running without permission to symlink will degrade build performance.
See http://ember-cli.com/user-guide/#windows for details.
- BuildingNo ember-cli-build.js found.
You can see the file in the screenshot. What am I doing wrong?

atom + mocha on windows = spawn mocha ENOENT

My goal is to run mocha unit tests by Atom, which is installed on Windows and also my src code resides. this should work independently from my Meteor App which is running on a different (Linux) machine.
Basically my setup is like this:
I have my repo and sourcecode:
c:\Users\Me\repos\meteor
My tests are inside:
c:\Users\Me\repos\meteor\tests
I have Node:
c:\Program Files\nodejs
installed with "npm i -g mocha --save-dev"
And i try to use this package https://github.com/Tabcorp/atom-mocha-test-runner but i can switch to another package if necessary.
What I've tried so far:
I edited my settings for the atom-mocha-test-runner:
Mocha command: C:\Program Files\nodejs\node_modules\mocha\.bin\mocha
Mocha command: C:\Program Files\nodejs\npm mocha
But each time i try to run my test via dropdown menu (Run Mocha Test), i get this error:
Mocha Test Results:
Node binary: C:\Program Files\nodejs\node.exe
Root folder: C:\Source\Repos
Mocha command: undefined
Path to mocha: mocha
Debug-Mode: false
Test file: tests\unit\first.js
Selected test: should return url
Failed to run Mocha
spawn mocha ENOENT
Anyone know what i miss or do wrong?
Still having no idea about why the package isn't working, I'm going to give a cop-out answer. If we figure out how to make it work, you can accept that answer instead. process-palette gives you the ability to run highly specific command-line instructions from Atom commands. Here's an example of a command that runs mocha in the project path for the current file with the same hotkey and also conveniently organized into its own menu item:
The disadvantage of this approach is that you have to know how to use the external program yourself. Packages like mocha-test-runner are designed to remove that need from the user, but as we can see here, sometimes the package doesn't know what it needs to be doing. The disadvantage is mitigated by the fact that you only have to learn the command for long enough to set up the configuration to run it, and from that point on it's very easy.
Advantages versus other packages include the ability to precisely control what's going on. Say you have multiple top-level folders in the current project, and they have different test suites. A package like mocha-test-runner can get the path from the active file, or from the project. If the developer chose to grab the project path, then you're going to have trouble running individual test suites. With the configuration I've shared, the command will always be run in the absolute path of the current file's project folder, so the tests will be run for whichever file you're working on at the time.

Downloading source files cache modernizr.load.1.5.4.js Grunt Build Stall

I have been using Yeoman to start building with web apps and such for maybe the last month. And I have been running into some issues and have been able to resolve most of them. However, now I am stuck.
I'm running MAC OS 10.6.8
I have reinstalled Yeoman and Node fixed my paths for (what I know) as global.
Running grunt in my app.
Forces me to run as sudo. (I think this is because this OS has password protected permissions for apps and programs to install/modify files.
** If I run grunt -f
Warning: Unable to write "dist/scripts/vendor/modernizr.js" file (Error code: EACCES). This error happens with most of the main tasks in grunt.
Running sudo grunt
grunt runs through the tasks just fine until the real issue I cannot locate an answer.
Running "modernizr" task
Enabled Extras
shiv
load
cssclasses
Looking for Modernizr references
in dist/styles/main.css
svg
input
Downloading source files
cache modernizr.load.1.5.4.js
And grunt will not finish this download of source files. When I ran grunt using force it would complete the download. I am looking for a solution for the 2nd list item. Any assistance would be helpful.
Found out that there some glitch in the npm grunt-modernizr.
I used this code:
npm remove grunt-moderizr && npm install --save-dev grunt-modernizr
found here: https://github.com/Modernizr/grunt-modernizr/issues/48

Error code: 800A1391 Source: Microsoft JScript runtime error Running Grunt - Module is undefined

New Grunt user here who is using a lot of new tools (npm nodejs) today.
I've got Grunt "installed" and have been able to create a grunt.js file using the init task as described here: http://net.tutsplus.com/tutorials/javascript-ajax/meeting-grunt-the-build-tool-for-javascript/ and here: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md. But whenever I run the "grunt" command I get an error:
Windows Script Host
Script: c:\users\[]\Documents\code\grunt\grunt.js
Line: 2
Char: 1
Error: 'module' is undefined
Code: 800A1391
Source: Microsoft JScript runtime error
As explained in the FAQ, you need to type grunt.cmd instead on Windows because the OS tries to launch grunt.js
Or you can install grunt-cli globally instead. This package will run any version of Grunt if it's been installed locally to your project.
SOLVED !!
So, this problem occur because windows by default associative < *.js > files
with >>
"Microsoft Windows Based Script Host".
grunt need to open by default with (grunt.cmd).
it easy to slove, by change default app (open with..)
Guide :
Go to any javascript file with "js" extension. (any file)
Right-Click(mouse) > Properties > "Opens with:" Change...(button)
Choose Notepad ( or any javascript IDE ).
PROBLEM SOLVED ! :)
good luck
If you're getting a "Microsoft JScript runtime error" that means that node.js isn't even getting invoked; instead Windows Script Host is trying to run your code. That's probably a problem with filetype associations; IIRC Windows defaults to trying to execute a ".js" file with WSH. You may wind up having to create a shortcut to your script, specifying a command line (probably something like "node %1") and a starting directory in order to make sure that it's executed properly.
It would help if you could tell us exactly how you're trying to invoke your code.
it seems that in the latest versions of the grunt modules, you would have to do the following to have it work under windows:
remove any globally installed grunt
npm uninstall -g grunt
install grunt-cli globally
npm install -g grunt-cli
install grunt locally into your project
npm install grunt
installing grunt (v0.4.x) globally does not seem to create the necessary grunt.cmd anymore. it seems that the recommendation is now to have grunt installed locally to be able to use version-specific Gruntfiles
As Florian F suggested, running grunt.cmd works. This is because of the process Windows is looking for your grunt command.
When typing grunt -h Windows will proceed to look for the following files:
./grunt.cmd
./grunt.* (grunt.js is found in this case which is why you see "module is undefined")
%APPDATA%/npm/grunt.cmd
An alternative to using "grunt.cmd" is to use grunter which simply renames the command to grunter... then you no longer have this problem.
To answer this, first we need to understand that the error is caused because it is being executed by Windows Script Host.
Now, run the code from your cmd promt with the following syntax:
>node <application_name>.js
this will allow the Node.js application to open through V8 JavaScript engine(Google's).
P.S: Please reply back if this has helped in resolving your issue else post the problem you are facing after trying this.
I had a similar issue, the problem is file association, I would recommend:
right click on a .js file and choose open with.
then you choose nodejs/node.exe (somewhere in "program files" folder
then make tick box where it says "always open .js files " (paraphrasing)
That should do the trick.
I went through the same issue when running an old Node project.
The issue was with the name of the js file, it was node.js. So the while running the command node node.js, it was opening up a windows dialogue box.
I just changed the name of the file to app.js and the error flew away.
So, in my case i had tryed all the mentioned above with no result.
But i have fund that im dont type: node in the full sentence as the following snipet
node script.js.And remember never understimate your own miscoding.
Solution:
Go to any javascript file with "js" extension. (any file)
Right-Click(mouse) > Properties > "Opens with:" Change...(button)
Choose Notepad ( or any Javascript IDE like VS Code ).

Resources