Git Product home page Git Product logo

Comments (15)

dotansimha avatar dotansimha commented on May 20, 2024

@jalalat is that just a warning from the TypeScript compiler, or something actually don't work?

from angular-meteor-base.

jalalat avatar jalalat commented on May 20, 2024

Hi @dotansimha I found out next day that it is compiling and working fine. So definitely an issue with typings. I installed everything correctly. I am able to proceed but it bothers me to see lot of TypeScript errors in my testing scripts.

i resolved the first error using:
import chai = require('chai');
import spies = require('chai-spies');

Second and many others similar TS errors I am not able to find the solution. Is there any fix for that. I searched a lot on internet and i have got the right typings. As a beginner i like when i type . i can see the functions/variables available.

Not an issue if there is no fix. Really appreciate your help and time that you got back to me.

from angular-meteor-base.

dotansimha avatar dotansimha commented on May 20, 2024

@jalalat usually it's just typings issue.
do you use the latest version of the boilerplate?

Also, which IDE do you use?

from angular-meteor-base.

jalalat avatar jalalat commented on May 20, 2024

Hi @dotansimha there are more typing errors with new version of boilerplate with describe, beforeEach, it etc. My initial thoughts were may be these errors are there due to not importing @types in typings.d.ts so i inserted these 2 lines in typings.d.ts:

/// <reference types="@types/mocha" />
/// <reference types="@types/chai" />

Still getting all errors related to describe, beforeEach, it etc. I noticed another Typings error with latest boilerplate. If you go deep upto 3 levels it complains example: @angular/core/testing, @angular/platform-browser-dynamic/testing

from angular-meteor-base.

jalalat avatar jalalat commented on May 20, 2024

My project files are as below (not based on latest boilerplate):

typings.json

{
  "name": "BakBak",
  "version": false,
  "dependencies": {
    "chai-spies": "registry:npm/chai-spies#0.7.1+20160614064916"
  },
  "globalDependencies": {
    "chai": "registry:dt/chai#3.4.0+20160601211834",
    "es6-shim": "registry:dt/es6-shim#0.31.2+20160602141504",
    "meteor": "github:meteor-typings/meteor/1.3#955b89a4e2af892d1736bc570b490a97e860d5b7",
    "mocha": "registry:dt/mocha#2.2.5+20160619032855"
  }
}

index.d.ts:

/// <reference path="globals/angular2-compilers/index.d.ts" />
/// <reference path="globals/es6-shim/index.d.ts" />
/// <reference path="globals/meteor/index.d.ts" />
/// <reference path="globals/mocha/index.d.ts" />
/// <reference path="globals/chai/index.d.ts" />
/// <reference path="modules/chai-spies/index.d.ts" />
declare let SimpleSchema: any;
declare let ValidatedMethod: any;
declare let DDPRateLimiter: any;
declare let _: any;
declare let Roles: any;

declare module 'meteor/tmeasday:publish-counts' {
    import { Mongo } from 'meteor/mongo';
    interface CountsObject {
        get(publicationName: string): number;
        publish(context: any, publicationName: string, cursor: Mongo.Cursor<any>, 
            options?: any): number;
    }
    export const Counts: CountsObject;
}

package.json:

{
  "name": "bakbak24",
  "private": true,
  "scripts": {
    "start": "meteor run",
    "test": "meteor test --driver-package practicalmeteor:mocha",
    "test:ci": "meteor test --once --driver-package dispatch:mocha-phantomjs"
  },
  "devDependencies": {
    "@types/chai": "^3.4.33",
    "@types/mocha": "^2.2.32",
    "chai": "3.5.0",
    "chai-spies": "^0.7.1",
    "husky": "^0.11.8",
    "minimist": "^1.2.0",
    "node-localstorage": "^1.3.0",
    "parse-diff": "0.4.0",
    "typings": "^1.3.3"
  },
  "dependencies": {
    "@angular/common": "^2.1.0",
    "@angular/compiler": "^2.1.0",
    "@angular/core": "^2.1.0",
    "@angular/forms": "^2.1.0",
    "@angular/http": "^2.1.0",
    "@angular/material": "^2.0.0-alpha.9-3",
    "@angular/platform-browser": "^2.1.0",
    "@angular/platform-browser-dynamic": "^2.1.0",
    "@angular/router": "^3.1.0",
    "@angular2-material/button": "2.0.0-alpha.8-2",
    "@angular2-material/button-toggle": "^2.0.0-alpha.8-2",
    "@angular2-material/card": "2.0.0-alpha.8-2",
    "@angular2-material/checkbox": "2.0.0-alpha.8-2",
    "@angular2-material/core": "2.0.0-alpha.8-2",
    "@angular2-material/grid-list": "^2.0.0-alpha.8-2",
    "@angular2-material/icon": "2.0.0-alpha.8-2",
    "@angular2-material/input": "2.0.0-alpha.8-2",
    "@angular2-material/list": "2.0.0-alpha.8-2",
    "@angular2-material/menu": "2.0.0-alpha.8-2",
    "@angular2-material/radio": "^2.0.0-alpha.8-2",
    "@angular2-material/tabs": "2.0.0-alpha.8-2",
    "@angular2-material/toolbar": "^2.0.0-alpha.8-2",
    "angular2-meteor": "^0.7.0-beta.1",
    "angular2-meteor-accounts-ui": "^0.6.1",
    "angular2-meteor-polyfills": "0.1.1",
    "angular2-meteor-tests-polyfills": "0.0.2",
    "angular2-moment": "^0.8.2",
    "es6-shim": "0.35.1",
    "meteor-node-stubs": "0.2.3",
    "meteor-rxjs": "^0.3.0",
    "meteor-typings": "1.3.1",
    "moment": "^2.14.1",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.6",
    "spawn-sync": "^1.0.15",
    "zone.js": "^0.6.25"
  }
}

from angular-meteor-base.

dotansimha avatar dotansimha commented on May 20, 2024

@jalalat I fixed all types issues in f3eded9 and 5d22b3d

from angular-meteor-base.

jalalat avatar jalalat commented on May 20, 2024

Still the same errors. Sorry @dotansimha .

from angular-meteor-base.

dotansimha avatar dotansimha commented on May 20, 2024

@jalalat , do you use the latest boilerplate, and then run npm install, and npm run test in order to run Chai?

from angular-meteor-base.

jalalat avatar jalalat commented on May 20, 2024

@dotansimha yes same steps. As you know these are not code errors rather Typings errors in code editors (Visual studio code and Sublime Text).

I will try a new laptop in the evening and will let you know.

from angular-meteor-base.

dotansimha avatar dotansimha commented on May 20, 2024

With latest WebStorm - everything works great and detected correctly, without any lint errors.

from angular-meteor-base.

jalalat avatar jalalat commented on May 20, 2024

you are right. It works on WebStorm. I got a wonderful opportunity to try various different editors like Sublime, Visual code, Atom and now WebStorm :)

from angular-meteor-base.

jalalat avatar jalalat commented on May 20, 2024

However i could not make all chai-spies methods to work in this boilerplate like:
var array = [ 1, 2, 3 ];
chai.spy.on(array, 'push');

from angular-meteor-base.

dotansimha avatar dotansimha commented on May 20, 2024

Can you share the full code you are trying to run with the Spy? maybe I missed some methods in the Typings.

from angular-meteor-base.

jalalat avatar jalalat commented on May 20, 2024

Hi @dotansimha, thanks a lot for your help. Very much appreciate your time. I was just trying chai-spies before i could start using it in my code fully. I was testing the examples provided here: https://github.com/chaijs/chai-spies

from angular-meteor-base.

dotansimha avatar dotansimha commented on May 20, 2024

@jalalat please refer to typings.d.ts file and check it all the methods that you use on the spy object are defined there.

from angular-meteor-base.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.