Skip to content

Commit b8fd386

Browse files
authored
Merge pull request #13 from chuanqisun/dev/v3
V3
2 parents 200167a + 2e8568e commit b8fd386

24 files changed

+2138
-7582
lines changed

.angular-cli.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,9 @@
1-
# See http://help.github.com/ignore-files/ for more about ignoring files.
2-
3-
# compiled output
4-
/dist
5-
/tmp
6-
/out-tsc
7-
81
# dependencies
92
/node_modules
103

11-
# IDEs and editors
12-
/.idea
13-
.project
14-
.classpath
15-
.c9/
16-
*.launch
17-
.settings/
18-
*.sublime-workspace
19-
20-
# IDE - VSCode
21-
.vscode/*
22-
!.vscode/settings.json
23-
!.vscode/tasks.json
24-
!.vscode/launch.json
25-
!.vscode/extensions.json
26-
27-
# misc
28-
/.sass-cache
29-
/connect.lock
30-
/coverage
31-
/libpeerconnection.log
32-
npm-debug.log
33-
testem.log
34-
/typings
35-
36-
# e2e
37-
/e2e/*.js
38-
/e2e/*.map
39-
404
# System Files
415
.DS_Store
426
Thumbs.db
7+
8+
# generated
9+
coverage

.npmignore

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
**/*
2-
3-
!index.ts
4-
!src/lib/index.ts
1+
src/
2+
.editorconfig
3+
.travis.yml
4+
karma.conf.js
5+
tsconfig.json
6+
tsconfig.spec.json
7+
coverage/

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22

33
language: node_js
44
node_js:
5-
- "6"
5+
- "10"
66

77
addons:
88
chrome: stable
99

1010
before_script:
1111
- export DISPLAY=:99.0
1212
- sh -e /etc/init.d/xvfb start
13-
- npm install -g @angular/cli
1413

1514
script:
16-
- ng lint --type-check
17-
- ng test -sr -cc
15+
- npm run start:once
1816

1917
after_success:
20-
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
18+
- cat ./coverage/*/lcovonly | ./node_modules/coveralls/bin/coveralls.js

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 3.0.0
2+
* The package no longer includes raw *.ts file. Instead, it includes compiled js with d.ts typing file. This decouples users' tsconfig file from the library's own tsconfig file.
3+
* Now supports Typescript >= 3.0.0, Jasmine >= 2.9.0,
4+
15
# 2.1.0
26
* [Typescript 2.9](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html) supports `number` and `symbol` named properties. Since Jasmine can only spy on `string` named properties according to its [official spec](https://jasmine.github.io/api/3.3/global.html#spyOnProperty), Jasmine-mock-factory will return undefined when user reads those properties and ignores any write operations. With this update, a warning message will be displayed when user tries to spy on a `number` or `symbol` named properties.
37
* ignore `index.spec.ts` from npm package

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ it('should pass', () => {
4343
4444
## Prerequisite
4545
46-
This util is built with and for [Jasmine](https://jasmine.github.io/) test framework. Basic understanding of Jasmine is assumed.
47-
48-
This util requires [ES6 Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) and only contains `*.ts` files that must be compiled with a [TypeScript](https://www.typescriptlang.org/) compiler.
46+
* This util is built with and for [Jasmine](https://jasmine.github.io/) test framework. Basic understanding of Jasmine is assumed.
47+
* This util requires [ES6 Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy).
4948
5049
5150
## Usage
@@ -181,7 +180,6 @@ const mockLocation = MockFactory.create(location);
181180
```
182181
183182
## Develope
184-
This project is built with [Angular CLI](https://cli.angular.io/)
185-
186-
### Running unit tests
187-
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
183+
* `npm install` to install dev dependencies
184+
* `npm run build` to build the library
185+
* `npm run test` to test the library

dist/index.d.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/// <reference types="jasmine" />
2+
export declare type Mock<T> = T & SpyFacade<T>;
3+
export interface SpyFacade<T> {
4+
_spy: Spied<T> & SpiedAny;
5+
}
6+
export declare type Spied<T> = {
7+
[K in keyof T]: SpiedMember;
8+
};
9+
export interface SpiedAny {
10+
[id: string]: SpiedMember;
11+
}
12+
export interface SpiedMember {
13+
_func: jasmine.Spy;
14+
_get: jasmine.Spy;
15+
_set: jasmine.Spy;
16+
}
17+
interface Type<T> extends Function {
18+
new (...args: any[]): T;
19+
}
20+
export declare class MockFactory {
21+
/**
22+
* create a mock object that has the identical interface as the class you passed in
23+
*/
24+
static create<T extends object>(blueprint: Type<T> | T): Mock<T>;
25+
}
26+
export {};

dist/index.js

Lines changed: 133 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './dist/index';

0 commit comments

Comments
 (0)