angular-ui-grid - no gridTestUtils.spec.js - javascript

I'm using angular-ui-grid 4.0.2 (the latest version) in my project.
According to the documentation here:
http://ui-grid.info/docs/#/tutorial/403_end_to_end_testing.
There should be some sort of test utilities module available named something like 'gridObjectTestUtils.spec.js' in a folder named 'e2e'.
As far as I can see no such module exists.
Here is a link to the source:
https://github.com/angular-ui/ui-grid.info/tree/gh-pages/release/4.0.2
Does anybody know if the testing module is still available? Or has it been deprecated?

I was using: https://mvnrepository.com/artifact/org.webjars.bower/angular-ui-grid which is the same artifact you get from running:
npm install angular-ui-grid
This package (for whatever reason) does not contain the test utilities.
However if you use:
npm install angular-ui/ui-grid (unfortunately not available as a webjar)
You get the e2e folder with all the test utils inside!
By the way, I have checked and ui-grid is the same thing as angular-ui-grid.
Also, ui-grid has it's latest commit set in this month of 2017, so it's not an older version. If you want to get the testing utilities, make sure you download ui-grid!

Related

Which npm version of the javascript module should be installed with a DefinitelyTyped typescript wrapper?

I'm seeing some API drift between the type declarations/definitions of a typescript DefinitelyTyped module (e.g. #types/prompts) and the javascript module it is meant to 'wrap'. How is one supposed to correctly pair versions for the the types package, and the version for the underlying javascript package?
Say I add a dependency on #types/prompts": "^2.0.14" in my package.json. How do I make sure I get the right version of javascript npm package that goes with it?
The npm package #types/prompts has no explicit dependency on the javascript module in its package.json, and there doesn't seem to be any mention of compatibility that I can see in the README.
All I've found is a loose comment in #types/prompts's index.d.ts mentioning:
// Type definitions for prompts 2.0
// Project: https://github.com/terkelg/prompts
...
Is there a convention we're supposed to follow? I'd be interested in hearing about a general approach, not necessarily just for this example.
References:
typescript types package: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/prompts
upstream javascript module: https://github.com/terkelg/prompts
In my experience, usually major and minor versions are being kept in sync between the upstream package and its #types package. Then the patch version would not match, due to the need of being able to fix a bug.
An example with react:
The current version of react is 17.0.2
The current version of #types/react is 17.0.37
The only part which isn't super clear is when a patch of the upstream package changes types. Is that change already applied in the types package?
So for example react decides to publish 17.0.3 which contains a non-breaking difference in types. How do we know if 17.0.37 includes that change? But for that, it's probably a better idea for react to actually publish 17.1.0 to address that new change.

Can you get latest Beta build automatically though package.json and npm

We have a project that has a dependency that always needs to be the latest beta build from an npm library. Unfortunately, there are -dev builds in there as well.
For example, there could be the following versions in the "x-library".
"1.2.3-dev.294 // published today
"1.2.3-beta.123" // <--- the one we want published yesterday
"1.2.3-dev.293" // published a week ago
"1.2.3-beta.122" // published a month ago
Is it possible to get the latest 'beta' build automatically in a package.json like so:
devDependencies: {
...
"x-library": "latest-beta" // just for clarity
}
I don't think this functionality is available through npm. There's not even the possibility of using regex to define your dependency version currently.
You could cobble together a solution yourself. Make a bash script update-and-install.sh using these pieces:
get JSON with all available versions
npm show my-package versions --json
filter the JSON to get beta versions only
use the package semver-parser and its method compareSemVer to sort for the latest of those betas
use sed to edit your package.json to set the dependency to the desired version
run npm install
Don't know if that's helpful, but that's what I would try if this were a project requirement. Good luck!

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

VS 2015 Angular 2 import modules cannot be resolved

I have created an empty web project and added files using
Angular-cli
https://scotch.io/tutorials/use-the-angular-cli-for-faster-angular-2-projects
I can run the website fine using ng buid/serve but I get below error in editor:
I read somewhere that it is Resharper error in version 9, so I upgraded my Resharper to latest which fixes the problem but it cannot resolve the modules. any suggestions?
Edit: created a new typescript class and it's giving below error
As far as I know, Resharper still doesn't support TypeScript latest versions. It looks like Resharper ignores tsconfig.json file that exists inside src folder. I suggest you try VS Code instead. It's free and has much better support of new TypeScript features.
If you still want to stay with VS 2015, you can configure Resharper not to analyze .ts files. Here is how to do it.
open npm and run npm install typings and then typings install and if after that it still doesn't work, try build the project
Try installing VS2015 update 3.
I had that error before and I was due to my typescript version installed in VS2015.

How to get angular2 to work in eclipse with typescript

So I was starting researching about angular2 and since I saw so many references to typescript being prefered I am trying to switch to it from javascript. Problem is, I saw a nice little guide I could follow to install it all in eclipse (angular, javascript, everything needed to launch the 5 minute guide code on the main page of angular), so I did it and managed to get it to work.
Now I would like to do the same with typescript, but I find myself lost since it doesn't seem to be working, I can't launch code, it's like node.js isn't working anymore, but since I do not know what the expected result is, I am not sure what is missing.
For example, I re did the 5 minute guide and notice as a difference that I do not have the installation of the modules, nor any run-as configuration ready, in fact, I can't manage to run as any typescript code I try to do.
What I did was:
1- Install Eclipse Mars, other guys uses older versions
2- Install Node.js
3- Install WildFly Server
4- Install TypeScript plugin https://marketplace.eclipse.org/content/typescript
5- Import my project in eclipse, you may have to create a new static web project and add your files in there. The 5 minute quick start is not an eclipse web project so you may not be able to import this. Do not forget to copy and past the same structure with the node modules that you have
6- Right click on the project > Configure > Enable Typescript Builder
7- Right Click the project > Properties > TypeScript > Compiler and configure as follows:
I hope this will do it for you.
Remember, this plugin does not respect json configuration file, so you have to do this manually as in the screenshot. Also, if you are going to provide arguments to your component constructor, You will have errors. Let me know if you got those. Another thing to mention is that using some annotations like #Input will not work, you will have to use inputs:[] inside your #Component annotation.
You can try to add those plugins on top of Mars:
https://github.com/angelozerr/angular2-eclipse
https://github.com/angelozerr/typescript.java
Those 2 are incubating but already provide good features. There is another one, that I didn't try but which has some popularity:
https://github.com/palantir/eclipse-typescript
Eclipse >= Neon
sudo npm install -g angular-cli (ng help must work)
See: https://github.com/angelozerr/angular2-eclipse
Install it and restart Eclipse
Open a .ts file
Eclipse Oxygen
Default javascript installation, then added the default free plugin for angular 2 / typescript from here:
angular2.ide - http://oss.opensagres.fr/angular2-eclipse/1.3.0/
After installing I opened an existing Angular 4 / TS project, worked fine. I then installed support for .scss from http://www.liclipse.com/text/updates. All setup and configured with Typescript 2.4.1 / nodejs v6.9.4.
But within days it now fails to open .ts files at all. Re-installation of the ng plugin did not fix it, I uninstalled liclipse plugin and no change either. It basically leaves eclipse unusable for ng4 projects as is.
The logs show the following errors.
org.eclipse.core.runtime.CoreException: Plug-in "ts.eclipse.ide.jsdt.ui" was unable to instantiate class "ts.eclipse.ide.jsdt.internal.ui.editor.TypeScriptEditor".
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:194)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:188)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
...
Caused by: java.lang.NoClassDefFoundError: org/eclipse/wst/jsdt/ui/text/JavaScriptSourceViewerConfiguration
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
...
Caused by: java.lang.ClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.wst.jsdt.ui (441).
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:112)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
...
Caused by: java.lang.ClassFormatError: Name index 1 in LocalVariableTable has bad constant type in class file org/eclipse/wst/jsdt/internal/core/JavaModelManager
I found
TypeEcs plugin for Typescript
it provide below.
•Syntax highlighting
•Code Completion
•Code Outline
•Find References
•Rename / Refactor
•Open Type
•Code Compilation
•Format Code
•Comment Code
•Open Declaration
•Mark Occurences
•Type Script Debug

Categories