0.0.34 • Published 7 years ago

rachnerd-test-plugin v0.0.34

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

nativescript-angular-unit-tests

This module helps to maintain the angular style guide folder structure for {N} + Angular projects.

This plugin:

  • Watches all generated js spec
  • Copies all generated js spec files to a .tmp folder inside app/tests
  • Fixes require paths to target original source.
  • Runs "tns test platform" in parallel.

Install

npm i --save-dev nativescript-angular-unit-tests

Add a script to your project's package.json and call 'tns-test-angular'.

{
  "scripts": {
    "test.android": "tns-test-angular --platform=android",
    "test.ios": "tns-test-angular --platform=ios"
  }
}

Karma setup example

{
    ...
    files: [
        'app/tests/config.js',
        'app/tests/.tmp/**/*.js'
    ],
    ...
}
// app/tests/config.ts
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
import { NS_COMPILER_PROVIDERS } from 'nativescript-angular/platform';
import { TestBed } from '@angular/core/testing';

TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(NS_COMPILER_PROVIDERS));

Flags

Running a specific spec

|- /app
|   - /login
|       _ login.component.ts
|       _ login.component.spec.ts
|       - login.service.ts
|       - login.servic.spec.ts
|   - app.component.ts
|   - app.component.spec.ts
npm run test.android -- --spec=login.service 
|- /app
|   - /tests
|       - /.tmp
|           - /login
|               login.service.spec.js

Running multiple specs

|-- app
|   |-- login
|   |   |-- shared
|   |   |   |-- login.service.ts
|   |   |   |-- login.service.spec.ts
|   |   |-- login.component.css
|   |   |-- login.component.html
|   |   |-- login.component.ts
|   |   |-- login.component.spec.ts
|   |-- app.component.ts
|   |-- app.component.spec.ts
npm run test.android -- --spec=login 
|-- app
|   |-- tests
|   |   |-- .tmp
|   |   |   |-- login
|   |   |   |   |-- shared
|   |   |   |   |   |-- login.service.spec.js
|   |   |   |   |-- login.component.spec.js
0.0.34

7 years ago

0.0.33

7 years ago

0.0.32

7 years ago

0.0.31

7 years ago

0.0.30

7 years ago

0.0.29

7 years ago

0.0.28

7 years ago

0.0.27

7 years ago

0.0.26

7 years ago

0.0.24

7 years ago

0.0.23

7 years ago

0.0.22

7 years ago

0.0.21

7 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago