https://github.com/juandelgadillo/nativescript-tests-hook
Nativescript plugin that lets you handling your Nativescript tests like the angular style guide
https://github.com/juandelgadillo/nativescript-tests-hook
nativescript-plugin nativescript-tests
Last synced: 9 months ago
JSON representation
Nativescript plugin that lets you handling your Nativescript tests like the angular style guide
- Host: GitHub
- URL: https://github.com/juandelgadillo/nativescript-tests-hook
- Owner: JuanDelgadillo
- Created: 2016-12-24T05:41:07.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-02-21T03:56:54.000Z (over 7 years ago)
- Last Synced: 2025-02-01T01:26:13.801Z (over 1 year ago)
- Topics: nativescript-plugin, nativescript-tests
- Language: JavaScript
- Size: 1.95 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nativescript tests hook
Nativescript plugin that lets you handling your Nativescript tests like the angular style guide
Nativescript is configured by default to let you put all your tests into `tests` folder but sometimes it can be a little annoying, as apps grow in size and components, having unit-tests next to implementations makes easier maintaining these tests, when we do development for web version of angular application, we put the test files in respective feature folders with `.spec.ts` or `.spec.js` suffix as per the angular style guide.
### Example
~~~
app
|-- myFeature
|- myFeature.component.html
|- myFeature.component.ts
|- myFeature.component.spec.ts
~~~
Just keep your `.spec.ts` or `.spec.js` files next to implementations and that's it. It moves all your tests from wherever they are into `app` to `tests` folder at tns' before-prepare hook time.
## Installation
### Npm
```bash
npm install nativescript-tests-hook --save-dev
```
## Configuration
The only thing you need to be aware of is when importing file dependencies in your tests you have to reference them as loading files from the app bundle according to [Nativescript's Location Rules Docs](https://docs.nativescript.org/runtimes/require#loading-files-from-the-app-bundle) to keep their references when they will move.
### Example
```typescript
import { MyFeatureComponent } from '~/myFeature/myFeature.component';
import { AppComponent } from '~/app.component';
```