question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Testing Typscript

See original GitHub issue

Hey, I love how easy this was all to set up. Converting to typescript was even a breeze for the most part.

However, I can’t seem to get karma working with my typescript. I’ve tried configuring karma-typescript myself but have failed for the last few hours.

I would really like to see some docs for setting up tests for typescript. The docs are great in most other places, but lack here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:25 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
LarsDenBakkercommented, Jul 5, 2019

I share your feeling of not wanting to use webpack or any bundler during development/testing. That’s a primary goal for us as well. The core problem is that for many tools running code unbundled does not work out of the box. So while things work just fine when you run it in the browser, it doesn’t when you use some tools.

The problem with karma is that it doesn’t serve any files it didn’t know about beforehand. Because we want to use the module loader of the browser, we can’t and shouldn’t know the dependency tree beforehand.

It took quite some effort getting this to work, but we did it with karma-esm. Unfortunately this has the side effect of not running the karma preprocessors since we’re bypassing karma for serving files.

So to summarize:

  • There is a solution for running karma with native modules (our karma-esm plugin)
  • There is a solution for running karma with typescript (karma typescript preprocessor, karma webpack etc.)

But they don’t both work together yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript Unit Testing 101: A Developer's Guide - Testim.io
TypeScript unit testing is a bit more involved than testing regular JavaScript, but it's just as vital. Learn more about it in this...
Read more >
Unit testing JavaScript and TypeScript - Visual Studio (Windows)
In most TypeScript scenarios, you can debug a unit test by setting a breakpoint in TypeScript code, right-clicking a test in Test Explorer,...
Read more >
How to Test TypeScript with Jest - Medium
In this post, I will show the necessary steps to test your TypeScript code using a popular JavaScript testing framework Jest and also ......
Read more >
Testing TypeScript apps using Jest - LogRocket Blog
Jest is a simple, lightweight testing framework that provides a variety of testing capabilities to JavaScript and TypeScript projects. It ...
Read more >
Writing Well-Structured Unit Test in TypeScript
The purpose of this post is to discover the implementation of writing unit test using Jest, a... Tagged with typescript, testing, javascript ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found