@intuned/runtime-dev 1.3.18-dev.2 → 1.3.18-dev.4
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.
|
@@ -4,6 +4,7 @@ var _vitest = require("vitest");
|
|
|
4
4
|
var _browser = require("../browser");
|
|
5
5
|
var _launchBrowser = require("../../../../common/launchBrowser");
|
|
6
6
|
var _errors = require("../errors");
|
|
7
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
7
8
|
function getTerminal() {
|
|
8
9
|
return new Proxy(() => ({}), {
|
|
9
10
|
get: () => getTerminal(),
|
|
@@ -121,6 +122,42 @@ _vitest.vi.mock("../../../../common/browserTabs", () => {
|
|
|
121
122
|
cdpAddress: "http://localhost:1234"
|
|
122
123
|
}));
|
|
123
124
|
});
|
|
125
|
+
(0, _vitest.it)("launches a browser with ignoreHttpErrors set to true when configured", async () => {
|
|
126
|
+
const {
|
|
127
|
+
getIgnoreHttpErrorsFromConfig
|
|
128
|
+
} = await Promise.resolve().then(() => _interopRequireWildcard(require("../../../../common/launchBrowser")));
|
|
129
|
+
_vitest.vi.mocked(getIgnoreHttpErrorsFromConfig).mockResolvedValueOnce(true);
|
|
130
|
+
const options = await (0, _browser.getCLIRunOptions)({
|
|
131
|
+
keepBrowserOpen: true,
|
|
132
|
+
headless: false
|
|
133
|
+
});
|
|
134
|
+
(0, _vitest.expect)(_launchBrowser.launchChromium).toHaveBeenCalledWith({
|
|
135
|
+
headless: false,
|
|
136
|
+
cdpPort: 1234,
|
|
137
|
+
ignoreHttpErrors: true
|
|
138
|
+
});
|
|
139
|
+
(0, _vitest.expect)(options).toEqual(_vitest.expect.objectContaining({
|
|
140
|
+
environment: "cdp",
|
|
141
|
+
cdpAddress: "http://localhost:1234"
|
|
142
|
+
}));
|
|
143
|
+
});
|
|
144
|
+
(0, _vitest.it)("passes CLI ignoreHttpErrors option to getIgnoreHttpErrorsFromConfig", async () => {
|
|
145
|
+
const {
|
|
146
|
+
getIgnoreHttpErrorsFromConfig
|
|
147
|
+
} = await Promise.resolve().then(() => _interopRequireWildcard(require("../../../../common/launchBrowser")));
|
|
148
|
+
_vitest.vi.mocked(getIgnoreHttpErrorsFromConfig).mockResolvedValueOnce(true);
|
|
149
|
+
await (0, _browser.getCLIRunOptions)({
|
|
150
|
+
keepBrowserOpen: true,
|
|
151
|
+
headless: false,
|
|
152
|
+
ignoreHttpErrors: true
|
|
153
|
+
});
|
|
154
|
+
(0, _vitest.expect)(getIgnoreHttpErrorsFromConfig).toHaveBeenCalledWith(true);
|
|
155
|
+
(0, _vitest.expect)(_launchBrowser.launchChromium).toHaveBeenCalledWith({
|
|
156
|
+
headless: false,
|
|
157
|
+
cdpPort: 1234,
|
|
158
|
+
ignoreHttpErrors: true
|
|
159
|
+
});
|
|
160
|
+
});
|
|
124
161
|
(0, _vitest.it)("keeps context open until new context", async () => {
|
|
125
162
|
await (0, _browser.getCLIRunOptions)({
|
|
126
163
|
keepBrowserOpen: true,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getBrowserType = getBrowserType;
|
|
7
|
+
exports.getIgnoreHttpErrors = getIgnoreHttpErrors;
|
|
8
|
+
function getBrowserType() {
|
|
9
|
+
return process.env.BROWSER_TYPE;
|
|
10
|
+
}
|
|
11
|
+
function getIgnoreHttpErrors() {
|
|
12
|
+
const envValue = process.env.IGNORE_HTTP_ERRORS;
|
|
13
|
+
if (envValue === undefined) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
return envValue.toLowerCase() === "true" || envValue === "1" || envValue.toLowerCase() === "yes";
|
|
17
|
+
}
|
|
@@ -7,7 +7,7 @@ export interface Proxy {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Get ignore_http_errors setting from CLI option, Intuned.json, or environment variable.
|
|
10
|
-
* Priority: cliOption > environment variable >
|
|
10
|
+
* Priority: cliOption > Intuned.json > environment variable > false
|
|
11
11
|
*/
|
|
12
12
|
export declare function getIgnoreHttpErrorsFromConfig(cliOption?: boolean): Promise<boolean>;
|
|
13
13
|
export type LaunchBrowserResult = {
|
|
@@ -22,6 +22,7 @@ var _util = require("util");
|
|
|
22
22
|
var _neverthrow = require("neverthrow");
|
|
23
23
|
var _zod = require("zod");
|
|
24
24
|
var _intunedJson = require("./intunedJson");
|
|
25
|
+
var _env = require("./env");
|
|
25
26
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
26
27
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
27
28
|
const execAsync = (0, _util.promisify)(_child_process.exec);
|
|
@@ -44,16 +45,16 @@ async function getIgnoreHttpErrorsFromConfig(cliOption) {
|
|
|
44
45
|
if (cliOption !== undefined) {
|
|
45
46
|
return cliOption;
|
|
46
47
|
}
|
|
47
|
-
const envValue = process.env.IGNORE_HTTP_ERRORS;
|
|
48
|
-
if (envValue !== undefined) {
|
|
49
|
-
return envValue.toLowerCase() === "true" || envValue === "1" || envValue.toLowerCase() === "yes";
|
|
50
|
-
}
|
|
51
48
|
try {
|
|
52
49
|
const intunedJsonResult = await (0, _intunedJson.loadIntunedJson)();
|
|
53
50
|
if (intunedJsonResult.isOk() && intunedJsonResult.value.ignoreHttpErrors !== undefined) {
|
|
54
51
|
return intunedJsonResult.value.ignoreHttpErrors;
|
|
55
52
|
}
|
|
56
53
|
} catch (error) {}
|
|
54
|
+
const envValue = process.env.IGNORE_HTTP_ERRORS;
|
|
55
|
+
if (envValue !== undefined) {
|
|
56
|
+
return envValue.toLowerCase() === "true" || envValue === "1" || envValue.toLowerCase() === "yes";
|
|
57
|
+
}
|
|
57
58
|
return false;
|
|
58
59
|
}
|
|
59
60
|
async function launchChromium(options) {
|
|
@@ -94,11 +95,16 @@ async function launchChromium(options) {
|
|
|
94
95
|
cdpPort,
|
|
95
96
|
proxy,
|
|
96
97
|
downloadsPath,
|
|
97
|
-
ignoreHttpErrors
|
|
98
|
+
ignoreHttpErrors: ignoreHttpErrorsParam
|
|
98
99
|
} = options;
|
|
99
100
|
let {
|
|
100
101
|
executablePath
|
|
101
102
|
} = options;
|
|
103
|
+
const envIgnoreHttpErrors = (0, _env.getIgnoreHttpErrors)();
|
|
104
|
+
let ignoreHttpErrors = ignoreHttpErrorsParam;
|
|
105
|
+
if (envIgnoreHttpErrors === true && ignoreHttpErrors === undefined) {
|
|
106
|
+
ignoreHttpErrors = true;
|
|
107
|
+
}
|
|
102
108
|
const defaultArgsToIgnore = ["--disable-extensions", "--disable-component-extensions-with-background-pages", "--disable-background-networking", "--disable-backgrounding-occluded-windows", "--disable-background-timer-throttling"];
|
|
103
109
|
const extraArgs = [];
|
|
104
110
|
const userDataDir = await createUserDirWithPreferences();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/runtime-dev",
|
|
3
|
-
"version": "1.3.18-dev.
|
|
3
|
+
"version": "1.3.18-dev.4",
|
|
4
4
|
"description": "Intuned runtime",
|
|
5
5
|
"packageManager": "yarn@4.12.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"babel-preset-minify": "^0.5.2",
|
|
129
129
|
"copyfiles": "^2.4.1",
|
|
130
130
|
"dts-bundle-generator": "^8.0.1",
|
|
131
|
-
"eslint": "
|
|
131
|
+
"eslint": "^8.57.0",
|
|
132
132
|
"eslint-config-prettier": "^8.3.0",
|
|
133
133
|
"eslint-plugin-deprecation": "^1.3.3",
|
|
134
134
|
"eslint-plugin-prettier": "^4.2.1",
|