@testspectra/react-native 0.0.0-stage → 1.2.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.
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
31
+
32
+ // src/mock/react_native_shim.ts
33
+ var react_native_shim_exports = {};
34
+ __export(react_native_shim_exports, {
35
+ ActivityIndicator: () => ActivityIndicator,
36
+ Alert: () => Alert,
37
+ Animated: () => Animated,
38
+ AppState: () => AppState,
39
+ BackHandler: () => BackHandler,
40
+ Dimensions: () => Dimensions,
41
+ FlatList: () => FlatList,
42
+ Image: () => Image,
43
+ Keyboard: () => Keyboard,
44
+ Linking: () => Linking,
45
+ Modal: () => Modal,
46
+ PixelRatio: () => PixelRatio,
47
+ Platform: () => Platform,
48
+ Pressable: () => Pressable,
49
+ SafeAreaView: () => SafeAreaView,
50
+ ScrollView: () => ScrollView,
51
+ SectionList: () => SectionList,
52
+ StatusBar: () => StatusBar,
53
+ StyleSheet: () => StyleSheet,
54
+ Text: () => Text,
55
+ TextInput: () => TextInput,
56
+ TouchableHighlight: () => TouchableHighlight,
57
+ TouchableOpacity: () => TouchableOpacity,
58
+ TouchableWithoutFeedback: () => TouchableWithoutFeedback,
59
+ UIManager: () => UIManager,
60
+ View: () => View,
61
+ default: () => react_native_shim_default,
62
+ useWindowDimensions: () => useWindowDimensions
63
+ });
64
+ module.exports = __toCommonJS(react_native_shim_exports);
65
+ var import_react = __toESM(require("react"), 1);
66
+ function createComponent(displayName) {
67
+ const Comp = import_react.default.forwardRef((props, ref) => {
68
+ return import_react.default.createElement(displayName, { ...props, ref });
69
+ });
70
+ Comp.displayName = displayName;
71
+ return Comp;
72
+ }
73
+ var View = createComponent("View");
74
+ var Text = createComponent("Text");
75
+ var TouchableOpacity = createComponent("TouchableOpacity");
76
+ var TouchableHighlight = createComponent("TouchableHighlight");
77
+ var TouchableWithoutFeedback = createComponent("TouchableWithoutFeedback");
78
+ var Pressable = createComponent("Pressable");
79
+ var TextInput = createComponent("TextInput");
80
+ var ScrollView = createComponent("ScrollView");
81
+ var FlatList = createComponent("FlatList");
82
+ var SectionList = createComponent("SectionList");
83
+ var ActivityIndicator = createComponent("ActivityIndicator");
84
+ var Modal = createComponent("Modal");
85
+ var Image = createComponent("Image");
86
+ var SafeAreaView = createComponent("SafeAreaView");
87
+ var StatusBar = createComponent("StatusBar");
88
+ var StyleSheet = {
89
+ create: (styles) => styles,
90
+ flatten: (style) => {
91
+ if (Array.isArray(style)) {
92
+ return Object.assign({}, ...style.filter(Boolean).map(StyleSheet.flatten));
93
+ }
94
+ return style || {};
95
+ },
96
+ hairlineWidth: 1,
97
+ absoluteFill: { position: "absolute", left: 0, right: 0, top: 0, bottom: 0 },
98
+ absoluteFillObject: { position: "absolute", left: 0, right: 0, top: 0, bottom: 0 }
99
+ };
100
+ var Platform = {
101
+ OS: "android",
102
+ select: (obj) => obj?.android ?? obj?.default ?? obj?.ios,
103
+ isTesting: true,
104
+ Version: 34
105
+ };
106
+ var Dimensions = {
107
+ get: (_dim) => ({
108
+ width: 412,
109
+ height: 915,
110
+ scale: 2.625,
111
+ fontScale: 1
112
+ }),
113
+ addEventListener: () => ({ remove: () => {
114
+ } }),
115
+ removeEventListener: () => {
116
+ }
117
+ };
118
+ function useWindowDimensions() {
119
+ return { width: 412, height: 915, scale: 2.625, fontScale: 1 };
120
+ }
121
+ var PixelRatio = {
122
+ get: () => 2.625,
123
+ getFontScale: () => 1,
124
+ getPixelSizeForLayoutSize: (layoutSize) => Math.round(layoutSize * 2.625),
125
+ roundToNearestPixel: (layoutSize) => Math.round(layoutSize)
126
+ };
127
+ var Keyboard = {
128
+ dismiss: () => {
129
+ },
130
+ addListener: () => ({ remove: () => {
131
+ } }),
132
+ removeListener: () => {
133
+ }
134
+ };
135
+ var UIManager = {
136
+ measure: (_node, cb) => {
137
+ cb(0, 0, 100, 40, 50, 100);
138
+ },
139
+ measureInWindow: (_node, cb) => {
140
+ cb(50, 100, 100, 40);
141
+ }
142
+ };
143
+ var Alert = {
144
+ alert: () => {
145
+ }
146
+ };
147
+ var AppState = {
148
+ currentState: "active",
149
+ addEventListener: () => ({ remove: () => {
150
+ } })
151
+ };
152
+ var Linking = {
153
+ openURL: () => Promise.resolve(),
154
+ canOpenURL: () => Promise.resolve(true),
155
+ getInitialURL: () => Promise.resolve(null)
156
+ };
157
+ var BackHandler = {
158
+ addEventListener: () => ({ remove: () => {
159
+ } }),
160
+ exitApp: () => {
161
+ }
162
+ };
163
+ var Animated = {
164
+ Value: class AnimatedValue {
165
+ constructor(val) {
166
+ __publicField(this, "val", val);
167
+ }
168
+ setValue(v) {
169
+ this.val = v;
170
+ }
171
+ interpolate(_config) {
172
+ return this;
173
+ }
174
+ },
175
+ timing: (_val, _config) => ({
176
+ start: (cb) => cb?.({ finished: true }),
177
+ stop: () => {
178
+ }
179
+ }),
180
+ spring: (_val, _config) => ({
181
+ start: (cb) => cb?.({ finished: true }),
182
+ stop: () => {
183
+ }
184
+ }),
185
+ View,
186
+ Text,
187
+ Image,
188
+ ScrollView,
189
+ createAnimatedComponent: (c) => c
190
+ };
191
+ var react_native_shim_default = {
192
+ View,
193
+ Text,
194
+ TouchableOpacity,
195
+ TouchableHighlight,
196
+ TouchableWithoutFeedback,
197
+ Pressable,
198
+ TextInput,
199
+ ScrollView,
200
+ FlatList,
201
+ SectionList,
202
+ ActivityIndicator,
203
+ Modal,
204
+ Image,
205
+ SafeAreaView,
206
+ StatusBar,
207
+ StyleSheet,
208
+ Platform,
209
+ Dimensions,
210
+ useWindowDimensions,
211
+ PixelRatio,
212
+ Keyboard,
213
+ UIManager,
214
+ Alert,
215
+ AppState,
216
+ Linking,
217
+ BackHandler,
218
+ Animated
219
+ };
@@ -0,0 +1,190 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
5
+ // src/mock/react_native_shim.ts
6
+ import React from "react";
7
+ function createComponent(displayName) {
8
+ const Comp = React.forwardRef((props, ref) => {
9
+ return React.createElement(displayName, { ...props, ref });
10
+ });
11
+ Comp.displayName = displayName;
12
+ return Comp;
13
+ }
14
+ var View = createComponent("View");
15
+ var Text = createComponent("Text");
16
+ var TouchableOpacity = createComponent("TouchableOpacity");
17
+ var TouchableHighlight = createComponent("TouchableHighlight");
18
+ var TouchableWithoutFeedback = createComponent("TouchableWithoutFeedback");
19
+ var Pressable = createComponent("Pressable");
20
+ var TextInput = createComponent("TextInput");
21
+ var ScrollView = createComponent("ScrollView");
22
+ var FlatList = createComponent("FlatList");
23
+ var SectionList = createComponent("SectionList");
24
+ var ActivityIndicator = createComponent("ActivityIndicator");
25
+ var Modal = createComponent("Modal");
26
+ var Image = createComponent("Image");
27
+ var SafeAreaView = createComponent("SafeAreaView");
28
+ var StatusBar = createComponent("StatusBar");
29
+ var StyleSheet = {
30
+ create: (styles) => styles,
31
+ flatten: (style) => {
32
+ if (Array.isArray(style)) {
33
+ return Object.assign({}, ...style.filter(Boolean).map(StyleSheet.flatten));
34
+ }
35
+ return style || {};
36
+ },
37
+ hairlineWidth: 1,
38
+ absoluteFill: { position: "absolute", left: 0, right: 0, top: 0, bottom: 0 },
39
+ absoluteFillObject: { position: "absolute", left: 0, right: 0, top: 0, bottom: 0 }
40
+ };
41
+ var Platform = {
42
+ OS: "android",
43
+ select: (obj) => obj?.android ?? obj?.default ?? obj?.ios,
44
+ isTesting: true,
45
+ Version: 34
46
+ };
47
+ var Dimensions = {
48
+ get: (_dim) => ({
49
+ width: 412,
50
+ height: 915,
51
+ scale: 2.625,
52
+ fontScale: 1
53
+ }),
54
+ addEventListener: () => ({ remove: () => {
55
+ } }),
56
+ removeEventListener: () => {
57
+ }
58
+ };
59
+ function useWindowDimensions() {
60
+ return { width: 412, height: 915, scale: 2.625, fontScale: 1 };
61
+ }
62
+ var PixelRatio = {
63
+ get: () => 2.625,
64
+ getFontScale: () => 1,
65
+ getPixelSizeForLayoutSize: (layoutSize) => Math.round(layoutSize * 2.625),
66
+ roundToNearestPixel: (layoutSize) => Math.round(layoutSize)
67
+ };
68
+ var Keyboard = {
69
+ dismiss: () => {
70
+ },
71
+ addListener: () => ({ remove: () => {
72
+ } }),
73
+ removeListener: () => {
74
+ }
75
+ };
76
+ var UIManager = {
77
+ measure: (_node, cb) => {
78
+ cb(0, 0, 100, 40, 50, 100);
79
+ },
80
+ measureInWindow: (_node, cb) => {
81
+ cb(50, 100, 100, 40);
82
+ }
83
+ };
84
+ var Alert = {
85
+ alert: () => {
86
+ }
87
+ };
88
+ var AppState = {
89
+ currentState: "active",
90
+ addEventListener: () => ({ remove: () => {
91
+ } })
92
+ };
93
+ var Linking = {
94
+ openURL: () => Promise.resolve(),
95
+ canOpenURL: () => Promise.resolve(true),
96
+ getInitialURL: () => Promise.resolve(null)
97
+ };
98
+ var BackHandler = {
99
+ addEventListener: () => ({ remove: () => {
100
+ } }),
101
+ exitApp: () => {
102
+ }
103
+ };
104
+ var Animated = {
105
+ Value: class AnimatedValue {
106
+ constructor(val) {
107
+ __publicField(this, "val", val);
108
+ }
109
+ setValue(v) {
110
+ this.val = v;
111
+ }
112
+ interpolate(_config) {
113
+ return this;
114
+ }
115
+ },
116
+ timing: (_val, _config) => ({
117
+ start: (cb) => cb?.({ finished: true }),
118
+ stop: () => {
119
+ }
120
+ }),
121
+ spring: (_val, _config) => ({
122
+ start: (cb) => cb?.({ finished: true }),
123
+ stop: () => {
124
+ }
125
+ }),
126
+ View,
127
+ Text,
128
+ Image,
129
+ ScrollView,
130
+ createAnimatedComponent: (c) => c
131
+ };
132
+ var react_native_shim_default = {
133
+ View,
134
+ Text,
135
+ TouchableOpacity,
136
+ TouchableHighlight,
137
+ TouchableWithoutFeedback,
138
+ Pressable,
139
+ TextInput,
140
+ ScrollView,
141
+ FlatList,
142
+ SectionList,
143
+ ActivityIndicator,
144
+ Modal,
145
+ Image,
146
+ SafeAreaView,
147
+ StatusBar,
148
+ StyleSheet,
149
+ Platform,
150
+ Dimensions,
151
+ useWindowDimensions,
152
+ PixelRatio,
153
+ Keyboard,
154
+ UIManager,
155
+ Alert,
156
+ AppState,
157
+ Linking,
158
+ BackHandler,
159
+ Animated
160
+ };
161
+ export {
162
+ ActivityIndicator,
163
+ Alert,
164
+ Animated,
165
+ AppState,
166
+ BackHandler,
167
+ Dimensions,
168
+ FlatList,
169
+ Image,
170
+ Keyboard,
171
+ Linking,
172
+ Modal,
173
+ PixelRatio,
174
+ Platform,
175
+ Pressable,
176
+ SafeAreaView,
177
+ ScrollView,
178
+ SectionList,
179
+ StatusBar,
180
+ StyleSheet,
181
+ Text,
182
+ TextInput,
183
+ TouchableHighlight,
184
+ TouchableOpacity,
185
+ TouchableWithoutFeedback,
186
+ UIManager,
187
+ View,
188
+ react_native_shim_default as default,
189
+ useWindowDimensions
190
+ };
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@testspectra/react-native",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.2.14",
4
+ "description": "Native Android & iOS component test runner for React Native with TestSpectra Spectra.* DSL",
5
+ "keywords": [
6
+ "testspectra",
7
+ "spectra",
8
+ "react-native",
9
+ "component-testing",
10
+ "mobile"
11
+ ],
12
+ "homepage": "https://github.com/TestSpectra/testspectra-source",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/TestSpectra/testspectra-source.git",
16
+ "directory": "tools/react-native"
17
+ },
18
+ "type": "module",
19
+ "main": "dist/index.js",
20
+ "types": "dist/index.d.ts",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js",
25
+ "default": "./dist/index.js"
26
+ },
27
+ "./package.json": "./package.json"
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "dependencies": {
33
+ "cross-spawn": "^7.0.6",
34
+ "esbuild": "^0.28.2",
35
+ "@testspectra/matchers": "1.2.14",
36
+ "@testspectra/worker-runtime": "1.0.0"
37
+ },
38
+ "peerDependencies": {
39
+ "react": ">=18.0.0",
40
+ "react-native": ">=0.70.0"
41
+ },
42
+ "devDependencies": {
43
+ "@types/cross-spawn": "^6.0.6",
44
+ "@types/node": "^20.14.0",
45
+ "@types/react": "^18.3.12",
46
+ "@types/react-native": "^0.73.0",
47
+ "typescript": "^5.6.3"
48
+ },
49
+ "scripts": {
50
+ "build": "node scripts/build.js",
51
+ "typecheck": "tsc --noEmit"
52
+ }
6
53
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.