@playwright/test 1.34.0-alpha-may-4-2023 → 1.34.0-alpha-may-5-2023

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/jsx-runtime.js ADDED
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ function jsx(type, props) {
18
+ return {
19
+ type,
20
+ props,
21
+ };
22
+ }
23
+
24
+ function jsxs(type, props) {
25
+ return {
26
+ type,
27
+ props,
28
+ };
29
+ }
30
+
31
+ module.exports = {
32
+ jsx,
33
+ jsxs,
34
+ };
package/lib/cli.js CHANGED
@@ -10,6 +10,7 @@ var _merge = require("./reporters/merge");
10
10
  var _configLoader = require("./common/configLoader");
11
11
  var _config = require("./common/config");
12
12
  var _program = _interopRequireDefault(require("playwright-core/lib/cli/program"));
13
+ var _base = require("./reporters/base");
13
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
15
  /**
15
16
  * Copyright (c) Microsoft Corporation.
@@ -130,18 +131,29 @@ async function runTests(args, opts) {
130
131
  }
131
132
  async function listTestFiles(opts) {
132
133
  // Redefine process.stdout.write in case config decides to pollute stdio.
133
- const write = process.stdout.write.bind(process.stdout);
134
+ const stdoutWrite = process.stdout.write.bind(process.stdout);
134
135
  process.stdout.write = () => {};
136
+ process.stderr.write = () => {};
135
137
  const configFileOrDirectory = opts.config ? _path.default.resolve(process.cwd(), opts.config) : process.cwd();
136
138
  const resolvedConfigFile = (0, _configLoader.resolveConfigFile)(configFileOrDirectory);
137
139
  if (restartWithExperimentalTsEsm(resolvedConfigFile)) return;
138
- const configLoader = new _configLoader.ConfigLoader();
139
- const config = await configLoader.loadConfigFile(resolvedConfigFile);
140
- const runner = new _runner.Runner(config);
141
- const report = await runner.listTestFiles(opts.project);
142
- write(JSON.stringify(report), () => {
143
- process.exit(0);
144
- });
140
+ try {
141
+ const configLoader = new _configLoader.ConfigLoader();
142
+ const config = await configLoader.loadConfigFile(resolvedConfigFile);
143
+ const runner = new _runner.Runner(config);
144
+ const report = await runner.listTestFiles(opts.project);
145
+ stdoutWrite(JSON.stringify(report), () => {
146
+ process.exit(0);
147
+ });
148
+ } catch (e) {
149
+ const error = (0, _util.serializeError)(e);
150
+ error.location = (0, _base.prepareErrorStack)(e.stack).location;
151
+ stdoutWrite(JSON.stringify({
152
+ error
153
+ }), () => {
154
+ process.exit(0);
155
+ });
156
+ }
145
157
  }
146
158
  async function mergeReports(reportDir, opts) {
147
159
  let configFile = opts.config;
@@ -2113,4 +2113,4 @@ If you are using Webpack or Rollup and thus don't want
2113
2113
  Babel to transpile your imports and exports, you can use
2114
2114
  the @babel/plugin-syntax-dynamic-import plugin and let your
2115
2115
  bundler handle dynamic imports.
2116
- `,tDe=(0,Jwe.declare)(e=>(e.assertVersion(7),{name:"proposal-dynamic-import",inherits:Qwe.default,pre(){this.file.set("@babel/plugin-proposal-dynamic-import","7.18.6")},visitor:{Program(){let t=this.file.get("@babel/plugin-transform-modules-*");if(!Zwe.includes(t))throw new Error(eDe)}}}));pd.default=tDe});var qF=T(dd=>{"use strict";Object.defineProperty(dd,"__esModule",{value:!0});dd.default=void 0;var rDe=nt(),nDe=(0,rDe.declare)(e=>(e.assertVersion(7),{name:"syntax-import-assertions",manipulateOptions(t,r){r.plugins.push("importAssertions")}}));dd.default=nDe});var oDe={};eB(oDe,{babelTransform:()=>aDe,codeFrameColumns:()=>KF.codeFrameColumns,declare:()=>WF.declare,parse:()=>zF.parse,setBabelPlugins:()=>sDe,traverse:()=>iDe,types:()=>GF.types});module.exports=tB(oDe);var UF=ls(Pt()),KF=ls(Is()),WF=ls(nt()),GF=ls(Pt()),zF=ls($s()),$F=ls(gr()),iDe=$F.default,VF=[];function sDe(e){VF=e}function aDe(e,t,r,n){let i=[];return t&&i.push([iF(),{version:"2022-03"}],[aF()],[uF()],[pF()],[hF()],[yF()],[TF()],[SF()],[xF()],[PF()],[AF()],[CF()],[DF()],[({template:s})=>({name:"replace-ts-export-assignment",visitor:{TSExportAssignment(a){a.replaceWith(s("module.exports = ASSIGNMENT;")({ASSIGNMENT:a.node.expression}))}}})]),i.push([kF()]),r?i.push([qF()]):(i.push([jF()]),i.push([RF()])),i.unshift(...VF.map(([s,a])=>[require(s),a])),n&&i.push([n]),UF.transformFileSync(e,{babelrc:!1,configFile:!1,assumptions:{setPublicClassFields:!0},presets:[[tT(),{onlyRemoveTypeImports:!1}]],plugins:i,sourceMaps:"both"})}0&&(module.exports={babelTransform,codeFrameColumns,declare,parse,setBabelPlugins,traverse,types});
2116
+ `,tDe=(0,Jwe.declare)(e=>(e.assertVersion(7),{name:"proposal-dynamic-import",inherits:Qwe.default,pre(){this.file.set("@babel/plugin-proposal-dynamic-import","7.18.6")},visitor:{Program(){let t=this.file.get("@babel/plugin-transform-modules-*");if(!Zwe.includes(t))throw new Error(eDe)}}}));pd.default=tDe});var qF=T(dd=>{"use strict";Object.defineProperty(dd,"__esModule",{value:!0});dd.default=void 0;var rDe=nt(),nDe=(0,rDe.declare)(e=>(e.assertVersion(7),{name:"syntax-import-assertions",manipulateOptions(t,r){r.plugins.push("importAssertions")}}));dd.default=nDe});var oDe={};eB(oDe,{babelTransform:()=>aDe,codeFrameColumns:()=>KF.codeFrameColumns,declare:()=>WF.declare,parse:()=>zF.parse,setBabelPlugins:()=>sDe,traverse:()=>iDe,types:()=>GF.types});module.exports=tB(oDe);var UF=ls(Pt()),KF=ls(Is()),WF=ls(nt()),GF=ls(Pt()),zF=ls($s()),$F=ls(gr()),iDe=$F.default,VF=[];function sDe(e){VF=e}function aDe(e,t,r,n){let i=[];return t&&i.push([iF(),{version:"2022-03"}],[aF()],[uF()],[pF()],[hF()],[yF()],[TF()],[SF()],[xF()],[PF()],[AF()],[CF()],[DF()],[({template:s})=>({name:"replace-ts-export-assignment",visitor:{TSExportAssignment(a){a.replaceWith(s("module.exports = ASSIGNMENT;")({ASSIGNMENT:a.node.expression}))}}})]),i.push([kF(),{runtime:"automatic",importSource:"@playwright/test"}]),r?i.push([qF()]):(i.push([jF()]),i.push([RF()])),i.unshift(...VF.map(([s,a])=>[require(s),a])),n&&i.push([n]),UF.transformFileSync(e,{babelrc:!1,configFile:!1,assumptions:{setPublicClassFields:!0},presets:[[tT(),{onlyRemoveTypeImports:!1}]],plugins:i,sourceMaps:"both"})}0&&(module.exports={babelTransform,codeFrameColumns,declare,parse,setBabelPlugins,traverse,types});
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.BaseReporter = void 0;
7
- exports.addSnippetToError = addSnippetToError;
8
7
  exports.formatError = formatError;
9
8
  exports.formatFailure = formatFailure;
10
9
  exports.formatResultFailure = formatResultFailure;
@@ -17,9 +16,7 @@ exports.stepSuffix = stepSuffix;
17
16
  exports.stripAnsiEscapes = stripAnsiEscapes;
18
17
  exports.uniqueProjectIds = uniqueProjectIds;
19
18
  var _utilsBundle = require("playwright-core/lib/utilsBundle");
20
- var _fs = _interopRequireDefault(require("fs"));
21
19
  var _path = _interopRequireDefault(require("path"));
22
- var _babelBundle = require("../common/babelBundle");
23
20
  var _utils = require("playwright-core/lib/utils");
24
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
22
  /**
@@ -400,29 +397,6 @@ function formatError(config, error, highlightCode) {
400
397
  message: tokens.join('\n')
401
398
  };
402
399
  }
403
- function addSnippetToError(config, error, file) {
404
- let location = error.location;
405
- if (error.stack && !location) location = prepareErrorStack(error.stack).location;
406
- if (!location) return;
407
- try {
408
- const tokens = [];
409
- const source = _fs.default.readFileSync(location.file, 'utf8');
410
- const codeFrame = (0, _babelBundle.codeFrameColumns)(source, {
411
- start: location
412
- }, {
413
- highlightCode: true
414
- });
415
- // Convert /var/folders to /private/var/folders on Mac.
416
- if (!file || _fs.default.realpathSync(file) !== location.file) {
417
- tokens.push(_utilsBundle.colors.gray(` at `) + `${relativeFilePath(config, location.file)}:${location.line}`);
418
- tokens.push('');
419
- }
420
- tokens.push(codeFrame);
421
- error.snippet = tokens.join('\n');
422
- } catch (e) {
423
- // Failed to read the source file - that's ok.
424
- }
425
- }
426
400
  function separator(text = '') {
427
401
  var _process$stdout;
428
402
  if (text) text += ' ';
@@ -4,9 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.InternalReporter = void 0;
7
+ var _fs = _interopRequireDefault(require("fs"));
8
+ var _utilsBundle = require("playwright-core/lib/utilsBundle");
9
+ var _babelBundle = require("../common/babelBundle");
7
10
  var _test = require("../common/test");
8
- var _base = require("./base");
9
11
  var _multiplexer = require("./multiplexer");
12
+ var _base = require("./base");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
14
  /**
11
15
  * Copyright (c) Microsoft Corporation.
12
16
  *
@@ -92,7 +96,7 @@ class InternalReporter {
92
96
  });
93
97
  return;
94
98
  }
95
- (0, _base.addSnippetToError)(this._config.config, error);
99
+ addLocationAndSnippetToError(this._config.config, error);
96
100
  this._multiplexer.onError(error);
97
101
  }
98
102
  onStepBegin(test, result, step) {
@@ -103,10 +107,33 @@ class InternalReporter {
103
107
  this._multiplexer.onStepEnd(test, result, step);
104
108
  }
105
109
  _addSnippetToTestErrors(test, result) {
106
- for (const error of result.errors) (0, _base.addSnippetToError)(this._config.config, error, test.location.file);
110
+ for (const error of result.errors) addLocationAndSnippetToError(this._config.config, error, test.location.file);
107
111
  }
108
112
  _addSnippetToStepError(test, step) {
109
- if (step.error) (0, _base.addSnippetToError)(this._config.config, step.error, test.location.file);
113
+ if (step.error) addLocationAndSnippetToError(this._config.config, step.error, test.location.file);
110
114
  }
111
115
  }
112
- exports.InternalReporter = InternalReporter;
116
+ exports.InternalReporter = InternalReporter;
117
+ function addLocationAndSnippetToError(config, error, file) {
118
+ if (error.stack && !error.location) error.location = (0, _base.prepareErrorStack)(error.stack).location;
119
+ const location = error.location;
120
+ if (!location) return;
121
+ try {
122
+ const tokens = [];
123
+ const source = _fs.default.readFileSync(location.file, 'utf8');
124
+ const codeFrame = (0, _babelBundle.codeFrameColumns)(source, {
125
+ start: location
126
+ }, {
127
+ highlightCode: true
128
+ });
129
+ // Convert /var/folders to /private/var/folders on Mac.
130
+ if (!file || _fs.default.realpathSync(file) !== location.file) {
131
+ tokens.push(_utilsBundle.colors.gray(` at `) + `${(0, _base.relativeFilePath)(config, location.file)}:${location.line}`);
132
+ tokens.push('');
133
+ }
134
+ tokens.push(codeFrame);
135
+ error.snippet = tokens.join('\n');
136
+ } catch (e) {
137
+ // Failed to read the source file - that's ok.
138
+ }
139
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playwright/test",
3
- "version": "1.34.0-alpha-may-4-2023",
3
+ "version": "1.34.0-alpha-may-5-2023",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": "github:Microsoft/playwright",
6
6
  "homepage": "https://playwright.dev",
@@ -23,6 +23,7 @@
23
23
  "./lib/internalsForTest": "./lib/internalsForTest.js",
24
24
  "./lib/experimentalLoader": "./lib/experimentalLoader.js",
25
25
  "./lib/plugins": "./lib/plugins/index.js",
26
+ "./jsx-runtime": "./jsx-runtime.js",
26
27
  "./lib/util": "./lib/util.js",
27
28
  "./lib/utilsBundle": "./lib/utilsBundle.js",
28
29
  "./reporter": "./reporter.js"
@@ -36,7 +37,7 @@
36
37
  "license": "Apache-2.0",
37
38
  "dependencies": {
38
39
  "@types/node": "*",
39
- "playwright-core": "1.34.0-alpha-may-4-2023"
40
+ "playwright-core": "1.34.0-alpha-may-5-2023"
40
41
  },
41
42
  "optionalDependencies": {
42
43
  "fsevents": "2.3.2"