Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //package.json
- "scripts": {
- "clean": "ionic-app-scripts clean",
- "build": "ionic-app-scripts build",
- "serve": "ionic-app-scripts serve",
- "ionic:build": "ionic-app-scripts build",
- "ionic:serve": "ionic-app-scripts serve",
- "test": "karma start karma.conf.js"
- },
- "dependencies": {
- "@angular/animations": "4.0.3",
- "@angular/common": "2.4.10",
- "@angular/compiler": "2.4.10",
- "@angular/core": "2.4.10",
- "@angular/flex-layout": "2.0.0-beta.5",
- "@angular/forms": "2.4.10",
- "@angular/http": "2.4.10",
- "@angular/material": "2.0.0-beta.2",
- "@angular/platform-browser": "2.4.10",
- "@angular/platform-browser-dynamic": "2.4.10",
- "@angular/router": "3.4.10",
- "@types/c3": "^0.4.39",
- "angular-hammer": "^2.2.0",
- "angular2-mqtt": "^1.7.1",
- "c3": "^0.4.11",
- "core-js": "^2.4.1",
- "d3": "^3.5.17",
- "karma": "^1.7.0",
- "karma-chrome-launcher": "^2.1.1",
- "karma-jasmine": "^1.1.0",
- "rxjs": "^5.1.0",
- "sw-toolbox": "^3.6.0",
- "zone.js": "^0.7.7"
- },
- "devDependencies": {
- "@angular/compiler-cli": "2.4.10",
- "@ionic/app-scripts": "1.1.4",
- "@types/c3": "^0.4.39",
- "@types/jasmine": "^2.5.47",
- "c3": "^0.4.11",
- "jasmine-core": "^2.6.2",
- "karma": "^1.7.0",
- "typescript": "2.2.2"
- }
- My project structure
- myproject
- -src
- -app
- -01-fundamentals
- -compute.ts
- -compute.spec.ts
- -karma.conf.js
- //compute.spec.ts
- import {compute} from './compute';
- describe('compute',() => {
- it('should return 0 if input is negative', () => {
- const result= compute(-1);
- expect(result).toBe(0);
- })
- })
- //karma.conf.js
- module.exports = function(config) {
- config.set({
- basePath: '',
- frameworks: ['jasmine'],
- files: ["src/app/**/*.spec.ts"
- ],
- exclude: [
- ],
- preprocessors: {
- },
- reporters: ['progress'],
- port: 9876,
- colors: true,
- logLevel: config.LOG_DEBUG,
- autoWatch: true,
- browsers: ['Chrome'],
- singleRun: false,
- concurrency: Infinity,
- plugins: [ 'karma-jasmine', 'karma-chrome-launcher'],
- mime: {
- 'text/x-typescript': ['ts','tsx']
- },
- })
- }
- ng test --sm=false
Add Comment
Please, Sign In to add comment