@saasquatch/squatch-js 2.5.1-9 → 2.6.0-0
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.
- package/.github/workflows/size-limit.yml +15 -0
- package/CHANGELOG.md +326 -334
- package/LICENSE +20 -20
- package/README.md +180 -145
- package/babel.config.js +8 -0
- package/coverage/clover.xml +888 -0
- package/coverage/coverage-final.json +23 -0
- package/coverage/lcov-report/api/AnalyticsApi.ts.html +304 -0
- package/coverage/lcov-report/api/WidgetApi.ts.html +628 -0
- package/coverage/lcov-report/api/graphql.ts.html +130 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/utils/cookieUtils.ts.html +415 -0
- package/coverage/lcov-report/utils/decodeUserJwt.ts.html +133 -0
- package/coverage/lcov-report/utils/domready.ts.html +160 -0
- package/coverage/lcov-report/utils/io.ts.html +385 -0
- package/coverage/lcov-report/utils/utmUtils.ts.html +277 -0
- package/coverage/lcov-report/utils/validate.ts.html +268 -0
- package/coverage/lcov-report/validate.ts.html +268 -0
- package/coverage/lcov-report/widgets/EmbedWidget.ts.html +436 -0
- package/coverage/lcov-report/widgets/PopupWidget.ts.html +625 -0
- package/coverage/lcov-report/widgets/Widget.ts.html +1108 -0
- package/coverage/lcov-report/widgets/declarative/DeclarativeWidget.ts.html +499 -0
- package/coverage/lcov.info +1628 -0
- package/demo/sandbox.ts +124 -124
- package/demo/toolbar.tsx +526 -526
- package/dist/api/AnalyticsApi.d.ts +32 -32
- package/dist/api/EventsApi.d.ts +52 -52
- package/dist/api/WidgetApi.d.ts +63 -80
- package/dist/api/graphql.d.ts +1 -1
- package/dist/async.d.ts +15 -11
- package/dist/docs.d.ts +1 -1
- package/dist/squatch.d.ts +108 -108
- package/dist/squatch.esm.js +1105 -1417
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +1105 -1438
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +2 -13
- package/dist/squatch.min.js.LICENSE.txt +6 -0
- package/dist/squatch.min.js.map +1 -1
- package/dist/squatch.modern.js +1 -1
- package/dist/squatch.modern.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/types.d.ts +107 -106
- package/dist/utils/cookieUtils.d.ts +2 -2
- package/dist/utils/decodeUserJwt.d.ts +2 -0
- package/dist/utils/domUtils.d.ts +1 -0
- package/dist/utils/domready.d.ts +6 -6
- package/dist/utils/io.d.ts +5 -13
- package/dist/utils/loadEvent.d.ts +2 -0
- package/dist/utils/utmUtils.d.ts +14 -14
- package/dist/utils/validate.d.ts +12 -16
- package/dist/widgets/EmbedWidget.d.ts +16 -15
- package/dist/widgets/IREmbedWidget.d.ts +29 -0
- package/dist/widgets/IRPopupWidget.d.ts +32 -0
- package/dist/widgets/PopupWidget.d.ts +25 -23
- package/dist/widgets/Widget.d.ts +53 -33
- package/dist/widgets/Widgets.d.ts +108 -116
- package/dist/widgets/declarative/DeclarativeEmbedWidget.d.ts +12 -0
- package/dist/widgets/declarative/DeclarativeWidget.d.ts +32 -0
- package/dist/widgets/declarative/DeclarativeWidgets.d.ts +13 -0
- package/jest.config.ts +202 -0
- package/package.json +123 -105
- package/stats.json +1 -0
- package/tsconfig.json +2 -2
|
@@ -1,116 +1,108 @@
|
|
|
1
|
-
import WidgetApi from "../api/WidgetApi";
|
|
2
|
-
import { WidgetResult, WithRequired } from "../types";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* @param {
|
|
38
|
-
* @param {
|
|
39
|
-
* @param {
|
|
40
|
-
* @param {
|
|
41
|
-
* @param {
|
|
42
|
-
* @param {
|
|
43
|
-
* @param {string} config.
|
|
44
|
-
*
|
|
45
|
-
* @
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @param {
|
|
58
|
-
* @param {
|
|
59
|
-
* @param {
|
|
60
|
-
* @param {
|
|
61
|
-
* @param {
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* @
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
* @
|
|
88
|
-
* @param {Object}
|
|
89
|
-
* @param {string}
|
|
90
|
-
* @
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
* @
|
|
96
|
-
* @
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
* @
|
|
103
|
-
* @param {
|
|
104
|
-
*
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
* @param {Object} target Object containing the target DOM element
|
|
110
|
-
* @param {Widget} widget A widget (EmbedWidget, PopupWidget, CtaWidget)
|
|
111
|
-
* @param {Object} params An object with valid parameters
|
|
112
|
-
* (e.g) {email:'email', firstName:'firstName'}
|
|
113
|
-
* @returns {void}
|
|
114
|
-
*/
|
|
115
|
-
private static _cb;
|
|
116
|
-
}
|
|
1
|
+
import WidgetApi from "../api/WidgetApi";
|
|
2
|
+
import { ConfigOptions, WidgetConfig, WidgetResult, WithRequired } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* `Widgets` is a factory for creating widgets. It's possible to build your own widgets using the
|
|
6
|
+
* {@link WidgetApi} but most people will prefer to use these easy methods.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export default class Widgets {
|
|
10
|
+
api: WidgetApi;
|
|
11
|
+
tenantAlias: string;
|
|
12
|
+
domain: string;
|
|
13
|
+
npmCdn: string;
|
|
14
|
+
/**
|
|
15
|
+
* Initialize a new {@link Widgets} instance.
|
|
16
|
+
*
|
|
17
|
+
* @param {ConfigOptions} config Config details
|
|
18
|
+
*
|
|
19
|
+
* @example <caption>Browser example</caption>
|
|
20
|
+
* var widgets = new squatch.Widgets({tenantAlias:'test_12b5bo1b25125'});
|
|
21
|
+
*
|
|
22
|
+
* @example <caption>Browserify/Webpack example</caption>
|
|
23
|
+
* var Widgets = require('@saasquatch/squatch-js').Widgets;
|
|
24
|
+
* var widgets = new Widgets({tenantAlias:'test_12b5bo1b25125'});
|
|
25
|
+
*
|
|
26
|
+
* @example <caption>Babel+Browserify/Webpack example</caption>
|
|
27
|
+
* import {Widgets} from '@saasquatch/squatch-js';
|
|
28
|
+
* let widgets = new Widgets({tenantAlias:'test_12b5bo1b25125'});
|
|
29
|
+
*/
|
|
30
|
+
constructor(configin: ConfigOptions);
|
|
31
|
+
/**
|
|
32
|
+
* This function calls the {@link WidgetApi.upsertUser} method, and it renders
|
|
33
|
+
* the widget if it is successful. Otherwise it shows the "error" widget.
|
|
34
|
+
*
|
|
35
|
+
* @param {Object} config Config details
|
|
36
|
+
* @param {Object} config.user The user details
|
|
37
|
+
* @param {string} config.user.id The user id
|
|
38
|
+
* @param {string} config.user.accountId The user account id
|
|
39
|
+
* @param {WidgetType} config.widgetType The content of the widget.
|
|
40
|
+
* @param {EngagementMedium} config.engagementMedium How to display the widget.
|
|
41
|
+
* @param {string} config.jwt the JSON Web Token (JWT) that is used to validate the data (can be disabled)
|
|
42
|
+
* @param {HTMLElement | string | undefined} config.container Element to load the widget into
|
|
43
|
+
* @param {string | undefined} config.trigger Trigger element for opening the popup widget
|
|
44
|
+
*
|
|
45
|
+
* @return {Promise<WidgetResult>} json object if true, with a Widget and user details.
|
|
46
|
+
*/
|
|
47
|
+
upsertUser(config: WithRequired<WidgetConfig, "user">): Promise<{
|
|
48
|
+
widget: any;
|
|
49
|
+
user: any;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* This function calls the {@link WidgetApi.render} method, and it renders
|
|
53
|
+
* the widget if it is successful. Otherwise it shows the "error" widget.
|
|
54
|
+
*
|
|
55
|
+
* @param {Object} config Config details
|
|
56
|
+
* @param {Object} config.user The user details
|
|
57
|
+
* @param {string} config.user.id The user id
|
|
58
|
+
* @param {string} config.user.accountId The user account id
|
|
59
|
+
* @param {WidgetType} config.widgetType The content of the widget.
|
|
60
|
+
* @param {EngagementMedium} config.engagementMedium How to display the widget.
|
|
61
|
+
* @param {string} config.jwt the JSON Web Token (JWT) that is used
|
|
62
|
+
* to validate the data (can be disabled)
|
|
63
|
+
*
|
|
64
|
+
* @return {Promise<WidgetResult>} json object if true, with a Widget and user details.
|
|
65
|
+
*/
|
|
66
|
+
render(config: WidgetConfig): Promise<WidgetResult | undefined>;
|
|
67
|
+
/**
|
|
68
|
+
* Autofills a referral code into an element when someone has been referred.
|
|
69
|
+
* Uses {@link WidgetApi.squatchReferralCookie} behind the scenes.
|
|
70
|
+
*
|
|
71
|
+
* @param selector Element class/id selector, or a callback function
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
autofill(selector: string | Function): void;
|
|
75
|
+
/**
|
|
76
|
+
* @hidden
|
|
77
|
+
* @param {Object} response The json object return from the WidgetApi
|
|
78
|
+
* @param {Object} config Config details
|
|
79
|
+
* @param {string} config.widgetType The widget type (REFERRER_WIDGET, CONVERSION_WIDGET)
|
|
80
|
+
* @param {string} config.engagementMedium (POPUP, EMBED)
|
|
81
|
+
* @returns {Widget} widget (PopupWidget or EmbedWidget)
|
|
82
|
+
*/
|
|
83
|
+
private _renderWidget;
|
|
84
|
+
private _renderPopupWidget;
|
|
85
|
+
private _renderEmbedWidget;
|
|
86
|
+
/**
|
|
87
|
+
* @hidden
|
|
88
|
+
* @param {Object} error The json object containing the error details
|
|
89
|
+
* @param {string} em The engagementMedium
|
|
90
|
+
* @returns {void}
|
|
91
|
+
*/
|
|
92
|
+
private _renderErrorWidget;
|
|
93
|
+
/**
|
|
94
|
+
* @hidden
|
|
95
|
+
* @param {string} rule A regular expression
|
|
96
|
+
* @returns {boolean} true if rule matches Url, false otherwise
|
|
97
|
+
*/
|
|
98
|
+
private static _matchesUrl;
|
|
99
|
+
/**
|
|
100
|
+
* @hidden
|
|
101
|
+
* @param {Object} target Object containing the target DOM element
|
|
102
|
+
* @param {Widget} widget A widget (EmbedWidget, PopupWidget)
|
|
103
|
+
* @param {Object} params An object with valid parameters
|
|
104
|
+
* (e.g) {email:'email', firstName:'firstName'}
|
|
105
|
+
* @returns {void}
|
|
106
|
+
*/
|
|
107
|
+
private static _cb;
|
|
108
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import DeclarativeWidget from "./DeclarativeWidget";
|
|
2
|
+
export declare class DeclarativeEmbedWidget extends DeclarativeWidget {
|
|
3
|
+
constructor();
|
|
4
|
+
static get observedAttributes(): string[];
|
|
5
|
+
attributeChangedCallback(attr: string, oldVal: string, newVal: string): void;
|
|
6
|
+
renderWidget(): void;
|
|
7
|
+
}
|
|
8
|
+
export declare class DeclarativePopupWidget extends DeclarativeWidget {
|
|
9
|
+
constructor();
|
|
10
|
+
static get observedAttributes(): string[];
|
|
11
|
+
attributeChangedCallback(attr: string, oldVal: string, newVal: string): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import AnalyticsApi from "../../api/AnalyticsApi";
|
|
2
|
+
import WidgetApi from "../../api/WidgetApi";
|
|
3
|
+
import { DeclarativeConfigOptions } from "../../types";
|
|
4
|
+
import EmbedWidget from "../EmbedWidget";
|
|
5
|
+
import PopupWidget from "../PopupWidget";
|
|
6
|
+
export default abstract class DeclarativeWidget extends HTMLElement {
|
|
7
|
+
config: DeclarativeConfigOptions | undefined;
|
|
8
|
+
token: string | undefined;
|
|
9
|
+
tenant: string | undefined;
|
|
10
|
+
widgetType: string | undefined;
|
|
11
|
+
widgetApi: WidgetApi;
|
|
12
|
+
analyticsApi: AnalyticsApi;
|
|
13
|
+
type: "EMBED" | "POPUP";
|
|
14
|
+
widgetInstance: EmbedWidget | PopupWidget;
|
|
15
|
+
frame: HTMLIFrameElement;
|
|
16
|
+
container: string | HTMLElement | undefined | null;
|
|
17
|
+
element: HTMLElement | undefined;
|
|
18
|
+
constructor();
|
|
19
|
+
private _setupApis;
|
|
20
|
+
renderPasswordlessVariant(): Promise<EmbedWidget | PopupWidget>;
|
|
21
|
+
renderUserUpsertVariant(): Promise<EmbedWidget | PopupWidget>;
|
|
22
|
+
_setWidget: (template: any, config: {
|
|
23
|
+
type: "upsert" | "passwordless";
|
|
24
|
+
}) => EmbedWidget | PopupWidget;
|
|
25
|
+
getWidgetInstance(): Promise<EmbedWidget | PopupWidget>;
|
|
26
|
+
renderWidget(): Promise<void>;
|
|
27
|
+
setErrorWidget: (e: Error) => EmbedWidget | PopupWidget;
|
|
28
|
+
open(): void;
|
|
29
|
+
close(): void;
|
|
30
|
+
show: () => void;
|
|
31
|
+
hide: () => void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import DeclarativeWidget from "./DeclarativeWidget";
|
|
2
|
+
export declare class DeclarativeEmbedWidget extends DeclarativeWidget {
|
|
3
|
+
constructor();
|
|
4
|
+
static get observedAttributes(): string[];
|
|
5
|
+
attributeChangedCallback(attr: string, oldVal: string, newVal: string): void;
|
|
6
|
+
connectedCallback(): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare class DeclarativePopupWidget extends DeclarativeWidget {
|
|
9
|
+
constructor();
|
|
10
|
+
static get observedAttributes(): string[];
|
|
11
|
+
attributeChangedCallback(attr: string, oldVal: string, newVal: string): void;
|
|
12
|
+
connectedCallback(): Promise<void>;
|
|
13
|
+
}
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* For a detailed explanation regarding each configuration property and type check, visit:
|
|
3
|
+
* https://jestjs.io/docs/configuration
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
// All imported modules in your tests should be mocked automatically
|
|
8
|
+
// automock: false,
|
|
9
|
+
|
|
10
|
+
// Stop running tests after `n` failures
|
|
11
|
+
// bail: 0,
|
|
12
|
+
|
|
13
|
+
// The directory where Jest should store its cached dependency information
|
|
14
|
+
// cacheDirectory: "/private/var/folders/zv/t83jrkg12jx3bqgq3vx_v29h0000gp/T/jest_dy",
|
|
15
|
+
|
|
16
|
+
// Automatically clear mock calls, instances, contexts and results before every test
|
|
17
|
+
// clearMocks: false,
|
|
18
|
+
|
|
19
|
+
// Indicates whether the coverage information should be collected while executing the test
|
|
20
|
+
// collectCoverage: false,
|
|
21
|
+
|
|
22
|
+
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
|
23
|
+
// collectCoverageFrom: undefined,
|
|
24
|
+
|
|
25
|
+
// The directory where Jest should output its coverage files
|
|
26
|
+
// coverageDirectory: "coverage",
|
|
27
|
+
|
|
28
|
+
// An array of regexp pattern strings used to skip coverage collection
|
|
29
|
+
// coveragePathIgnorePatterns: [
|
|
30
|
+
// "/node_modules/"
|
|
31
|
+
// ],
|
|
32
|
+
|
|
33
|
+
// Indicates which provider should be used to instrument code for coverage
|
|
34
|
+
// coverageProvider: "babel",
|
|
35
|
+
|
|
36
|
+
// A list of reporter names that Jest uses when writing coverage reports
|
|
37
|
+
// coverageReporters: [
|
|
38
|
+
// "json",
|
|
39
|
+
// "text",
|
|
40
|
+
// "lcov",
|
|
41
|
+
// "clover"
|
|
42
|
+
// ],
|
|
43
|
+
|
|
44
|
+
// An object that configures minimum threshold enforcement for coverage results
|
|
45
|
+
// coverageThreshold: undefined,
|
|
46
|
+
|
|
47
|
+
// A path to a custom dependency extractor
|
|
48
|
+
// dependencyExtractor: undefined,
|
|
49
|
+
|
|
50
|
+
// Make calling deprecated APIs throw helpful error messages
|
|
51
|
+
// errorOnDeprecated: false,
|
|
52
|
+
|
|
53
|
+
// The default configuration for fake timers
|
|
54
|
+
// fakeTimers: {
|
|
55
|
+
// "enableGlobally": false
|
|
56
|
+
// },
|
|
57
|
+
|
|
58
|
+
// Force coverage collection from ignored files using an array of glob patterns
|
|
59
|
+
// forceCoverageMatch: [],
|
|
60
|
+
|
|
61
|
+
// A path to a module which exports an async function that is triggered once before all test suites
|
|
62
|
+
// globalSetup: undefined,
|
|
63
|
+
|
|
64
|
+
// A path to a module which exports an async function that is triggered once after all test suites
|
|
65
|
+
// globalTeardown: undefined,
|
|
66
|
+
|
|
67
|
+
// A set of global variables that need to be available in all test environments
|
|
68
|
+
// globals: {},
|
|
69
|
+
|
|
70
|
+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
|
71
|
+
// maxWorkers: "50%",
|
|
72
|
+
|
|
73
|
+
// An array of directory names to be searched recursively up from the requiring module's location
|
|
74
|
+
moduleDirectories: ["node_modules"],
|
|
75
|
+
|
|
76
|
+
// An array of file extensions your modules use
|
|
77
|
+
// moduleFileExtensions: [
|
|
78
|
+
// "js",
|
|
79
|
+
// "mjs",
|
|
80
|
+
// "cjs",
|
|
81
|
+
// "jsx",
|
|
82
|
+
// "ts",
|
|
83
|
+
// "tsx",
|
|
84
|
+
// "json",
|
|
85
|
+
// "node"
|
|
86
|
+
// ],
|
|
87
|
+
|
|
88
|
+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
|
89
|
+
moduleNameMapper: {
|
|
90
|
+
"source-map-support/register": "identity-obj-proxy",
|
|
91
|
+
"^uuid$": "uuid",
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
|
95
|
+
// modulePathIgnorePatterns: [],
|
|
96
|
+
|
|
97
|
+
// Activates notifications for test results
|
|
98
|
+
// notify: false,
|
|
99
|
+
|
|
100
|
+
// An enum that specifies notification mode. Requires { notify: true }
|
|
101
|
+
// notifyMode: "failure-change",
|
|
102
|
+
|
|
103
|
+
// A preset that is used as a base for Jest's configuration
|
|
104
|
+
preset: "ts-jest",
|
|
105
|
+
|
|
106
|
+
// Run tests from one or more projects
|
|
107
|
+
// projects: undefined,
|
|
108
|
+
|
|
109
|
+
// Use this configuration option to add custom reporters to Jest
|
|
110
|
+
// reporters: undefined,
|
|
111
|
+
|
|
112
|
+
// Automatically reset mock state before every test
|
|
113
|
+
// resetMocks: false,
|
|
114
|
+
|
|
115
|
+
// Reset the module registry before running each individual test
|
|
116
|
+
// resetModules: false,
|
|
117
|
+
|
|
118
|
+
// A path to a custom resolver
|
|
119
|
+
// resolver: undefined,
|
|
120
|
+
|
|
121
|
+
// Automatically restore mock state and implementation before every test
|
|
122
|
+
// restoreMocks: false,
|
|
123
|
+
|
|
124
|
+
// The root directory that Jest should scan for tests and modules within
|
|
125
|
+
// rootDir: undefined,
|
|
126
|
+
|
|
127
|
+
// A list of paths to directories that Jest should use to search for files in
|
|
128
|
+
// roots: [
|
|
129
|
+
// "<rootDir>"
|
|
130
|
+
// ],
|
|
131
|
+
|
|
132
|
+
// Allows you to use a custom runner instead of Jest's default test runner
|
|
133
|
+
// runner: "jest-runner",
|
|
134
|
+
|
|
135
|
+
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
136
|
+
// setupFiles: [],
|
|
137
|
+
|
|
138
|
+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
|
139
|
+
// setupFilesAfterEnv: [],
|
|
140
|
+
|
|
141
|
+
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
|
142
|
+
// slowTestThreshold: 5,
|
|
143
|
+
|
|
144
|
+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
|
145
|
+
// snapshotSerializers: [],
|
|
146
|
+
|
|
147
|
+
// The test environment that will be used for testing
|
|
148
|
+
testEnvironment: "@happy-dom/jest-environment",
|
|
149
|
+
|
|
150
|
+
// Options that will be passed to the testEnvironment
|
|
151
|
+
testEnvironmentOptions: {
|
|
152
|
+
resources: "usable",
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
// Adds a location field to test results
|
|
156
|
+
// testLocationInResults: false,
|
|
157
|
+
|
|
158
|
+
// The glob patterns Jest uses to detect test files
|
|
159
|
+
testMatch: [
|
|
160
|
+
"**/*.steps.[tj]s",
|
|
161
|
+
"**/__tests__/**/*.[jt]s?(x)",
|
|
162
|
+
"**/?(*.)+(spec|test).[tj]s?(x)",
|
|
163
|
+
],
|
|
164
|
+
|
|
165
|
+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
|
166
|
+
// testPathIgnorePatterns: [
|
|
167
|
+
// "/node_modules/"
|
|
168
|
+
// ],
|
|
169
|
+
|
|
170
|
+
// The regexp pattern or array of patterns that Jest uses to detect test files
|
|
171
|
+
// testRegex: [],
|
|
172
|
+
|
|
173
|
+
// This option allows the use of a custom results processor
|
|
174
|
+
// testResultsProcessor: undefined,
|
|
175
|
+
|
|
176
|
+
// This option allows use of a custom test runner
|
|
177
|
+
// testRunner: "jest-circus/runner",
|
|
178
|
+
|
|
179
|
+
// A map from regular expressions to paths to transformers
|
|
180
|
+
transform: {
|
|
181
|
+
"^.+\\.(ts|tsx)?$": "ts-jest",
|
|
182
|
+
"^.+\\.(js|jsx)$": "babel-jest",
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
|
186
|
+
transformIgnorePatterns: [
|
|
187
|
+
"node_modules/(?!(@open-wc|lit|jest-cucumber|lit-html|@lit|lit-element)/)",
|
|
188
|
+
"\\.pnp\\.[^\\/]+$",
|
|
189
|
+
],
|
|
190
|
+
|
|
191
|
+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
|
192
|
+
// unmockedModulePathPatterns: undefined,
|
|
193
|
+
|
|
194
|
+
// Indicates whether each individual test should be reported during the run
|
|
195
|
+
// verbose: undefined,
|
|
196
|
+
|
|
197
|
+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
|
198
|
+
// watchPathIgnorePatterns: [],
|
|
199
|
+
|
|
200
|
+
// Whether to use watchman for file crawling
|
|
201
|
+
// watchman: true,
|
|
202
|
+
};
|