Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

"gulp test" fails with typescript skeleton #823

Closed
pranuel opened this issue May 4, 2017 · 13 comments
Closed

"gulp test" fails with typescript skeleton #823

pranuel opened this issue May 4, 2017 · 13 comments
Assignees
Labels

Comments

@pranuel
Copy link

pranuel commented May 4, 2017

I'm submitting a bug report

  • Aurelia Skeleton Version
    skeleton-typescript

  • Framework Version:
    1.1.2

My environment:

  • Operating System:
    Windows 10 64-bit

  • Node Version:
    6.9.1

  • NPM Version:
    3.10.8

  • JSPM Version
    JSPM 0.16.53

  • Browser:
    Chrome 58.0.3029.96 (64-bit)

  • Language:
    TypeScript 2.2.2

Current behavior:
When executing "gulp test" Karma starts a new instance of Google Chrome, connects on a new socket and then fails with the message "Disconnected (1 times), because no message in 10000ms. [...]".

Expected/desired behavior:
All included tests should be executed.

@niieani
Copy link
Contributor

niieani commented May 7, 2017

CC: @AshleyGrant

@AshleyGrant AshleyGrant self-assigned this May 7, 2017
@pranuel
Copy link
Author

pranuel commented May 10, 2017

Ok, seems like I figured it out: With the typescript package at version 2.2.2 it works on my machines (Mac, Linux, Windows).
For now, I will fix the version of the typescript package in my package.json to version 2.2.2.

@niieani
Copy link
Contributor

niieani commented May 14, 2017

@EisenbergEffect this is not fixed yet. Testing the TypeScript + JSPM skeleton is broken in master.

@plwalters
Copy link
Contributor

Can confirm hitting this as well let me see if I can push a PR up.

@plwalters
Copy link
Contributor

Verified locking version of TypeScript works.

@rockResolve
Copy link
Contributor

This affects skeleton-typescript-aspnetcore too.

However in my testing the Typescript breaking version is 2.3.1.
I tested skeleton-typescript and got the same results - every version up to 2.3.0 (including 2.2.2)
worked, but 2.3.1 broke

FYI It was an Import statement that triggered the break, a single console.log statement worked.

Fix skeleton package.json with devDependencies.typescript: "2.3.0",
Fix existing project with: npm install [email protected] --save-exact --save-dev

@niieani
Copy link
Contributor

niieani commented Jun 15, 2017

@rockResolve can you point us to the problematic import statement? We'd really appreciate a PR too :)

@rockResolve
Copy link
Contributor

The very first import: in setup.ts import 'aurelia-polyfills';

I traced the modules going through karma-systemjs adapter.js parallelImportFiles.
The System.import promises did not resolve.
Not quite sure who to raise an issue with: SystemJs?

For PR would you go to 2.3.0 (ie. without the remaining 2.3 patches) or 2.2.2 (fully patched)

@timfish
Copy link

timfish commented Jun 23, 2017

I've just ended up here after trying to work out why tests no longer run since updating to [email protected].
So the typescript skeletons are going to forever be on [email protected] 😆 ?

Where does an upstream bug need opening?

WORK AROUND

It looks like the SystemJS ES6 module detection is picking up some comments in the 2.3.1+ source so you can override the meta in systemjs section in karma.conf.js with:

meta: {
  typescript: {
    format: 'global'
  }
}

@hgross
Copy link

hgross commented Jul 18, 2017

Thanks @timfish. The workaround worked for me. I don't understand how fixing the ts version to 2.2 can be considered a "fix" or closes this bug?

@plwalters
Copy link
Contributor

This is not a bug with Aurelia. This is a bug in another library, most likely karma-systemjs.

That library is calling for maintainers and not updating at the moment. https://github.com/rolaveric/karma-systemjs/issues

Unfortunately for us this means that locking the version of TypeScript until an alternative solution closes this bug. If anyone would like to explore fixes on their own or move to maintain the karma-systemjs library or at least get it working with latest TypeScript please feel free but for now let's leave this closed as it is not furthering the discussion on the issue.

@rockResolve
Copy link
Contributor

rockResolve commented Nov 4, 2017

The @timfish solution only partially worked for me.
As stated the root problem is SystemJs cant work out what format the typescript.js source is. So we have to explicitly set the format. In addition I found explicitly setting the format stops SystemJs defaulting the typescript exports (which caused it to attempt a faulty transform) , so we have to set exports too.

In karma.conf.js

config: {
    ...
    systemjs: {
        ...
        config: {
            meta: {
               "*/node_modules/typescript/lib/typescript.js": {
                    format: 'global',
                    exports: 'ts'
               }
           }
       paths: {
            ...
            "typescript": "node_modules/typescript/lib/typescript.js"
       }

Not sure I would describe it as a workaround: SystemJs does not claim it's module detection will always work - its just fortunate it has up until Typescript version 2.3.0. See https://github.com/systemjs/systemjs/blob/master/docs/module-formats.md#module-format-detection
In which case the project's karma.conf.js should be edited.

PR created

@gursharan001
Copy link

Hello, we ran across the same issue. Here is a reference link to why this fails since version 2.3.1 - systemjs/builder#828. Solution is to use plugin-typescript. I am happy to submit a pull request.

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

No branches or pull requests

9 participants