thepassle / create-lit-app

Create LitHTML apps with no build configuration. (LitHTML/Redux/Webpack/Express)
https://create-lit-app.herokuapp.com
110 stars 10 forks source link

Set up karma for typescript branch #10

Closed thepassle closed 6 years ago

thepassle commented 6 years ago

I've implemented a typescript branch, that I want to set up Karma for. Due to lack of experience with karma/typescript, I could use a hand. I'm using a basic setup from karma-typescript

Currently this results in:

19 10 2018 15:16:16.863:INFO [compiler.karma-typescript]: Compiling project using Typescript 3.1.3
19 10 2018 15:16:19.943:ERROR [compiler.karma-typescript]: error TS2468: Cannot find global value 'Promise'.

19 10 2018 15:16:19.944:ERROR [compiler.karma-typescript]: node_modules/@polymer/lit-element/lib/updating-element.d.ts(76,38): error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.

19 10 2018 15:16:19.944:ERROR [compiler.karma-typescript]: node_modules/lit-html/lib/render.d.ts(17,29): error TS2583: Cannot find name 'WeakMap'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 orlater.

19 10 2018 15:16:19.945:ERROR [compiler.karma-typescript]: node_modules/lit-html/lib/template-factory.d.ts(42,38): errorTS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.

19 10 2018 15:16:19.945:ERROR [compiler.karma-typescript]: node_modules/lit-html/lib/template-factory.d.ts(42,50): errorTS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.

19 10 2018 15:16:19.946:ERROR [compiler.karma-typescript]: node_modules/lit-html/lib/template-instance.d.ts(32,11): error TS2300: Duplicate identifier 'CustomElementRegistry'.

19 10 2018 15:16:19.946:ERROR [compiler.karma-typescript]: node_modules/typescript/lib/lib.dom.d.ts(3286,11): error TS2300: Duplicate identifier 'CustomElementRegistry'.

19 10 2018 15:16:19.947:ERROR [compiler.karma-typescript]: node_modules/typescript/lib/lib.dom.d.ts(3293,13): error TS2300: Duplicate identifier 'CustomElementRegistry'.

19 10 2018 15:16:19.947:ERROR [compiler.karma-typescript]: src/lit-app.ts(2,24): error TS2691: An import path cannot endwith a '.ts' extension. Consider importing './styles' instead.

19 10 2018 15:16:19.947:ERROR [compiler.karma-typescript]: test/hello-world.spec.ts(6,1): error TS2582: Cannot find name'describe'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`.

19 10 2018 15:16:19.947:ERROR [compiler.karma-typescript]: test/hello-world.spec.ts(13,3): error TS2304: Cannot find name 'beforeEach'.

19 10 2018 15:16:19.948:ERROR [compiler.karma-typescript]: test/hello-world.spec.ts(13,14): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor.  Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.

19 10 2018 15:16:19.948:ERROR [compiler.karma-typescript]: test/hello-world.spec.ts(21,3): error TS2304: Cannot find name 'afterEach'.

19 10 2018 15:16:19.949:ERROR [compiler.karma-typescript]: test/hello-world.spec.ts(25,3): error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`.

19 10 2018 15:16:19.949:ERROR [compiler.karma-typescript]: test/index.ts(1,30): error TS2339: Property 'context' does not exist on type 'NodeRequire'.

If anyone is more experienced with typescript and karma, i'd love to have a helping hand :)

I'll be diving into this more this weekend.

ZelphirKaltstahl commented 5 years ago

And the solution or reason for closing was?

thepassle commented 5 years ago

Fixed it, and tests run in the typescript branch: https://github.com/thepassle/create-lit-app/tree/typescript