@saasquatch/squatch-js 2.6.0-1 → 2.6.0-11

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.
Files changed (52) hide show
  1. package/.github/workflows/size-limit.yml +14 -14
  2. package/.github/workflows/static.yml +89 -0
  3. package/CHANGELOG.md +329 -326
  4. package/LICENSE +20 -20
  5. package/README.md +208 -199
  6. package/babel.config.js +7 -7
  7. package/coverage/clover.xml +2 -2
  8. package/cucumber.js +45 -45
  9. package/demo/sandbox.ts +124 -124
  10. package/demo/toolbar.tsx +526 -526
  11. package/dist/api/WidgetApi.d.ts +3 -2
  12. package/dist/async.d.ts +5 -0
  13. package/dist/globals.d.ts +4 -0
  14. package/dist/squatch.d.ts +28 -16
  15. package/dist/squatch.esm.js +464 -249
  16. package/dist/squatch.esm.js.map +1 -1
  17. package/dist/squatch.js +463 -249
  18. package/dist/squatch.js.map +1 -1
  19. package/dist/squatch.min.js +1 -1
  20. package/dist/squatch.min.js.br +0 -0
  21. package/dist/squatch.min.js.map +1 -1
  22. package/dist/squatch.modern.js +1 -1
  23. package/dist/squatch.modern.js.map +1 -1
  24. package/dist/stats.html +1 -1
  25. package/dist/types.d.ts +8 -6
  26. package/dist/utils/decodeJwt.d.ts +1 -0
  27. package/dist/utils/validate.d.ts +2 -2
  28. package/dist/widgets/EmbedWidget.d.ts +9 -0
  29. package/dist/widgets/PopupWidget.d.ts +8 -3
  30. package/dist/widgets/Widgets.d.ts +21 -8
  31. package/dist/widgets/declarative/DeclarativeWidget.d.ts +72 -2
  32. package/dist/widgets/declarative/DeclarativeWidgets.d.ts +22 -0
  33. package/jest.config.ts +200 -202
  34. package/package.json +123 -123
  35. package/tsconfig.json +23 -23
  36. package/coverage/lcov-report/WidgetApi.ts.html +0 -631
  37. package/coverage/lcov-report/api/AnalyticsApi.ts.html +0 -304
  38. package/coverage/lcov-report/api/WidgetApi.ts.html +0 -631
  39. package/coverage/lcov-report/api/graphql.ts.html +0 -130
  40. package/coverage/lcov-report/utils/cookieUtils.ts.html +0 -415
  41. package/coverage/lcov-report/utils/decodeUserJwt.ts.html +0 -133
  42. package/coverage/lcov-report/utils/domready.ts.html +0 -160
  43. package/coverage/lcov-report/utils/io.ts.html +0 -400
  44. package/coverage/lcov-report/utils/utmUtils.ts.html +0 -277
  45. package/coverage/lcov-report/utils/validate.ts.html +0 -268
  46. package/coverage/lcov-report/validate.ts.html +0 -268
  47. package/coverage/lcov-report/widgets/EmbedWidget.ts.html +0 -433
  48. package/coverage/lcov-report/widgets/PopupWidget.ts.html +0 -670
  49. package/coverage/lcov-report/widgets/Widget.ts.html +0 -1165
  50. package/coverage/lcov-report/widgets/Widgets.ts.html +0 -1060
  51. package/coverage/lcov-report/widgets/declarative/DeclarativeWidget.ts.html +0 -499
  52. package/stats.json +0 -1
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2023 ReferralSaaSquatch.com, Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 ReferralSaaSquatch.com, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  THE SOFTWARE.
package/README.md CHANGED
@@ -1,199 +1,208 @@
1
- # Referral SaaSquatch Javascript SDK
2
-
3
- - [Referral SaaSquatch Javascript SDK](#referral-saasquatch-javascript-sdk)
4
- - [Install the library](#install-the-library)
5
- - [Getting Started](#getting-started)
6
- - [Data Only Operations](#data-only-operations)
7
- - [Create/upsert users without loading a widget.](#createupsert-users-without-loading-a-widget)
8
- - [Get Referral Cookie Code](#get-referral-cookie-code)
9
- - [Install via NPM and Webpack (advanced)](#install-via-npm-and-webpack-advanced)
10
- - [Component API:](#component-api)
11
- - [`squatch-embed`](#squatch-embed)
12
- - [`squatch-popup`](#squatch-popup)
13
- - [Legacy](#legacy)
14
- - [Rendering a widget via Widgets API](#rendering-a-widget-via-widgets-api)
15
- - [Contributing](#contributing)
16
- - [Support](#support)
17
-
18
-
19
- ## Install the library
20
-
21
- To integrate any SaaSquatch program to your website or web app, copy/paste this snippet of JavaScript above the `</head>` tag of your page:
22
-
23
- ```html
24
- <script type="text/javascript">
25
- !function(a,b){a("squatch","https://fast.ssqt.io/squatch-js@2",b)}(function(a,b,c){var d,e,f;c["_"+a]={},c[a]={},c[a].ready=function(b){c["_" + a].ready = c["_" + a].ready || [];c["_" + a].ready.push(b);},e=document.createElement("script"),e.async=1,e.src=b,f=document.getElementsByTagName("script")[0],f.parentNode.insertBefore(e,f)},this);
26
- </script>
27
- ```
28
-
29
- Or load the library synchronously from our CDN:
30
-
31
- ```html
32
- <script src="https://fast.ssqt.io/squatch-js@2" type="text/javascript"></script>
33
- ```
34
-
35
-
36
- ## Getting Started
37
-
38
- Include either of the squatchjs generated web-components in your page's HTML to render your desired widget:
39
- ```html
40
- <!-- EMBED WIDGET -->
41
- <squatch-embed widget="WIDGET_TYPE"><!-- Widget is rendered here --></squatch-embed>
42
-
43
- <!-- POPUP WIDGET -->
44
- <squatch-popup widget="WIDGET_TYPE"><!-- Widget is rendered here --></squatch-popup>
45
- ```
46
- For rendering widgets and API calls, Squatchjs respects configurations set on the following:
47
- - `window.squatchToken`: Signed JWT for calls to the SaaSquatch API -- [How to generate valid JWT Tokens](https://docs.saasquatch.com/topics/json-web-tokens#example-building-the-jwt)
48
- - `window.squatchTenant`: SaaSquatch tenant alias
49
- - `window.squatchConfig`: Additional configuration overrides (Optional)
50
- - `debug`: Turn on console debugging (Default: `false`)
51
-
52
- **Note**: If `window.squatchToken` is undefined, widgets will be rendered as [Instant Access widgets](https://docs.saasquatch.com/topics/widget-types#instant-access-widgets).
53
-
54
-
55
-
56
-
57
-
58
- ## Data Only Operations
59
-
60
-
61
- #### Create/upsert users without loading a widget.
62
-
63
- ```html
64
- <script type="text/javascript">
65
- // Assuming window.squatchTenant, and window.squatchToken are set
66
-
67
- squatch.ready(function() {
68
- var user;
69
-
70
- squatch.api().upsertUser({
71
- user: { // Object (required)
72
- id: 'USER_ID', // String (required)
73
- accountId: 'USER_ACCOUNT_ID', // String (required)
74
- email: 'USER_EMAIL', // String (optional)
75
- firstName: 'USER_FIRST_NAME', // String (optional)
76
- lastName: 'USER_LAST_NAME', // String (optional)
77
- ...
78
- },
79
- engagementMedium: 'EMBED', // String (optional: POPUP, EMBED)
80
- widgetType: 'p/PROGRAM-ID/w/referrerWidget', // Update PROGRAM-ID
81
- }).then(function(response) {
82
- user = response.user;
83
- }).catch(function(err){
84
- console.log(err);
85
- });
86
-
87
- // autofill
88
- var element = document.getElementById('my_coupon');
89
- element.value = user.referredBy.code;
90
-
91
- });
92
- </script>
93
- ```
94
-
95
- ## Get Referral Cookie Code
96
- You can also use the `api()` function to call the WidgetApi methods directly.
97
-
98
- ```html
99
- <script type="text/javascript">
100
- squatch.ready(function(){
101
-
102
- var element = document.getElementById('my_coupon');
103
-
104
- squatch.api().squatchReferralCookie().then(function(response) {
105
- /* `response.codes` looks like `{"program_id":"NEWCO", "friend_program":"BOB"}` */
106
-
107
- element.value = response.codes["program-id"];
108
- });
109
-
110
- });
111
- </script>
112
- ```
113
-
114
- Want more control? Visit our [guide](https://github.com/saasquatch/squatch-js/blob/master/docs/docs.md).
115
-
116
-
117
- ## Install via NPM and Webpack (advanced)
118
-
119
- Squatch.js can also be installed via NPM and bundled into your application with Webpack.
120
-
121
- ```ssh
122
- # via npm
123
- $ npm install @saasquatch/squatch-js
124
- ```
125
-
126
- ```js
127
- import * as squatch from "@saasquatch/squatch-js";
128
-
129
- // Always call init
130
- squatch.init({
131
- tenantAlias: "YOUR_TENANT_ALIAS" // String (required)
132
- });
133
-
134
- // Don't need to wait for .ready when importing via NPM/Webpack
135
- squatch.api().upsertUser({...});
136
-
137
- ```
138
-
139
- ## Component API:
140
-
141
- ### `squatch-embed`
142
- ```html
143
- <squatch-embed widget="WIDGET_TYPE" [ container="#selector" ]>
144
- <!-- Children of squatch-embed act as a loading state -->
145
- Loading...
146
- </squatch-embed>
147
- ```
148
-
149
- - `widget`: Specifies the SaaSquatch `widgetType` identifier of the desired widget
150
- - Required
151
- - `container`: A CSS selector for a container element to use as the parent of the widget's iframe.
152
- - Default: `null`
153
- - Note, if no container is specified, the widget iframe will attach to the shadow DOM of `squatch-embed`.
154
-
155
-
156
- ### `squatch-popup`
157
- ```html
158
- <squatch-embed widget="WIDGET_TYPE" [ open ]>
159
- <!-- Clicking a child of squatch-popup opens the popup -->
160
- <button>Click me to open</button>
161
- </squatch-embed>
162
- ```
163
-
164
- - `widget: string`: Specifies the SaaSquatch `widgetType` identifier of the desired widget
165
- - Required
166
- - `open: boolean`: Whether to the popup is open when loaded into the page
167
- - Default: `false`
168
-
169
- ## Legacy
170
-
171
- ### Rendering a widget via Widgets API
172
- Note: `engagementMedium` is required in the `squatch.widgets()` functions if you want to load the widget. Otherwise, Squatch.js will look for your portal settings and render the widget that's mapped to the URL where this snippet is included.
173
-
174
- ```html
175
- <script type="text/javascript">
176
- squatch.ready(function() {
177
-
178
- squatch.widgets().upsertUser({
179
- user: { // Object (required)
180
- id: 'USER_ID', // String (required)
181
- accountId: 'USER_ACCOUNT_ID', // String (required)
182
- email: 'USER_EMAIL', // String (optional)
183
- firstName: 'USER_FIRST_NAME', // String (optional)
184
- lastName: 'USER_LAST_NAME', // String (optional)
185
-
186
- ...
187
- },
188
- engagementMedium: 'EMBED', // String (optional: POPUP, EMBED)
189
- widgetType: 'p/PROGRAM-ID/w/referrerWidget', // Update PROGRAM-ID
190
- });
191
- });
192
- </script>
193
- ```
194
-
195
- ## Contributing
196
- This is an open source project! If you are interested in contributing please look at [contributing guidelines](CONTRIBUTING.md) first.
197
-
198
- ## Support
199
- Shoot us an email at [support@saasqt.ch](mailto:support@saasqt.ch) if you need help!
1
+ # Referral SaaSquatch Javascript SDK
2
+
3
+ - [Referral SaaSquatch Javascript SDK](#referral-saasquatch-javascript-sdk)
4
+ - [Install the library](#install-the-library)
5
+ - [Getting Started](#getting-started)
6
+ - [Data Only Operations](#data-only-operations)
7
+ - [Create/upsert users without loading a widget.](#createupsert-users-without-loading-a-widget)
8
+ - [Get Referral Cookie Code](#get-referral-cookie-code)
9
+ - [Install via NPM and Webpack (advanced)](#install-via-npm-and-webpack-advanced)
10
+ - [Component API:](#component-api)
11
+ - [`squatch-embed`](#squatch-embed)
12
+ - [`squatch-popup`](#squatch-popup)
13
+ - [Legacy](#legacy)
14
+ - [Rendering a widget via Widgets API](#rendering-a-widget-via-widgets-api)
15
+ - [Contributing](#contributing)
16
+ - [Support](#support)
17
+
18
+
19
+ ## Install the library
20
+
21
+ To integrate any SaaSquatch program to your website or web app, copy/paste this snippet of JavaScript above the `</head>` tag of your page:
22
+
23
+ ```html
24
+ <script type="text/javascript">
25
+ !function(a,b){a("squatch","https://fast.ssqt.io/squatch-js@2",b)}(function(a,b,c){var d,e,f;c["_"+a]={},c[a]={},c[a].ready=function(b){c["_" + a].ready = c["_" + a].ready || [];c["_" + a].ready.push(b);},e=document.createElement("script"),e.async=1,e.src=b,f=document.getElementsByTagName("script")[0],f.parentNode.insertBefore(e,f)},this);
26
+ </script>
27
+ ```
28
+
29
+ Or load the library synchronously from our CDN:
30
+
31
+ ```html
32
+ <script src="https://fast.ssqt.io/squatch-js@2" type="text/javascript"></script>
33
+ ```
34
+
35
+
36
+ ## Getting Started
37
+
38
+ Include either of the squatchjs generated web-components in your page's HTML to render your desired widget:
39
+ ```html
40
+ <!-- EMBED WIDGET -->
41
+ <squatch-embed widget="WIDGET_TYPE"><!-- Widget is rendered here --></squatch-embed>
42
+
43
+ <!-- POPUP WIDGET -->
44
+ <squatch-popup widget="WIDGET_TYPE"><!-- Widget is rendered here --></squatch-popup>
45
+ ```
46
+ For rendering widgets and API calls, squatchjs respects configurations set on the following:
47
+ - `window.squatchToken`: Signed JWT for calls to the SaaSquatch API -- [How to generate valid JWT Tokens](https://docs.saasquatch.com/topics/json-web-tokens#example-building-the-jwt)
48
+ - `window.squatchTenant`: SaaSquatch tenant alias
49
+ - `window.squatchConfig`: Additional configuration overrides (Optional)
50
+ - `debug`: Turn on console debugging (Default: `false`)
51
+
52
+ **Note**: If `window.squatchToken` is undefined, widgets will be rendered as [Instant Access widgets](https://docs.saasquatch.com/topics/widget-types#instant-access-widgets).
53
+
54
+
55
+
56
+
57
+
58
+ ## Data Only Operations
59
+
60
+
61
+ #### Create/upsert users without loading a widget.
62
+
63
+ ```html
64
+ <script type="text/javascript">
65
+ // Assuming window.squatchTenant, and window.squatchToken are set
66
+
67
+ squatch.ready(function() {
68
+ var user;
69
+
70
+ squatch.api().upsertUser({
71
+ user: { // Object (required)
72
+ id: 'USER_ID', // String (required)
73
+ accountId: 'USER_ACCOUNT_ID', // String (required)
74
+ email: 'USER_EMAIL', // String (optional)
75
+ firstName: 'USER_FIRST_NAME', // String (optional)
76
+ lastName: 'USER_LAST_NAME', // String (optional)
77
+ ...
78
+ },
79
+ engagementMedium: 'EMBED', // String (optional: POPUP, EMBED)
80
+ widgetType: 'p/PROGRAM-ID/w/referrerWidget', // Update PROGRAM-ID
81
+ }).then(function(response) {
82
+ user = response.user;
83
+ }).catch(function(err){
84
+ console.log(err);
85
+ });
86
+
87
+ // autofill
88
+ var element = document.getElementById('my_coupon');
89
+ element.value = user.referredBy.code;
90
+
91
+ });
92
+ </script>
93
+ ```
94
+
95
+ ## Get Referral Cookie Code
96
+ You can also use the `api()` function to call the WidgetApi methods directly.
97
+
98
+ ```html
99
+ <script type="text/javascript">
100
+ squatch.ready(function(){
101
+
102
+ var element = document.getElementById('my_coupon');
103
+
104
+ squatch.api().squatchReferralCookie().then(function(response) {
105
+ /* `response.codes` looks like `{"program_id":"NEWCO", "friend_program":"BOB"}` */
106
+
107
+ element.value = response.codes["program-id"];
108
+ });
109
+
110
+ });
111
+ </script>
112
+ ```
113
+
114
+ Want more control? Visit our [guide](https://github.com/saasquatch/squatch-js/blob/master/docs/docs.md).
115
+
116
+
117
+ ## Install via NPM and Webpack (advanced)
118
+
119
+ Squatch.js can also be installed via NPM and bundled into your application with Webpack.
120
+
121
+ ```ssh
122
+ # via npm
123
+ $ npm install @saasquatch/squatch-js
124
+ ```
125
+
126
+ ```js
127
+ import * as squatch from "@saasquatch/squatch-js";
128
+
129
+ // Always call init
130
+ squatch.init({
131
+ tenantAlias: "YOUR_TENANT_ALIAS" // String (required)
132
+ });
133
+
134
+ // Don't need to wait for .ready when importing via NPM/Webpack
135
+ squatch.api().upsertUser({...});
136
+
137
+ ```
138
+
139
+ ## Component API:
140
+
141
+ ### `squatch-embed`
142
+ ```html
143
+ <squatch-embed widget="WIDGET_TYPE" [ container="#selector" | locale="en_US" ]>
144
+ <!-- Children of squatch-embed act as a loading state -->
145
+ Loading...
146
+ </squatch-embed>
147
+ ```
148
+
149
+ - `widget`: Specifies the SaaSquatch `widgetType` identifier of the desired widget
150
+ - Required
151
+ - Changing this attribute's value causes the widget to reload.
152
+ - `container`: A CSS selector for a container element to use as the parent of the widget's iframe.
153
+ - Default: `null`
154
+ - Note, if no container is specified, the widget iframe will attach to the shadow DOM of `squatch-embed`.
155
+ - `locale`: Locale that determines the widget translation displayed. Should be of the form "xx_XX".
156
+ - Default: Browser's current locale
157
+ - Changing this attribute's value causes the widget to reload.
158
+
159
+ ### `squatch-popup`
160
+ ```html
161
+ <squatch-embed widget="WIDGET_TYPE" [ open | container="#selector" | locale="en_US" ]>
162
+ <!-- Clicking a child of squatch-popup opens the popup -->
163
+ <button>Click me to open</button>
164
+ </squatch-embed>
165
+ ```
166
+
167
+ - `widget: string`: Specifies the SaaSquatch `widgetType` identifier of the desired widget
168
+ - Required
169
+ - `open: boolean`: Whether to the popup is open when loaded into the page
170
+ - Default: `false`
171
+ - `container`: A CSS selector for a container element to use as the parent of the widget's iframe.
172
+ - Default: `null`
173
+ - Note, if no container is specified, the widget iframe will attach to the shadow DOM of `squatch-embed`.
174
+ - `locale`: Locale that determines the widget translation displayed. Should be of the form "xx_XX".
175
+ - Default: Browser's current locale
176
+ - Changing this attribute's value causes the widget to reload.
177
+
178
+ ## Legacy
179
+
180
+ ### Rendering a widget via Widgets API
181
+ Note: `engagementMedium` is required in the `squatch.widgets()` functions if you want to load the widget. Otherwise, squatch.js will look for your portal settings and render the widget that's mapped to the URL where this snippet is included.
182
+
183
+ ```html
184
+ <script type="text/javascript">
185
+ squatch.ready(function() {
186
+
187
+ squatch.widgets().upsertUser({
188
+ user: { // Object (required)
189
+ id: 'USER_ID', // String (required)
190
+ accountId: 'USER_ACCOUNT_ID', // String (required)
191
+ email: 'USER_EMAIL', // String (optional)
192
+ firstName: 'USER_FIRST_NAME', // String (optional)
193
+ lastName: 'USER_LAST_NAME', // String (optional)
194
+
195
+ ...
196
+ },
197
+ engagementMedium: 'EMBED', // String (optional: POPUP, EMBED)
198
+ widgetType: 'p/PROGRAM-ID/w/referrerWidget', // Update PROGRAM-ID
199
+ });
200
+ });
201
+ </script>
202
+ ```
203
+
204
+ ## Contributing
205
+ This is an open source project! If you are interested in contributing please look at [contributing guidelines](CONTRIBUTING.md) first.
206
+
207
+ ## Support
208
+ Shoot us an email at [support@saasqt.ch](mailto:support@saasqt.ch) if you need help!
package/babel.config.js CHANGED
@@ -1,8 +1,8 @@
1
- module.exports = {
2
- presets: [
3
- [
4
- "@babel/preset-env",
5
- { targets: { esmodules: true }}
6
- ]
7
- ]
1
+ module.exports = {
2
+ presets: [
3
+ [
4
+ "@babel/preset-env",
5
+ { targets: { esmodules: true }}
6
+ ]
7
+ ]
8
8
  }
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1689703614560" clover="3.2.0">
3
- <project timestamp="1689703614560" name="All files">
2
+ <coverage generated="1688502247592" clover="3.2.0">
3
+ <project timestamp="1688502247592" name="All files">
4
4
  <metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
5
5
  </project>
6
6
  </coverage>
package/cucumber.js CHANGED
@@ -1,45 +1,45 @@
1
- // cucumber.js
2
- // const dotenv = require('dotenv');
3
- const os = require("os");
4
- // dotenv.config();
5
-
6
- /**
7
- *
8
- * Configures Cucumber
9
- *
10
- * Sets up the required stuff to make React code operate nicely in a Node environment
11
- *
12
- * Source: https://medium.com/@Charles_Stover/behavior-driven-react-development-with-cucumber-faf596d9d71b
13
- *
14
- */
15
- const CPU_COUNT = os.cpus().length;
16
- const IS_DEV = process.env.NODE_ENV === "development";
17
- const FAIL_FAST = IS_DEV ? ["--fail-fast"] : [];
18
- const FORMAT =
19
- process.env.CI || !process.stdout.isTTY ? "progress" : "progress-bar";
20
-
21
- exports.default = [
22
- ...FAIL_FAST,
23
- `--format ${FORMAT}`,
24
- `--parallel ${CPU_COUNT}`,
25
-
26
- // "test/**/*.feature",
27
- "test/specs/**/*.feature",
28
-
29
- `--tags "@testsuite:squatch-js and not @skip"`,
30
-
31
- // Babel and jsDom make our code work as if it's in the browser
32
- // "--require-module jsdom-global/register",
33
- // "--require-module ts-node/register",
34
- "--require-module " + __dirname + "/babelregister.js",
35
- // '--require-module source-map-support/register',
36
-
37
- // Order matters -- these setups need to happen first
38
- // "--require tests/cucumber-setup/loaders.ts",
39
-
40
- // Step definitions go last
41
- "--require test/step_definitions/**/steps.ts",
42
- // "--require test/step_definitions/**/*.tsx",
43
-
44
- // '--format usage',
45
- ].join(" ");
1
+ // cucumber.js
2
+ // const dotenv = require('dotenv');
3
+ const os = require("os");
4
+ // dotenv.config();
5
+
6
+ /**
7
+ *
8
+ * Configures Cucumber
9
+ *
10
+ * Sets up the required stuff to make React code operate nicely in a Node environment
11
+ *
12
+ * Source: https://medium.com/@Charles_Stover/behavior-driven-react-development-with-cucumber-faf596d9d71b
13
+ *
14
+ */
15
+ const CPU_COUNT = os.cpus().length;
16
+ const IS_DEV = process.env.NODE_ENV === "development";
17
+ const FAIL_FAST = IS_DEV ? ["--fail-fast"] : [];
18
+ const FORMAT =
19
+ process.env.CI || !process.stdout.isTTY ? "progress" : "progress-bar";
20
+
21
+ exports.default = [
22
+ ...FAIL_FAST,
23
+ `--format ${FORMAT}`,
24
+ `--parallel ${CPU_COUNT}`,
25
+
26
+ // "test/**/*.feature",
27
+ "test/specs/**/*.feature",
28
+
29
+ `--tags "@testsuite:squatch-js and not @skip"`,
30
+
31
+ // Babel and jsDom make our code work as if it's in the browser
32
+ // "--require-module jsdom-global/register",
33
+ // "--require-module ts-node/register",
34
+ "--require-module " + __dirname + "/babelregister.js",
35
+ // '--require-module source-map-support/register',
36
+
37
+ // Order matters -- these setups need to happen first
38
+ // "--require tests/cucumber-setup/loaders.ts",
39
+
40
+ // Step definitions go last
41
+ "--require test/step_definitions/**/steps.ts",
42
+ // "--require test/step_definitions/**/*.tsx",
43
+
44
+ // '--format usage',
45
+ ].join(" ");