How to work with babel in cucumber js project? - javascript

I have a cucumber js 4.2.1 and I want to use babel before running the tests.
I couldn't find any documentation/tutorial about this integration.
Does anyone know how to do that?
Bonus: Using the latest babel versions (7.0.0 (not beta)).
To be more specific, currently, when running cucumberjs from the command line, I don't specify the feature files folder and the steps folder:./node_modules/.bin/cucumber-js.cmd.

In case you are using protractor with cucumber you can use babel-register:
See an example here: https://github.com/canvaspixels/cucumber-protractor/blob/master/sample-conf.js
Just add:
require('babel-register'); to the top of your conf and install the babel-core npm package.
I highly recommend using cuketractor to structure your project and reduce boilerplate: https://www.youtube.com/watch?v=5vuYL4nxMXs

Related

Is there a way to step through a RunJS app using the debugger in WebStorm

I'm using RunJS, a minimalist Javascript library for building executable tasks. I'd like to step through my code with the debugger in WebStorm. Is this possible or will JetBrains need to add support for RunJS in their Run Configuration Templates?
When using runjs-cli (npm install -g runjs-cli) to run your tasks, you can use Node.js run configuration for debugging:
I'm not however sure how the scripts run with npx can be debugged...

How to integrate uglify-es in grunt?

I'm using gruntjs (which uses uglifyjs) to build my Angularjs app. But uglifyjs still does not support es6, so in corresponding GitHub issue i found this. So now there is uglify-es, which seemingly supports es6. But I'm not sure how to integrate it with grunt. Now i have module "grunt-contrib-uglify", which has a dependency uglifyjs, which is now used. How can i make grunt use uglify-es instead?
I've achived this by installing the harmony branch of grunt-contrib-uglify, which supports es6:
npm install git://github.com/gruntjs/grunt-contrib-uglify.git#harmony --save-dev
The ECMAScript version has finally been released.
You can now get the same result with the official version (it's no longer needed to pick it from GitHub)
npm install grunt-contrib-uglify-es --save-dev
https://www.npmjs.com/package/grunt-contrib-uglify-es

Should a TypeScript Library's repo contain the JS version?

Should the repository for a library written in Typescript contain a JS version for the consumer? Or should I leave it to the consumer to compile it themselves? Or neither?
As a general rule, I only include the source files in the repo. There is a reasonable expectation that a person downloading the source will want to work with the source and build it. Meanwhile you can offer build tools/commands to help them build it. For npm modules, your package.json might have a postinstall script that runs the tsc command. As long as TypeScript is a dependency, npm will download the necessary libraries and execute the TypeScript build when the user does an npm install on the repo once cloned locally.

How to get intellisense for AngularJS in VSCode?

So can anyone help me get the AngularJS intellisense working in Visual Studio Code?
Is it possible to configure this globally or can it only per project? I'm preferably looking for a solution on how to do this globally, as in whenever I open VSCode AngularJS intellisense just works.
I'm currently using AngularJS 1.5.x. I do not know if it possible to configure according to the version of AngularJS being used. Additionally, I'm using VSCode 1.10.2 and VSCode - Insiders on Windows 10.
I've already searched in several places, but the solutions I've found did not work for me. Maybe it's because they are old.
There are many extensions available for intellisense in Angular (2+), but not for AngularJS. However, this article by Mike Barlow explains how to do it and it's fairly recent since you've asked your question (June 2016).
Here's the summary of what you need to do per the article:
Have the following tools installed: node.js 6.2+, npm 3.9+, and VSCode 1.2+.
Install the typings package globally: npm install -g typings. Make sure this is a 1.X version.
Install AngularJS types: typings install dt~angular --save --global
This should create a a folder typings\globals\angular\ with a file called "typings.json"
Create a file within this directory as a sibling to "typings.json" called "jsconfig.json". This file can remain empty unless you need to transpile code (ie, using typescript, coffeescript, etc.)
Restart VSCode

Should you commit the typings folder for es6 projects when using vscode?

So I have been using Visual Studio Code (vscode) when playing with some sample es6 projects.
My understanding is that in order to get intellisense to work properly with node modules, you need to include the typings of the projects that you're working on (Link here).
What I also understand is that you can have a typings.json file that stores all the "type definitions" and you run a typings install to retrieve all the typings.
This is all to get the intellisense working in vscode. What I am not sure is whether you should exclude this (typings folder and typings.json) from version control altogether?
At the moment I think that the editor should not influence the source code structure. I'm pretty sure that you should exclude the typings folder. I am not sure about typings.json. It could be useful for vscode users, but will most likely be pointless for WebStorm/Atom/Sublime/Vim users?
The content of the typings folder can easily be recreated by running typings install. If you have any kind of build process like webpack, browserify, gulp or similar, then you also need to have these definitions to be able to run the typescript compiler in your continuous integration system for example.
So you should commit the typings.json and add some npm postinstall scripts to automatically download the typings when you run npm install to be able to build your code in an automated way.

Categories