NativeScript / NativeScript/nativescript-cli

Feature Request: Provision to put test files in feature folder instead of tests folder

Open
#2,095 5 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature unit testing
Dominant language
JavaScript
Stars
1.1k
Forks
204
Avg merge
1d 9h
Merged PRs (30d)
8

Description

From @shripalsoni04 on September 30, 2016 15:2

It will be great if we can put our test files in the respective feature folder instead of putting all the test files in app/tests folder.

When we do development for web version of angular application, we put the test files in respective feature folders with .spec.ts suffix as per the angular style guide.

If we can do the same thing in angularNative app also, it will be very easy to get started and it will open a way for unit-test code sharing. As currently we have different structures for test files in nativescript and web version, we cannot share the unit-test files easily and we need to manually copy the unit-test files and change the import path of the module being tested in test file for any cross platform shared code.

I thought to run a script which copies all the .spec.ts file to tests folder from feature folders, but then it will add complexities like adding new/changed test files back to app/tests folder in watch mode.

Let me know if there is already some way and I am missing that.

Thanks.

Copied from original issue: NativeScript/nativescript-angular#482

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating how the CLI currently discovers and handles test files under app/tests, including watch-mode behavior. Compare that flow with the requested .spec.ts files in feature folders and determine the expected behavior for shared tests; done means feature-local tests are supported without manual copying.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
cli, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.