0.0.34 • Published 8 years ago

rachnerd-test-plugin v0.0.34

Weekly downloads
4
License
MIT
Repository
github
Last release
8 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

8 years ago

0.0.33

8 years ago

0.0.32

8 years ago

0.0.31

8 years ago

0.0.30

8 years ago

0.0.29

8 years ago

0.0.28

8 years ago

0.0.27

8 years ago

0.0.26

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago