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.

The test init command to add a sample test in TypeScript for TypeScript/Angular projects

See original GitHub issue

The tns test init command configures a project for unit testing, creates a tests folder in the app directory and adds an example.js file in it with a sample test.

It would be great the sample test to be in TypeScript (example.ts) for TypeScript/Angular projects.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:26
  • Comments:26 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
Oatelauscommented, Nov 9, 2018

In a project of entirely typescript files, it seems backwards to write JavaScript tests. Is there any update to this, or is anyone aware of how to get my tests compiled along with tns test <platform>?

Adding karma-typescript to the karma.conf.js causes issues (Javascript running out of memory, tsconfig related conflicts, generally seems to be the wrong way to achieve this) - I can’t seem to figure out how other people are writing tests in typescript (example: nativescript-angular’s tests are all in typescript)

2reactions
cowboydcommented, Mar 27, 2019

This worked, but the test init command put the files in src/tests/, so we made this line in the karma.conf.js src/tests/**/*.ts

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing unit tests in TypeScript - Chirag Rupani - Medium
Basically, it is installation of npm packages for TypeScript, Test framework (e.g. Jasmine/Mocha/Jest) and specifying test script required to execute test cases ...
Read more >
Testing - Angular
The Angular CLI downloads and installs everything you need to test an Angular application with Jasmine testing framework. ... The ng test command...
Read more >
Angular unit testing tutorial with examples - LogRocket Blog
This tutorial demonstrates how to build an Angular app and write a unit test, test an async operator, and automatically generate a unit ......
Read more >
How to Set Up Angular Unit Testing with Jest - Amadou Sall
Create the jest.config.js file at the root of your project · look for .spec. · read our TypeScript configuration file tsconfig. · compile...
Read more >
TypeScript Unit Testing 101: A Developer's Guide - Testim.io
TypeScript Unit Testing: A Practical Example · Installing the TypeScript Compiler · Creating the Basic Folder Structure for the Project · Adding ......
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