@intuned/runtime-dev 1.3.18-dev.3 → 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,
@@ -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 > Intuned.json > false
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 = {
@@ -45,16 +45,16 @@ async function getIgnoreHttpErrorsFromConfig(cliOption) {
45
45
  if (cliOption !== undefined) {
46
46
  return cliOption;
47
47
  }
48
- const envValue = process.env.IGNORE_HTTP_ERRORS;
49
- if (envValue !== undefined) {
50
- return envValue.toLowerCase() === "true" || envValue === "1" || envValue.toLowerCase() === "yes";
51
- }
52
48
  try {
53
49
  const intunedJsonResult = await (0, _intunedJson.loadIntunedJson)();
54
50
  if (intunedJsonResult.isOk() && intunedJsonResult.value.ignoreHttpErrors !== undefined) {
55
51
  return intunedJsonResult.value.ignoreHttpErrors;
56
52
  }
57
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
+ }
58
58
  return false;
59
59
  }
60
60
  async function launchChromium(options) {
@@ -89,22 +89,22 @@ async function launchChromium(options) {
89
89
  context
90
90
  };
91
91
  }
92
- let {
92
+ const {
93
93
  headless,
94
94
  appModeInitialUrl,
95
95
  cdpPort,
96
96
  proxy,
97
97
  downloadsPath,
98
- ignoreHttpErrors
98
+ ignoreHttpErrors: ignoreHttpErrorsParam
99
99
  } = options;
100
100
  let {
101
101
  executablePath
102
102
  } = options;
103
103
  const envIgnoreHttpErrors = (0, _env.getIgnoreHttpErrors)();
104
+ let ignoreHttpErrors = ignoreHttpErrorsParam;
104
105
  if (envIgnoreHttpErrors === true && ignoreHttpErrors === undefined) {
105
106
  ignoreHttpErrors = true;
106
107
  }
107
- console.log(`[ignore_http_errors] launchChromium: param=${options.ignoreHttpErrors}, env=${envIgnoreHttpErrors}, final=${ignoreHttpErrors}`);
108
108
  const defaultArgsToIgnore = ["--disable-extensions", "--disable-component-extensions-with-background-pages", "--disable-background-networking", "--disable-backgrounding-occluded-windows", "--disable-background-timer-throttling"];
109
109
  const extraArgs = [];
110
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",
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": "7.32.0",
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",