Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm start gave Cannot find name 'expect'. errors #159

Closed
tja4472 opened this issue Oct 30, 2016 · 13 comments
Closed

npm start gave Cannot find name 'expect'. errors #159

tja4472 opened this issue Oct 30, 2016 · 13 comments

Comments

@tja4472
Copy link
Contributor

tja4472 commented Oct 30, 2016

Fixed by adding

    "types": [
      "jasmine"
    ]

to tsconfig.json

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "target": "es5",
    "types": [
      "jasmine"
    ]
  },
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

hth
Tim

@lathonez
Copy link
Owner

Hi Tim,

I've just done a fresh install locally and don't see anything - also CI seems clean.

Any advice on how I can replicate this?

Steve

@tja4472
Copy link
Contributor Author

tja4472 commented Oct 30, 2016

Hi Steve

This is on Windows 10 with a fresh install.

With your original tsconfig.json:

  • npm start gives errors
  • npm test is fine.
  • Visual Studio Code is fine.

Found the 'fix' from ionic-team/ionic-app-scripts#157 (comment)

Add Mocha or Jasmine to the global types in TSConfig as @JustinPierce mentioned. We are now being more strict in how we're compiling Typescript. We were getting complaints using the transpile only solution where it didn't actually validate types, etc.

Tim

C:\VSCode\Ionic2\github\clicker>npm start

> Clicker@2.0.1 start C:\VSCode\Ionic2\github\clicker
> ionic serve


Running 'serve:before' npm script before serve

> Clicker@2.0.1 watch C:\VSCode\Ionic2\github\clicker
> ionic-app-scripts watch

[19:35:24]  ionic-app-scripts 0.0.38
[19:35:24]  watch started ...
[19:35:24]  build dev started ...
[19:35:24]  clean started ...
[19:35:24]  clean finished in 15 ms
[19:35:24]  copy started ...
[19:35:24]  transpile started ...
[19:35:25]  lint started ...
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 3
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 5
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 9
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 10
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 13
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 14
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 17
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 18
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 21
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 25
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 29
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 33
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 37
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/app.e2e-spec.ts, line: 41
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/clickerList.e2e-spec.ts, line: 8
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/clickerList.e2e-spec.ts, line: 10
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/clickerList.e2e-spec.ts, line: 14
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/clickerList.e2e-spec.ts, line: 16
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/clickerList.e2e-spec.ts, line: 19
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/clickerList.e2e-spec.ts, line: 20
            Cannot find name 'describe'.

       L3:  describe('ClickerApp', () => {

            Cannot find name 'beforeEach'.

       L5:  beforeEach(() => {
       L6:    browser.get('');

            Cannot find name 'it'.

       L9:  [19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/clickerList.e2e-spec.ts, line: 23
i[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/clickerList.e2e-spec.ts, line: 27 t
('should have a title', () => {
[19:35:30]  typescript: C:/VSCode/Ionic2/github/clicker/e2e/clickerList.e2e-spec.ts, line: 30       L10:
  expect(browser.getTitle()).toEqual('Clickers');

            Cannot find name 'expect'.

@lathonez
Copy link
Owner

I'm unsure why it's trying to transpile anything in the e2e folder for me it only looks in src. A better solution would be adding e2e to the excludes array:

  "exclude": [
    "node_modules",
    "e2e"
  ],

Any idea why you'd see this and I wouldn't?

@SoldierCorp
Copy link

Same error here in Windows 10 with the .spec files in general.

@tja4472
Copy link
Contributor Author

tja4472 commented Oct 31, 2016

This works:

  "exclude": [
    "node_modules",
    "e2e",
    "**/*.spec.ts"    
  ],

@lathonez
Copy link
Owner

Exclude is definitely the correct option.

I'll put it in by default in the project's base tsconfig.json. Must be something around differences between file paths resolving across the OS.

@lathonez
Copy link
Owner

The fix we went with here caused #174

@lathonez
Copy link
Owner

I've reverted to using the types originally suggested. Let me know if this breaks things on windows: 0ae024b

@tja4472
Copy link
Contributor Author

tja4472 commented Nov 18, 2016

All good with Windows 10 👍

Did remove existing node_modules folder.

 ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.1
Xcode version: Not installed

npm: 4.02

@nebarf
Copy link

nebarf commented Dec 25, 2016

Same problem in the latest version with Ionic RC4

@nebarf
Copy link

nebarf commented Dec 25, 2016

It doesn't find type definition for jasmine:

> Clicker@2.5.0 start C:\Users\francesco\Desktop\clicker
> ionic serve


> Clicker@2.5.0 ionic:serve C:\Users\francesco\Desktop\clicker
> ionic-app-scripts serve

keywords if/then/else require v5 option
[23:10:12]  ionic-app-scripts 0.0.47
[23:10:21]  watch started ...
[23:10:21]  build dev started ...
[23:10:21]  clean started ...
[23:10:21]  clean finished in less than 1 ms
[23:10:21]  copy started ...
[23:10:21]  transpile started ...
[23:10:34]  transpile finished in 13.90 s
[23:10:34]  webpack started ...
[23:10:36]  copy finished in 15.87 s
[23:10:49]  webpack finished in 14.19 s
[23:10:49]  sass started ...
[23:10:52]  sass finished in 3.71 s
[23:10:52]  build dev finished in 31.88 s
[23:10:53]  watch ready in 32.26 s
[23:10:53]  dev server running: http://localhost:8100/

Terminare il processo batch (S/N)? S

C:\Users\francesco\Desktop\clicker>npm start

> Clicker@2.5.0 start C:\Users\francesco\Desktop\clicker
> ionic serve


> Clicker@2.5.0 ionic:serve C:\Users\francesco\Desktop\clicker
> ionic-app-scripts serve

keywords if/then/else require v5 option
[23:11:16]  ionic-app-scripts 0.0.47
[23:11:17]  watch started ...
[23:11:17]  build dev started ...
[23:11:17]  clean started ...
[23:11:17]  clean finished in 6 ms
[23:11:17]  copy started ...
[23:11:17]  transpile started ...
[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 7
            Cannot find name 'describe'.

       L7:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 9
desc[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 14 r
ib[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 15 e
('ClickerApp', () => {

            Cannot find name 'beforeEach'.

       L9:    b[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 18
ef[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 19
or[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 22 e
Ea[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 23
ch(() => {
[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 26       L10:
    instance = new ClickerApp((<any> new PlatformMock), (<any> new MenuMock));

            Cannot find name 'it'.

      L14:    [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 27 i
t('initialises with two possible pages', () => {
      L15:      expect(instance['pages'].length).toEqual(2);

            Cannot find name 'expect'.

[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 28
      L14:  it('initialises with two possible pages', () => {
      L15:    ex[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 30
pect(instance['pages'].length).toEqual(2);
      L16:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/app/app.spec.ts, line: 31 });

            Cannot find name 'it'.


      L18:    it('initialises with a root page', () => {
      L19:  [23:11:20]  typescript: ...ers/francesco/Desktop/clicker/src/components/clickerButton/clickerButton.spec.ts, line: 9     expect(instance['rootPage']).not.toBe(null);

            Cannot find name 'expect'.


      L18:  it('initialises with a root page', () => {
      L19:    expe[23:11:20]  typescript: ...ers/francesco/Desktop/clicker/src/components/clickerButton/clickerButton.spec.ts, line: 11 c
t(instance['rootPage']).not.toBe(null);
      L20:  [23:11:20]  typescript: ...ers/francesco/Desktop/clicker/src/components/clickerButton/clickerButton.spec.ts, line: 17 });

            Cannot find name 'it'.


      L22:    i[23:11:20]  typescript: ...ers/francesco/Desktop/clicker/src/components/clickerButton/clickerButton.spec.ts, line: 21
t('initialises with an app', () => {
      L23:  [23:11:20]  typescript: ...ers/francesco/Desktop/clicker/src/components/clickerButton/clickerButton.spec.ts, line: 22     expect(instance['app']).not.toBe(null);

            Cannot find name 'expect'.


      L22:  it('initialises with an app', () => {
      L23:  [23:11:20]  typescript: ...ers/francesco/Desktop/clicker/src/components/clickerButton/clickerButton.spec.ts, line: 25
  expect(instance['app']).not.toBe(null);
      L24:  });

            Cannot find name 'it'.

      L26:  [23:11:20]  typescript: ...ers/francesco/Desktop/clicker/src/components/clickerButton/clickerButton.spec.ts, line: 27
it('opens a page', () => {
      L27:      spyOn(instance['menu'], 'close');

            Cannot find name 'spyOn'.

      L26:  it('opens a page', () => {
      L27:    spyOn(instance['menu'], 'close');
      L28:    spyOn(instance['nav'], 'setRoot');

            Cannot find name 'spyOn'.

      L27:  spyOn(instance['menu'], 'close');
      L28:  spyOn(instance['nav'], 'setRoot');
      L29:  instance.openPage(instance['pages'][1]);

            Cannot find name 'expect'.

      L29:  instance.openPage(instance['pages'][1]);
      L30:  expect(instance['menu']['close']).toHaveBeenCalled();
      L31:  expect(instance['nav'].setRoot).toHaveBeenCalledWith(Page2);

            Cannot find name 'expect'.

      L30:    expect(instance['menu']['close']).toHaveBeenCalled();
      L31:    exp[23:11:20]  typescript: ...ers/francesco/Desktop/clicker/src/components/clickerButton/clickerButton.spec.ts, line: 30 e
ct(instance['nav'].setRoot).toHaveBeenCalledWith(Page2);
      L32:  });

            Cannot find name 'describe'.

[23:11:20]  typescript: ...ers/francesco/Desktop/clicker/src/components/clickerButton/clickerButton.spec.ts, line: 32        L9:
de[23:11:20]  typescript: ...ers/francesco/Desktop/clicker/src/components/clickerButton/clickerButton.spec.ts, line: 34
scr[23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 9 i
be[23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 11 ('ClickerButton', () => {

            Cannot find name 'beforeEach'.


      L11:    b[23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 19
ef[23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 23 o
re[23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 24 E
a[23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 25
ch[23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 28 (async(() => TestUtils.beforeEachCompiler([ClickerButton]).then(compiled => {

      L12:      fixture = compiled.fixture;

            Cannot find name 'afterEach'.

      L17:  [23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 31
aft[23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 32
erE[23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 35 a
ch(() => {
      L18:  [23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 36     fixture.destroy();

            Cannot find name 'it'.


      L21:    it('initialises', () => {
      L22:  [23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 39     expect(instance).not.toBeNull();

            Cannot find name 'expect'.


      L21:  it('initialises', () => {
      L22:    e[23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 40
xpe[23:11:20]  typescript: ...:/Users/francesco/Desktop/clicker/src/components/clickerForm/clickerForm.spec.ts, line: 42 c
t(instance).not.toBeNull();
      L23:  });

            Cannot find name 'it'.

[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/models/click.spec.ts, line: 5       L25:
  it('displays the clicker name and count', () => {
[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/models/click.spec.ts, line: 7       L26:
    fixture.detectChanges();

            Cannot find name 'expect'.

[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/models/click.spec.ts, line: 15
      L26:    fixture.detectChanges();
      L27:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/models/click.spec.ts, line: 16
expe[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/models/click.spec.ts, line: 19 c
t(fixture.nativeElement.querySelectorAll('.button-inner')[0].innerHTML).toEqual('TEST CLICKER (10)');
      L28:  });

            Cannot find name 'it'.

[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/models/click.spec.ts, line: 23       L30:
  it('does a click', () => {
      L31:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/models/click.spec.ts, line: 24     fixture.detectChanges();

            Cannot find name 'spyOn'.


      L31:  fixture.detectChanges();
      L32:  spyOn(instance['clickerService'], 'doClick');
[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/models/clicker.spec.ts, line: 5       L33:
TestUtils.eventFire(fixture.nativeElement.querySelectorAll('button')[0], 'click');

            Cannot find name 'expect'.

      L33:    TestUtils.eventFire(fixture.nativeElement.querySelectorAll('button')[0], 'click');
      L34:    e[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/models/clicker.spec.ts, line: 7 x
pect(instance['clickerService'].doClick).toHaveBeenCalled();
      L35:  });

            Cannot find name 'describe'.

       L9:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/models/clicker.spec.ts, line: 9 d
escr[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/pages/clickerList/clickerList.spec.ts, line: 9 i
be('ClickerForm', () => {

            Cannot find name 'beforeEach'.

      L11:    b[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/pages/clickerList/clickerList.spec.ts, line: 11
efor[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/pages/clickerList/clickerList.spec.ts, line: 17
eEa[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/pages/clickerList/clickerList.spec.ts, line: 21 c
h(async(() => TestUtils.beforeEachCompiler([ClickerForm]).then(compiled => {
      L12:      fixture = compiled.fixture;

            Cannot find name 'afterEach'.

[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/pages/clickerList/clickerList.spec.ts, line: 22       L19:
  aft[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/pages/page2/page2.spec.ts, line: 10
erE[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/pages/page2/page2.spec.ts, line: 13 a
ch(() => {
      L20:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/pages/page2/page2.spec.ts, line: 34     fixture.destroy();

            Cannot find name 'it'.


      L23:    it[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/pages/page2/page2.spec.ts, line: 38 ('initialises', () => {

      L24:      expect(fixture).not.toBeNull();

            Cannot find name 'expect'.

      L23:  it('initialises', () => {
      L24:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/pages/page2/page2.spec.ts, line: 39
exp[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/pages/page2/page2.spec.ts, line: 40 e
ct(fixture).not.toBeNull();
[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 7       L25:
  expect(instance).not.toBeNull();

            Cannot find name 'expect'.

      L24:    expect(fixture).not.toBeNull();
      L25:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 9
exp[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 11 e
ct(instance).not.toBeNull();
      L26:  });

            Cannot find name 'it'.

      L28:    it('passes new clicker through to service', () => {
      L29:      let clickerName: string = 'dave';

            Cannot find name 'spyOn'.

      L30:  instance.form = new FormBuilder().group({clickerNameInput: [clickerName]});
      L31:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 14
spyOn(instance, 'newClicker').and.callThrough();
      L32:  spyOn(instance['clickerService'], 'newClicker').and.callThrough();

            Cannot find name 'spyOn'.

      L31:  spyOn(instance, 'newClicker').and.callThrough();
[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 15       L32:
spyOn(instance['clickerService'], 'newClicker').and.callThrough();
      L33:  fixture.detectChanges();

            Cannot find name 'expect'.

      L34:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 18 fixture.nativeElement.querySelectorAll('button')[1].click();

      L35:  exp[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 21 e
ct(instance.newClicker).toHaveBeenCalledWith(Object({ clickerNameInput: clickerName }));
      L36:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 26 expect(instance['clickerService'].newClicker).toHaveBeenCalledWith(clickerName);

            Cannot find name 'expect'.


      L35:    expect(instance.newClicker).toHaveBeenCalledWith(Object({ clickerNameInput: clickerName }));
      L36:    e[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 29 x
pec[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 30 t
(instance['clickerService'].newClicker).toHaveBeenCalledWith(clickerName);
      L37:  });

            Cannot find name 'it'.

      L39:    [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 33 i
t('doesn\'t try to add a clicker with no name', () => {
      L40:      spyOn(instance['clickerService'], 'newClicker').and.callThrough();

            Cannot find name 'spyOn'.

[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 34       L39:
it('doesn\'t try to add a clicker with no name', () => {
      L40:    s[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 37 p
yOn[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 41 (instance['clickerService'], 'newClicker').and.callThrough();

      L41:    instance.newClicker({});

            Cannot find name 'expect'.

      L41:    instance.newClicker({});
      L42:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 41
exp[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 42 e
ct[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 47 (instance['clickerService'].newClicker).not.toHaveBeenCalled();

      L43:  });

            Cannot find name 'describe'.

       L5:  d[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 50 e
scrib[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 50
e('Click', () => {

            Cannot find name 'it'.

       L7:    it[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 53
('initialises with defaults', () => {
       L8:      let click: Click = new Click();

[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 57
[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 57
[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 59
            Cannot find name 'expect'.

[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 62       L15:
    e[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 65 x
pe[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 70 c
t(currentDateString).toEqual(defaultDateString);
      L16:      expect(click.getLocation()).toEqual('TODO');

            Cannot find name 'expect'.

      L15:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 73   expect(currentDateString).toEqual(defaultDateString);

      L16:    expect(click.getLocation()).toEqual('TODO');
      L17:  });

            Cannot find name 'it'.

      L19:    it('initialises with overrides', () => {
      L20:      let current: number = new Date().getTime();

            Cannot find name 'expect'.

      L22:  let click: Click = new Click(current, location);
      L23:  expect(click.getTime()).toEqual(current);
      L24:  expect(click.getLocation()).toEqual(location);

            Cannot find name 'expect'.

      L23:    expect(click.getTime()).toEqual(current);
[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 74       L24:
  ex[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 75 p
ec[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/clickers.spec.ts, line: 76 t
(click.getLocation()).toEqual(location);
      L25:  });

            Cannot find name 'describe'.

[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 6        L5:
de[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 8
sc[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 9 r
ib[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 11
e('Clicker', () => {

            Cannot find name 'it'.

       L7:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 12
it('initialises with the correct name', () => {
       L8:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 13     let clicker: Clicker = new Clicker('12434', 'testClicker');

            Cannot find name 'expect'.


       L8:    let clicker: Clicker = new Clicker('12434', 'testClicker');
       L9:    [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 16 e
xp[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 17 e
ct(clicker.getName()).toEqual('testClicker');
      L10:  [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 20 });

            Cannot find name 'describe'.


       L9:  de[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 22 s
cri[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 25 b
e('ClickerList', () => {

            Cannot find name 'beforeEach'.

      L11:    [23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 27 b
efo[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 30 r
eEa[23:11:20]  typescript: C:/Users/francesco/Desktop/clicker/src/services/storage.spec.ts, line: 32 c
h(async(() => TestUtils.beforeEachCompiler([ClickerList, ClickerForm, ClickerButton]).then(compil
      L12:      fixture = compiled.fixture;

            Cannot find name 'afterEach'.

      L17:  [23:11:20]  typescript error   a
fterEach(() => {
      L18:      fixture.destroy();

            Cannot find name 'it'.

      L21:    it('initialises', () => {
      L22:      expect(instance).toBeTruthy();

            Cannot find name 'expect'.

      L21:  it('initialises', () => {
      L22:    expect(instance).toBeTruthy();
      L23:  });

            Cannot find name 'describe'.

      L10:  describe('Pages: Page2', () => {

            Cannot find name 'beforeEach'.

      L12:    // demonstration on how to manually compile the test bed (as opposed to calling TestUtils)
      L13:    beforeEach(async(() => {

            Cannot find name 'afterEach'.

      L34:    afterEach(() => {
      L35:      fixture.destroy();

            Cannot find name 'it'.

      L38:    it('should create page2', () => {
      L39:      expect(fixture).toBeTruthy();

            Cannot find name 'expect'.

      L38:  it('should create page2', () => {
      L39:    expect(fixture).toBeTruthy();
      L40:    expect(instance).toBeTruthy();

            Cannot find name 'expect'.

      L39:    expect(fixture).toBeTruthy();
      L40:    expect(instance).toBeTruthy();
      L41:  });

            Cannot find name 'describe'.

       L7:  describe('ClickersService', () => {

            Cannot find name 'beforeEach'.

       L9:    beforeEach(() => {
      L10:      clickers = new ClickersService(<any>new StorageMock());

            Cannot find name 'spyOn'.

      L10:    clickers = new ClickersService(<any>new StorageMock());
      L11:    spyOn(clickers['storage'], 'set').and.callThrough();
      L12:  });

            Cannot find name 'it'.

      L14:    it('initialises', () => {
      L15:      expect(clickers).not.toBeNull();

            Cannot find name 'expect'.

      L14:  it('initialises', () => {
      L15:    expect(clickers).not.toBeNull();
      L16:  });

            Cannot find name 'it'.

      L18:    it('initialises with clickers from mock storage', (done: Function) => {
      L19:      clickers['init']()

            Cannot find name 'expect'.

      L20:  .then(() => {
      L21:    expect(clickers.getClickers().length).toEqual(StorageMock.CLICKER_IDS.length);
      L22:    done();

            Cannot find name 'it'.

      L26:    it('can initialise a clicker from string', () => {
      L27:      let clickerString: string = '{"id":"0g2vt8qtlm","name":"harold","clicks":[{"time":1450410168819,"location":"TODO"},{"time":1450410168945,"location":"TODO"}]}';

            Cannot find name 'expect'.

      L28:  let clicker: Clicker = clickers['initClicker'](clickerString);
      L29:  expect(clicker.getName()).toEqual('harold');
      L30:  expect(clicker.getCount()).toEqual(2);

            Cannot find name 'expect'.

      L29:    expect(clicker.getName()).toEqual('harold');
      L30:    expect(clicker.getCount()).toEqual(2);
      L31:  });

            Cannot find name 'it'.

      L33:    it('returns undefined for a bad id', () => {
      L34:      expect(clickers.getClicker('dave')).not.toBeDefined();

            Cannot find name 'expect'.

      L33:  it('returns undefined for a bad id', () => {
      L34:    expec[23:11:20]  build dev failed: Cannot read property 'replace' of null t
(clickers.getClicker('dave')).not.toBeDefined();
      L35:  });

            Cannot find name 'it'.

      L37:    it('adds a new clicker with the correct name', (done: Function) => {
      L38:      clickers['init']()

            Cannot find name 'expect'.

      L40:  let idAdded: string = clickers.newClicker('dave');
      L41:  expect(clickers['storage'].set).toHaveBeenCalledWith(idAdded, jasmine.any(String));
      L42:  expect(clickers.getClickers()[3].getName()).toEqual('dave');

            Cannot find name 'jasmine'.

      L40:  let idAdded: string = clickers.newClicker('dave');
      L41:  expect(clickers['storage'].set).toHaveBeenCalledWith(idAdded, jasmine.any(String));
      L42:  expect(clickers.getClickers()[3].getName()).toEqual('dave');

            Cannot find name 'expect'.

      L41:  expect(clickers['storage'].set).toHaveBeenCalledWith(idAdded, jasmine.any(String));
      L42:  expect(clickers.getClickers()[3].getName()).toEqual('dave');
      L43:  done();

            Cannot find name 'it'.

      L47:    it('removes a clicker by id', () => {
      L48:      let idToRemove: string = clickers.newClicker('dave');

            Cannot find name 'expect'.

      L49:    clickers.removeClicker(idToRemove);
      L50:    expect(clickers['storage'].set).toHaveBeenCalledWith(idToRemove, jasmine.any(String));
      L51:  });

            Cannot find name 'jasmine'.

      L49:    clickers.removeClicker(idToRemove);
      L50:    expect(clickers['storage'].set).toHaveBeenCalledWith(idToRemove, jasmine.any(String));
      L51:  });

            Cannot find name 'it'.

      L53:    it('does a click', () => {
      L54:      let idToClick: string = clickers.newClicker('dave');

            Cannot find name 'expect'.

      L56:  clickers.doClick(idToClick);
      L57:  expect(clickers['storage'].set).toHaveBeenCalledWith(idToClick, jasmine.any(String));
      L58:  clickedClicker = clickers.getClicker(idToClick);

            Cannot find name 'jasmine'.

      L56:  clickers.doClick(idToClick);
      L57:  expect(clickers['storage'].set).toHaveBeenCalledWith(idToClick, jasmine.any(String));
      L58:  clickedClicker = clickers.getClicker(idToClick);

            Cannot find name 'expect'.

      L58:    clickedClicker = clickers.getClicker(idToClick);
      L59:    expect(clickedClicker.getCount()).toEqual(1);
      L60:  });

            Cannot find name 'it'.

      L62:    it('loads IDs from storage', (done: Function) => {
      L63:      clickers['initIds']()

            Cannot find name 'expect'.

      L64:  .then((ids: Array<string>) => {
      L65:    expect(ids).toEqual(StorageMock.CLICKER_IDS);
      L66:    done();

            Cannot find name 'it'.

      L70:    it('loads clickers from storage', (done: Function) => {
      L71:      clickers['initClickers'](StorageMock.CLICKER_IDS)

            Cannot find name 'expect'.

      L72:  .then((resolvedClickers: Array<Clicker>) => {
      L73:    expect(resolvedClickers.length).toEqual(3);
      L74:    expect(resolvedClickers[0].getId()).toEqual(StorageMock.CLICKER_IDS[0]);

            Cannot find name 'expect'.

      L73:  expect(resolvedClickers.length).toEqual(3);
      L74:  expect(resolvedClickers[0].getId()).toEqual(StorageMock.CLICKER_IDS[0]);
      L75:  expect(resolvedClickers[1].getId()).toEqual(StorageMock.CLICKER_IDS[1]);

            Cannot find name 'expect'.

      L74:  expect(resolvedClickers[0].getId()).toEqual(StorageMock.CLICKER_IDS[0]);
      L75:  expect(resolvedClickers[1].getId()).toEqual(StorageMock.CLICKER_IDS[1]);
      L76:  expect(resolvedClickers[2].getId()).toEqual(StorageMock.CLICKER_IDS[2]);

            Cannot find name 'expect'.

      L75:  expect(resolvedClickers[1].getId()).toEqual(StorageMock.CLICKER_IDS[1]);
      L76:  expect(resolvedClickers[2].getId()).toEqual(StorageMock.CLICKER_IDS[2]);
      L77:  done();

            Cannot find name 'describe'.

       L6:  describe('StorageService', () => {

            Cannot find name 'beforeEach'.

       L8:    beforeEach(() => {
       L9:      spyOn(StorageService, 'initStorage').and.returnValue(new StorageMock());

            Cannot find name 'spyOn'.

       L8:  beforeEach(() => {
       L9:    spyOn(StorageService, 'initStorage').and.returnValue(new StorageMock());
      L10:    storage = new StorageService();

            Cannot find name 'spyOn'.

      L10:  storage = new StorageService();
      L11:  spyOn(storage['storage'], 'get').and.callThrough();
      L12:  spyOn(storage['storage'], 'set').and.callThrough();

            Cannot find name 'spyOn'.

      L11:  spyOn(storage['storage'], 'get').and.callThrough();
      L12:  spyOn(storage['storage'], 'set').and.callThrough();
      L13:  spyOn(storage['storage'], 'remove').and.callThrough();

            Cannot find name 'spyOn'.

      L12:    spyOn(storage['storage'], 'set').and.callThrough();
      L13:    spyOn(storage['storage'], 'remove').and.callThrough();
      L14:  });

            Cannot find name 'it'.

      L16:    it('initialises', () => {
      L17:      expect(storage).not.toBeNull();

            Cannot find name 'expect'.

      L16:  it('initialises', () => {
      L17:    expect(storage).not.toBeNull();
      L18:  });

            Cannot find name 'it'.

      L20:    it('gets', () => {
      L21:      storage.get('dave');

            Cannot find name 'expect'.

      L21:    storage.get('dave');
      L22:    expect(storage['storage'].get).toHaveBeenCalledWith('dave');
      L23:  });

            Cannot find name 'it'.

      L25:    it('sets', () => {
      L26:      storage.set('dave', 'test');

            Cannot find name 'expect'.

      L26:    storage.set('dave', 'test');
      L27:    expect(storage['storage'].set).toHaveBeenCalledWith('dave', 'test');
      L28:  });

            Cannot find name 'it'.

      L30:    it('removes', () => {
      L31:      storage.remove('dave');

            Cannot find name 'expect'.

      L31:    storage.remove('dave');
      L32:    expect(storage['storage'].remove).toHaveBeenCalledWith('dave');
      L33:  });

            Cannot find type definition file for 'jasmine'.

[23:11:20]  dev server running: http://localhost:8100/

[23:11:20]  copy finished in 3.42 s
[23:11:20]  watch ready in 3.45 s

@tja4472
Copy link
Contributor Author

tja4472 commented Dec 26, 2016

Hi @frabnt

Reverting to typescript 2.0.10 worked for me.

  "devDependencies": {
    "@ionic/app-scripts": "0.0.48",
    "@types/jasmine": "2.5.38",
    "@types/node": "6.0.42",
    "angular-cli": "1.0.0-beta.24",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.7.0",
    "karma": "1.3.0",
    "karma-chrome-launcher": "2.0.0",
    "karma-cli": "1.0.1",
    "karma-jasmine": "1.1.0",
    "karma-mocha-reporter": "2.2.1",
    "karma-remap-istanbul": "0.2.2",
    "protractor": "4.0.13",
    "protractor-jasmine2-screenshot-reporter": "0.3.2",
    "ts-node": "1.7.2",
    "tslint": "4.1.1",
    "tslint-eslint-rules": "3.2.0",
    "typescript": "2.0.10"
  },

ionic info

 ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.48
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.2
Xcode version: Not installed

npm 4.0.5

hth
Tim

@lathonez
Copy link
Owner

Thanks Tim, I noticed this on appveyor, but I'm still a long way away from being able to debug anything on Windows.

Will downgrade as suggested and put a build command into appveyor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants