@microsoft/applicationinsights-react-native 2.4.2-nightly.2111-09 → 2.4.2-nightly.2111-14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights react native plugin, 2.4.2-nightly.2111-09
2
+ * Microsoft Application Insights react native plugin, 2.4.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Native Plugin, 2.4.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - React Native Plugin, 2.4.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Native Plugin, 2.4.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - React Native Plugin, 2.4.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Native Plugin, 2.4.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - React Native Plugin, 2.4.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Native Plugin, 2.4.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - React Native Plugin, 2.4.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
package/dist-esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Native Plugin, 2.4.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - React Native Plugin, 2.4.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { ReactNativePlugin } from "./ReactNativePlugin";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/applicationinsights-react-native",
3
- "version": "2.4.2-nightly.2111-09",
3
+ "version": "2.4.2-nightly.2111-14",
4
4
  "description": "Microsoft Application Insights React Native Plugin",
5
5
  "main": "dist-esm/index.js",
6
6
  "types": "types/index.d.ts",
@@ -53,8 +53,8 @@
53
53
  "uglify-js": "^3.11.0"
54
54
  },
55
55
  "dependencies": {
56
- "@microsoft/applicationinsights-common": "2.7.2-nightly.2111-09",
57
- "@microsoft/applicationinsights-core-js": "2.7.2-nightly.2111-09",
56
+ "@microsoft/applicationinsights-common": "2.7.2-nightly.2111-14",
57
+ "@microsoft/applicationinsights-core-js": "2.7.2-nightly.2111-14",
58
58
  "@microsoft/applicationinsights-shims": "2.0.0",
59
59
  "@microsoft/dynamicproto-js": "^1.1.4"
60
60
  },
@@ -1,25 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ReactNative = global.ReactNative || {})));
5
- }(this, (function (exports) { 'use strict';
6
-
7
- // This provides a bare bones support for the react-native-device-info module to support browser based testing
8
- exports.NativeModules = {
9
- RNDeviceInfo: 1
10
- };
11
-
12
- function dummyEmitter() {
13
-
14
- }
15
-
16
- exports.NativeEventEmitter = function () {
17
- emit: dummyEmitter
18
- };
19
-
20
- Object.defineProperty(exports, '__esModule', { value: true });
21
-
22
- // Need to define so the device-info loads
23
- window.exports = window.exports || exports || {};
24
-
25
- })));
@@ -1,180 +0,0 @@
1
- import { Assert, AITestClass } from "@microsoft/ai-test-framework";
2
- import { AppInsightsCore, DiagnosticLogger, ITelemetryItem, objForEachKey } from "@microsoft/applicationinsights-core-js";
3
- import { ReactNativePlugin, INativeDevice, IReactNativePluginConfig } from '../../../src/index';
4
- import dynamicProto from '@microsoft/dynamicproto-js';
5
-
6
- export class ReactNativePluginTests extends AITestClass {
7
- private plugin: ReactNativePlugin;
8
- private core: AppInsightsCore;
9
- private config: IReactNativePluginConfig;
10
- private item: ITelemetryItem;
11
-
12
- public testInitialize() {
13
- this._disableDynProtoBaseFuncs();
14
- this.core = new AppInsightsCore();
15
- this.core.logger = new DiagnosticLogger();
16
- this.plugin = new ReactNativePlugin();
17
- this.config = {};
18
- }
19
-
20
- public testCleanup() {
21
- this.core = null;
22
- this.plugin = null;
23
- this.config = null;
24
- }
25
-
26
- public registerTests() {
27
- this.addConfigTests()
28
- this.addAPITests();
29
- this.addProcessTelemetryTests();
30
- }
31
-
32
- private addProcessTelemetryTests() {
33
- this.testCase({
34
- name: 'processTelemetry appends device fields',
35
- test: () => {
36
- const expectation: ITelemetryItem = {
37
- name: 'a name',
38
- ext: {
39
- device: {
40
- localId: 'some id',
41
- model: 'some model',
42
- deviceClass: 'some type'
43
- }
44
- }
45
- };
46
- const actual: ITelemetryItem = {
47
- name: 'a name'
48
- };
49
- this.plugin['_initialized'] = true;
50
- objForEachKey({
51
- id: 'some id',
52
- model: 'some model',
53
- deviceClass: 'some type'
54
- }, (name, value) => {
55
- this._getDevice(this.plugin)[name] = value;
56
- });
57
- Assert.notDeepEqual(expectation, actual, 'Telemetry items are not equal yet');
58
- this.plugin.processTelemetry(actual);
59
- Assert.deepEqual(expectation, actual, 'Telemetry items are equal');
60
- }
61
- });
62
- }
63
-
64
- private addAPITests() {
65
- this.testCase({
66
- name: `setDeviceId sets this device's id`,
67
- test: () => {
68
- const expectation = 'something';
69
- Assert.notEqual(expectation, this._getDevice(this.plugin).id, 'Initial not set');
70
- this.plugin.setDeviceId(expectation);
71
- Assert.equal(expectation, this._getDevice(this.plugin).id, 'Value set');
72
- }
73
- });
74
-
75
- this.testCase({
76
- name: `setDeviceModel sets this device's model`,
77
- test: () => {
78
- const expectation = 'something';
79
- Assert.notEqual(expectation, this._getDevice(this.plugin).model, 'Initial not set');
80
- this.plugin.setDeviceModel(expectation);
81
- Assert.equal(expectation, this._getDevice(this.plugin).model, 'Value set');
82
- }
83
- });
84
-
85
- this.testCase({
86
- name: `setDeviceType sets this device's type`,
87
- test: () => {
88
- const expectation = 'something';
89
- Assert.notEqual(expectation, this._getDevice(this.plugin).deviceClass, 'Initial not set');
90
- this.plugin.setDeviceType(expectation);
91
- Assert.equal(expectation, this._getDevice(this.plugin).deviceClass, 'Value set');
92
- }
93
- });
94
- }
95
-
96
- private addConfigTests() {
97
- this.testCase({
98
- name: 'Autocollection is enabled by default',
99
- test: () => {
100
- const autoCollectStub = this.sandbox.stub(this.plugin as any, '_collectDeviceInfo');
101
- const autoCollectExceptionStub = this.sandbox.stub(this.plugin as any, '_setExceptionHandler').callsFake(() => true);
102
-
103
- this.plugin.initialize(this.config, this.core, []);
104
- Assert.equal(false, this.plugin['_config'].disableDeviceCollection, 'disableDeviceCollection is false');
105
- Assert.equal(false, this.plugin['_config'].disableExceptionCollection, 'disableExceptionCollection is false');
106
- Assert.ok(autoCollectStub.calledOnce);
107
- Assert.ok(autoCollectExceptionStub.calledOnce);
108
- }
109
- });
110
-
111
- this.testCase({
112
- name: 'Autocollection does not run when disabled from root config',
113
- test: () => {
114
- const autoCollectStub = this.sandbox.stub(this.plugin as any, '_collectDeviceInfo');
115
- const autoCollectExceptionStub = this.sandbox.stub(this.plugin as any, '_setExceptionHandler').callsFake(() => true);
116
- this.config['disableDeviceCollection'] = true;
117
- this.config['disableExceptionCollection'] = true;
118
- this.plugin.initialize(this.config, this.core, []);
119
-
120
- Assert.equal(true, this.plugin['_config'].disableDeviceCollection, 'disableDeviceCollection is true');
121
- Assert.equal(true, this.plugin['_config'].disableExceptionCollection, 'disableExceptionCollection is true');
122
- Assert.ok(autoCollectStub.notCalled);
123
- Assert.ok(autoCollectExceptionStub.notCalled);
124
- }
125
- });
126
-
127
- this.testCase({
128
- name: 'Autocollection does not run when disabled from constructor config',
129
- test: () => {
130
- this.plugin = new ReactNativePlugin({disableDeviceCollection: true, disableExceptionCollection: true});
131
- const autoCollectStub = this.sandbox.stub(this.plugin as any, '_collectDeviceInfo');
132
- const autoCollectExceptionStub = this.sandbox.stub(this.plugin as any, '_setExceptionHandler').callsFake(() => true);
133
- this.plugin.initialize(this.config, this.core, []);
134
-
135
- Assert.equal(true, this.plugin['_config'].disableDeviceCollection, 'disableDeviceCollection is true');
136
- Assert.equal(true, this.plugin['_config'].disableExceptionCollection, 'disableExceptionCollection is true');
137
- Assert.ok(autoCollectStub.notCalled);
138
- Assert.ok(autoCollectExceptionStub.notCalled);
139
- }
140
- });
141
-
142
- this.testCase({
143
- name: 'Autocollection runs when empty config is passed',
144
- test: () => {
145
- this.plugin = new ReactNativePlugin({} as any);
146
- const autoCollectStub = this.sandbox.stub(this.plugin as any, '_collectDeviceInfo');
147
- const autoCollectExceptionStub = this.sandbox.stub(this.plugin as any, '_setExceptionHandler').callsFake(() => true);
148
- this.plugin.initialize(this.config, this.core, []);
149
-
150
- Assert.equal(false, this.plugin['_config'].disableDeviceCollection, 'disableDeviceCollection is false');
151
- Assert.equal(false, this.plugin['_config'].disableExceptionCollection, 'disableExceptionCollection is false');
152
- Assert.ok(autoCollectStub.calledOnce);
153
- Assert.ok(autoCollectExceptionStub.calledOnce);
154
- }
155
- });
156
-
157
- this.testCase({
158
- name: 'Autocollection runs when random config is passed',
159
- test: () => {
160
- this.plugin = new ReactNativePlugin({foo: 'bar'} as any);
161
- const autoCollectStub = this.sandbox.stub(this.plugin as any, '_collectDeviceInfo');
162
- const autoCollectExceptionStub = this.sandbox.stub(this.plugin as any, '_setExceptionHandler').callsFake(() => true);
163
- this.plugin.initialize(this.config, this.core, []);
164
-
165
- Assert.deepEqual(false, this.plugin['_config'].disableDeviceCollection, 'disableDeviceCollection is false');
166
- Assert.deepEqual(false, this.plugin['_config'].disableExceptionCollection, 'disableExceptionCollection is false');
167
- Assert.ok(autoCollectStub.calledOnce);
168
- Assert.ok(autoCollectExceptionStub.calledOnce);
169
- }
170
- });
171
- }
172
-
173
- private _getDevice(plugin: any): any {
174
- return plugin._getDbgPlgTargets()[0];
175
- }
176
- }
177
-
178
- export function runTests() {
179
- new ReactNativePluginTests().registerTests();
180
- }
@@ -1,63 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <meta http-equiv="Cache-control" content="no-Cache" />
7
- <title>Tests for Application Insights JavaScript API</title>
8
- <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-1.23.1.css">
9
- <script src="http://sinonjs.org/releases/sinon-2.3.8.js"></script>
10
- <script src="http://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.js"></script>
11
- <script src="../../../common/Tests/Selenium/ModuleLoader.js"></script>
12
- <script src="../../../common/Tests/Selenium/SimpleSyncPromise.js"></script>
13
-
14
- <script>
15
- var modules = new ModuleLoader({
16
- baseUrl: '../',
17
- paths: {
18
- qunit: "../../common/Tests/External/qunit-1.23.1",
19
- "react-native": "./Tests/External/DummyReactNative"
20
- }
21
- });
22
-
23
- // Load qunit here instead of with tests, otherwise will not work
24
- modules.add("qunit");
25
-
26
- // Load and define the app insights test framework module
27
- modules.add("@microsoft/ai-test-framework", "./node_modules/@microsoft/ai-test-framework/dist/ai-test-framework");
28
-
29
- // Load and define the app insights Shims module
30
- modules.add("@microsoft/applicationinsights-shims", "./node_modules/@microsoft/applicationinsights-shims/browser/applicationinsights-shims");
31
-
32
- // Load DynamicProto
33
- modules.add("@microsoft/dynamicproto-js", "./node_modules/@microsoft/dynamicproto-js/lib/dist/umd/dynamicproto-js", true);
34
-
35
- // Load Core
36
- modules.add("@microsoft/applicationinsights-core-js", "./node_modules/@microsoft/applicationinsights-core-js/browser/applicationinsights-core-js");
37
-
38
- // Load Common
39
- modules.add("@microsoft/applicationinsights-common", "./node_modules/@microsoft/applicationinsights-common/browser/applicationinsights-common");
40
-
41
- modules.add("react-native");
42
-
43
- // Load React native device info
44
- modules.add("react-native-device-info", "./node_modules/react-native-device-info/lib/commonjs/web/index");
45
-
46
- var testModule = modules.add("Tests/Unit/src/reactnativeplugin.tests", "./Unit/dist/reactnativeplugin.tests.js")
47
- testModule.run = function (tests) {
48
- console && console.log("Starting tests");
49
- QUnit.start();
50
- tests.runTests();
51
- };
52
-
53
- modules.run();
54
- </script>
55
- </head>
56
-
57
- <body>
58
- <div id="qunit"></div>
59
- <div id="qunit-fixture"></div>
60
- <div id="error-message"></div>
61
- </body>
62
-
63
- </html>
@@ -1,15 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "sourceMap": true,
4
- "inlineSources": true,
5
- "noImplicitAny": false,
6
- "module": "amd",
7
- "moduleResolution": "Node",
8
- "target": "es5",
9
- "alwaysStrict": true,
10
- "declaration": true,
11
- "outFile": "./Selenium/reactnativeplugin.tests.js"
12
- },
13
- "include": [
14
- ]
15
- }