Skip to content

Commit

Permalink
refactor: migrate to jest (#62)
Browse files Browse the repository at this point in the history
* build(npm): update npm scripts, deps

* build(webpack): remove webpack test config

* refactor: migrate test config to `jest`

* refactor: centralize tsconfig

* docs: add jest badge to README

* refactor(core): refactor `jest` migration
  • Loading branch information
Burak Tasci authored and Burak Tasci committed Sep 4, 2017
1 parent bd19342 commit 0819458
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 281 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Dynamic page title & meta tags generator for **Angular**
[![Linux build](https://travis-ci.org/fulls1z3/ngx-meta.svg?branch=master)](https://travis-ci.org/fulls1z3/ngx-meta)
[![Windows build](https://ci.appveyor.com/api/projects/status/github/fulls1z3/ngx-meta?branch=master&svg=true)](https://ci.appveyor.com/project/fulls1z3/ngx-meta)
[![coverage](https://codecov.io/github/fulls1z3/ngx-meta/coverage.svg?branch=master)](https://codecov.io/gh/fulls1z3/ngx-meta)
[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)
[![Angular Style Guide](https://mgechev.github.io/angular2-style-guide/images/badge.svg)](https://angular.io/styleguide)

> Please support this project by simply putting a Github star. Share this library with friends on Twitter and everywhere else you can.
Expand Down
88 changes: 0 additions & 88 deletions config/webpack.test.js

This file was deleted.

37 changes: 24 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,22 @@
"clean": "gulp clean --color",
"lint": "gulp tslint --color",
"make": "gulp make --color",
"test": "gulp test --color"
"test": "jest --runInBand --colors"
},
"devDependencies": {
"@angular/common": "~4.3.0",
"@angular/compiler": "~4.3.0",
"@angular/compiler-cli": "~4.3.0",
"@angular/core": "~4.3.0",
"@angular/platform-browser": "~4.3.0",
"@angular/platform-browser-dynamic": "~4.3.0",
"@angular/router": "~4.3.0",
"core-js": "^2.5.0",
"rxjs": "^5.4.3",
"zone.js": "^0.8.17",
"@types/jasmine": "^2.5.54",
"lodash": "^4.17.4",
"@types/lodash": "4.14.55",
"@types/jest": "^20.0.8",
"gulp": "gulpjs/gulp#4.0",
"gulp-load-plugins": "^1.5.0",
"rimraf": "^2.6.1",
Expand All @@ -41,20 +44,28 @@
"webpack": "^3.5.5",
"tslint-loader": "^3.5.3",
"awesome-typescript-loader": "^3.2.3",
"jasmine-core": "^2.8.0",
"karma": "^1.7.1",
"karma-jasmine": "^1.1.0",
"karma-coverage": "^1.1.1",
"karma-mocha-reporter": "^2.2.4",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.4",
"karma-chrome-launcher": "^2.2.0",
"source-map-loader": "^0.2.1",
"istanbul-instrumenter-loader": "^3.0.0",
"jest": "^20.0.4",
"jest-preset-angular": "^2.0.5",
"codelyzer": "^3.1.2",
"tslint": "~5.7.0",
"angular-tslint-rules": "^1.0.4",
"typescript": "~2.3.4"
},
"jest": {
"preset": "jest-preset-angular",
"setupTestFrameworkScriptFile": "./config/jest.setup.ts",
"globals": {
"ts-jest": {
"tsConfigFile": "./tsconfig.json"
},
"__TRANSFORM_HTML__": true
},
"cache": false,
"noStackTrace": true,
"silent": true,
"collectCoverage": true,
"collectCoverageFrom": [
"packages/@ngx-meta/core/src/**.ts"
]
}
}
51 changes: 0 additions & 51 deletions packages/@ngx-meta/core/config/karma.conf.js

This file was deleted.

28 changes: 0 additions & 28 deletions packages/@ngx-meta/core/config/spec-bundle.js

This file was deleted.

File renamed without changes.
10 changes: 4 additions & 6 deletions packages/@ngx-meta/core/tests/meta.loader.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// angular
import { getTestBed } from '@angular/core/testing';
import { TestBed } from '@angular/core/testing';

// module
import { MetaLoader, MetaService, MetaSettings, MetaStaticLoader } from '../index';
import { defaultSettings, emptySettings, testModuleConfig, testSettings } from './index.spec';
import { defaultSettings, emptySettings, testModuleConfig, testSettings } from './common';

describe('@ngx-meta/core:',
() => {
Expand Down Expand Up @@ -35,8 +35,7 @@ describe('@ngx-meta/core:',
useFactory: (metaFactory)
});

const injector = getTestBed();
const meta = injector.get(MetaService);
const meta = TestBed.get(MetaService);

expect(MetaStaticLoader).toBeDefined();
expect(meta.loader).toBeDefined();
Expand All @@ -56,8 +55,7 @@ describe('@ngx-meta/core:',
useClass: CustomLoader
});

const injector = getTestBed();
const meta = injector.get(MetaService);
const meta = TestBed.get(MetaService);

expect(CustomLoader).toBeDefined();
expect(meta.loader).toBeDefined();
Expand Down
Loading

0 comments on commit 0819458

Please sign in to comment.