Skip to content

Commit

Permalink
chore: release v4.0.0-rc.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Zizzamia committed Nov 17, 2019
1 parent 5c9f552 commit 67feb21
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 195 deletions.
1 change: 0 additions & 1 deletion README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ const perfume = new Perfume({
perfume.start('fibonacci');
fibonacci(400);
const duration = this.perfume.end('fibonacci');
perfume.log({ metricName: 'Custom logging', duration });
// 🍹 HayesValley.js: Custom logging 0.14 ms
```

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ const perfume = new Perfume({
perfume.start('fibonacci');
fibonacci(400);
const duration = perfume.end('fibonacci');
perfume.log({ metricName: 'Custom logging', duration });
// 🍹 HayesValley.js: Custom logging 0.14 ms
```
<br />
Expand Down
45 changes: 8 additions & 37 deletions __tests__/perfume.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,28 +480,6 @@ describe('Perfume', () => {
});
});

describe('.digestFirstPaintEntries()', () => {
it('should call performanceObserver()', () => {
spy = jest.spyOn(perfume as any, 'performanceObserverCb');
perfume['digestFirstPaintEntries']([]);
expect(spy.mock.calls.length).toEqual(2);
expect(spy).toHaveBeenCalledWith({
entries: [],
entryName: 'first-paint',
metricLog: 'First Paint',
metricName: 'firstPaint',
valueLog: 'startTime',
});
expect(spy).toHaveBeenCalledWith({
entries: [],
entryName: 'first-contentful-paint',
metricLog: 'First Contentful Paint',
metricName: 'firstContentfulPaint',
valueLog: 'startTime',
});
});
});

describe('.initFirstPaint()', () => {
beforeEach(() => {
perfume.config.firstPaint = true;
Expand Down Expand Up @@ -754,30 +732,30 @@ describe('Perfume', () => {

describe('.isPerformanceSupported()', () => {
it('should return true if the browser supports the Navigation Timing API', () => {
expect(perfume.isPerformanceSupported).toEqual(true);
expect((perfume as any).isPerformanceSupported()).toEqual(true);
});

it('should return false if the browser does not supports performance.mark', () => {
delete window.performance.mark;
expect(perfume.isPerformanceSupported).toEqual(false);
expect((perfume as any).isPerformanceSupported()).toEqual(false);
});

it('should return false if the browser does not supports performance.now', () => {
window.performance.mark = () => 1;
delete window.performance.now;
expect(perfume.isPerformanceSupported).toEqual(false);
expect((perfume as any).isPerformanceSupported()).toEqual(false);
});
});

describe('.navigationTiming()', () => {
describe('.getNavigationTiming()', () => {
it('when performance is not supported should return an empty object', () => {
delete window.performance.mark;
expect(perfume.navigationTiming).toEqual({});
expect((perfume as any).getNavigationTiming()).toEqual({});
});

it('when performance is supported should return the correct value', () => {
perfume.config.navigationTiming = true;
expect(perfume.navigationTiming).toEqual({
expect((perfume as any).getNavigationTiming()).toEqual({
dnsLookupTime: 0,
downloadTime: 0.69,
fetchTime: 4.44,
Expand All @@ -793,13 +771,13 @@ describe('Perfume', () => {
jest.spyOn(window.performance, 'getEntriesByType').mockReturnValue([{
workerTime: 0,
}] as any);
expect(perfume.navigationTiming.workerTime).toEqual(0);
expect((perfume as any).getNavigationTiming().workerTime).toEqual(0);
});

it('when Navigation Timing is not supported yet should return an empty object', () => {
perfume.config.navigationTiming = true;
jest.spyOn(window.performance, 'getEntriesByType').mockReturnValue([] as any);
expect(perfume.navigationTiming).toEqual({});
expect((perfume as any).getNavigationTiming()).toEqual({});
});
});

Expand Down Expand Up @@ -863,11 +841,4 @@ describe('Perfume', () => {
expect(value).toEqual(12346);
});
});

describe('.getMeasurementForGivenName()', () => {
it('should return the first PerformanceEntry objects for the given name', () => {
const value = (perfume as any).getMeasurementForGivenName('metricName');
expect(value).toEqual({ duration: 12346, entryType: 'measure' });
});
});
});
34 changes: 17 additions & 17 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docs",
"version": "4.0.0-rc8",
"version": "4.0.0-rc.10",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand All @@ -24,10 +24,10 @@
"@angular/router": "8.2.11",
"core-js": "3.1.4",
"ng-packagr": "5.5.1",
"perfume.js": "7",
"perfume.js": "4.0.0-rc.10",
"rxjs": "6.5.3",
"tsickle": "0.35.0",
"typescript": "3.7.2",
"typescript": "3.5.3",
"zone.js": "0.9.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions docs/projects/perfume/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "perfume.js/angular",
"version": "4.0.0-rc8",
"version": "4.0.0-rc.10",
"peerDependencies": {
"@angular/common": "^6.0.0",
"@angular/core": "^6.0.0",
"perfume.js": "4.0.0-rc7"
"perfume.js": "4.0.0-rc9"
}
}
1 change: 0 additions & 1 deletion docs/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export class AppComponent implements AfterViewInit {
this.perfume.start('fibonacci');
this.fibonacci(800);
const duration = this.perfume.end('fibonacci') as number;
this.perfume.log({ metricName: 'Custom logging', duration });
this.logCustom = `🍹 HayesValley.js: Custom logging ${duration} ms`;
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "perfume.js",
"version": "4.0.0-rc8",
"version": "4.0.0-rc.10",
"description": "JavaScript library that measures Navigation Timing, First (Contentful) Paint (FP/FCP), First Input Delay (FID) and components lifecycle performance. Report real user measurements to your favorite analytics tool.",
"keywords": [
"performance-metrics",
Expand Down
3 changes: 2 additions & 1 deletion rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const createConfig = ({ output, min = false }) => {
'chrome',
'hidden',
'addEventListener',
'requestIdleCallback'
'requestIdleCallback',
'metricName'
]
}
},
Expand Down
Loading

0 comments on commit 67feb21

Please sign in to comment.