diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts index bae7a591a3..dc847a2dd7 100755 --- a/.github/workflows/ci.generate.ts +++ b/.github/workflows/ci.generate.ts @@ -652,6 +652,14 @@ const ci = { "cache-path": "./target", }, }, + { + name: "Set up playwright cache", + uses: "actions/cache@v4", + with: { + path: "./.ms-playwright", + key: "playwright-${{ runner.os }}-${{ runner.arch }}", + }, + }, { name: "test_format.js", if: "matrix.job == 'lint' && matrix.os == 'linux'", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8555b55539..d51e75ff86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -383,6 +383,12 @@ jobs: uses: ./.github/mtime_cache with: cache-path: ./target + - name: Set up playwright cache + uses: actions/cache@v4 + with: + path: ./.ms-playwright + key: 'playwright-${{ runner.os }}-${{ runner.arch }}' + if: '!(matrix.skip)' - name: test_format.js if: '!(matrix.skip) && (matrix.job == ''lint'' && matrix.os == ''linux'')' run: deno run --allow-write --allow-read --allow-run --allow-net ./tools/format.js --check diff --git a/.gitignore b/.gitignore index 8be7f979d1..a332a06bff 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,7 @@ junit.xml # Jupyter files .ipynb_checkpoints/ -Untitled*.ipynb \ No newline at end of file +Untitled*.ipynb + +# playwright browser binary cache +/.ms-playwright diff --git a/ext/node/polyfills/net.ts b/ext/node/polyfills/net.ts index 8fde8eac1e..d7a3183e41 100644 --- a/ext/node/polyfills/net.ts +++ b/ext/node/polyfills/net.ts @@ -1239,7 +1239,7 @@ export class Socket extends Duplex { super(options); - // Note: If the socket is created from one of `pkgNeedsSockInitWorkaround`, + // Note: If the TCP/TLS socket is created from one of `pkgNeedsSockInitWorkaround`, // the 'socket' event on ClientRequest object happens after 'connect' event on Socket object. // That swaps the sequence of op_node_http_request_with_conn() call and // initial socket read. That causes op_node_http_request_with_conn() not @@ -1249,9 +1249,8 @@ export class Socket extends Duplex { // (and also skips the startTls call if it's TLSSocket) // TODO(kt3k): Remove this workaround const errorStack = new Error().stack; - this._needsSockInitWorkaround = pkgsNeedsSockInitWorkaround.some((pkg) => - errorStack?.includes(pkg) - ); + this._needsSockInitWorkaround = options.handle?.ipc !== true && + pkgsNeedsSockInitWorkaround.some((pkg) => errorStack?.includes(pkg)); if (this._needsSockInitWorkaround) { this.pause(); } diff --git a/tests/registry/npm/fsevents/fsevents-2.3.2.tgz b/tests/registry/npm/fsevents/fsevents-2.3.2.tgz new file mode 100644 index 0000000000..03e132a1ba Binary files /dev/null and b/tests/registry/npm/fsevents/fsevents-2.3.2.tgz differ diff --git a/tests/registry/npm/fsevents/registry.json b/tests/registry/npm/fsevents/registry.json index 333d0e6813..1784c7aae4 100644 --- a/tests/registry/npm/fsevents/registry.json +++ b/tests/registry/npm/fsevents/registry.json @@ -1,64 +1,109 @@ { "name": "fsevents", - "description": "Native Access to MacOS FSEvents", "dist-tags": { "latest": "2.3.3" }, "versions": { - "2.3.3": { + "2.3.2": { "name": "fsevents", - "version": "2.3.3", - "description": "Native Access to MacOS FSEvents", - "main": "fsevents.js", - "types": "fsevents.d.ts", - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - }, - "scripts": { - "clean": "node-gyp clean && rm -f fsevents.node", - "build": "node-gyp clean && rm -f fsevents.node && node-gyp rebuild && node-gyp clean", - "test": "/bin/bash ./test.sh 2>/dev/null", - "prepublishOnly": "npm run build", - "install": "node-gyp rebuild" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/fsevents/fsevents.git" - }, + "version": "2.3.2", "license": "MIT", + "_id": "fsevents@2.3.2", "bugs": { "url": "https://github.com/fsevents/fsevents/issues" }, - "devDependencies": { - "node-gyp": "^9.4.0" - }, - "gypfile": true, - "gitHead": "2db891e51aa0f2975c5eaaf6aa30f13d720a830a", - "_id": "fsevents@2.3.3", - "_nodeVersion": "18.17.1", - "_npmVersion": "9.6.7", + "os": [ + "darwin" + ], + "dist": { + "shasum": "8a526f78b8fdf4623b709e0b975c52c24c02fd1a", + "tarball": "http://localhost:4260/fsevents/fsevents-2.3.2.tgz", + "fileCount": 6, + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "unpackedSize": 156422 + }, + "main": "fsevents.js", + "types": "fsevents.d.ts", + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + }, + "gitHead": "a7f5d00939b74e141a73131468c4ce48ee0f2197", + "gypfile": true, + "scripts": { + "test": "/bin/bash ./test.sh 2>/dev/null", + "build": "node-gyp clean && rm -f fsevents.node && node-gyp rebuild && node-gyp clean", + "clean": "node-gyp clean && rm -f fsevents.node", + "install": "node-gyp rebuild", + "prepublishOnly": "npm run build" + }, + "repository": { + "url": "git+https://github.com/fsevents/fsevents.git", + "type": "git" + }, + "_npmVersion": "6.14.10", + "description": "Native Access to MacOS FSEvents", + "directories": {}, + "_nodeVersion": "12.20.1", + "_hasShrinkwrap": false, + "devDependencies": { + "node-gyp": "^6.1.0" + } + }, + "2.3.3": { + "name": "fsevents", + "version": "2.3.3", + "license": "MIT", + "_id": "fsevents@2.3.3", + "bugs": { + "url": "https://github.com/fsevents/fsevents/issues" + }, + "os": [ + "darwin" + ], "dist": { - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "shasum": "cac6407785d03675a2a5e1a5305c697b347d90d6", "tarball": "http://localhost:4260/fsevents/fsevents-2.3.3.tgz", "fileCount": 6, + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "unpackedSize": 173224 }, + "main": "fsevents.js", + "types": "fsevents.d.ts", + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + }, + "gitHead": "2db891e51aa0f2975c5eaaf6aa30f13d720a830a", + "gypfile": true, + "scripts": { + "test": "/bin/bash ./test.sh 2>/dev/null", + "build": "node-gyp clean && rm -f fsevents.node && node-gyp rebuild && node-gyp clean", + "clean": "node-gyp clean && rm -f fsevents.node", + "install": "node-gyp rebuild", + "prepublishOnly": "npm run build" + }, + "repository": { + "url": "git+https://github.com/fsevents/fsevents.git", + "type": "git" + }, + "_npmVersion": "9.6.7", + "description": "Native Access to MacOS FSEvents", "directories": {}, - "_hasShrinkwrap": false + "_nodeVersion": "18.17.1", + "_hasShrinkwrap": false, + "devDependencies": { + "node-gyp": "^9.4.0" + } } }, - "repository": { - "type": "git", - "url": "git+https://github.com/fsevents/fsevents.git" - }, - "readmeFilename": "README.md", - "homepage": "https://github.com/fsevents/fsevents", "bugs": { "url": "https://github.com/fsevents/fsevents/issues" }, - "license": "MIT" + "license": "MIT", + "homepage": "https://github.com/fsevents/fsevents", + "repository": { + "url": "git+https://github.com/fsevents/fsevents.git", + "type": "git" + }, + "description": "Native Access to MacOS FSEvents", + "readmeFilename": "README.md" } diff --git a/tests/registry/npm/playwright-core/playwright-core-1.49.1.tgz b/tests/registry/npm/playwright-core/playwright-core-1.49.1.tgz new file mode 100644 index 0000000000..c276eb1ffa Binary files /dev/null and b/tests/registry/npm/playwright-core/playwright-core-1.49.1.tgz differ diff --git a/tests/registry/npm/playwright-core/registry.json b/tests/registry/npm/playwright-core/registry.json new file mode 100644 index 0000000000..521084d1ec --- /dev/null +++ b/tests/registry/npm/playwright-core/registry.json @@ -0,0 +1,87 @@ +{ + "name": "playwright-core", + "dist-tags": { + "latest": "1.49.1" + }, + "versions": { + "1.49.1": { + "name": "playwright-core", + "version": "1.49.1", + "author": { + "name": "Microsoft Corporation" + }, + "license": "Apache-2.0", + "_id": "playwright-core@1.49.1", + "bugs": { + "url": "https://github.com/microsoft/playwright/issues" + }, + "bin": { + "playwright-core": "cli.js" + }, + "dist": { + "shasum": "32c62f046e950f586ff9e35ed490a424f2248015", + "tarball": "http://localhost:4260/playwright-core/playwright-core-1.49.1.tgz", + "fileCount": 337, + "integrity": "sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==", + "attestations": { + "url": "https://registry.npmjs.org/-/npm/v1/attestations/playwright-core@1.49.1", + "provenance": { + "predicateType": "https://slsa.dev/provenance/v1" + } + }, + "unpackedSize": 7966574 + }, + "types": "types/types.d.ts", + "engines": { + "node": ">=18" + }, + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./index.mjs", + "default": "./index.js", + "require": "./index.js" + }, + "./lib/utils": "./lib/utils/index.js", + "./lib/server": "./lib/server/index.js", + "./package.json": "./package.json", + "./lib/zipBundle": "./lib/zipBundle.js", + "./types/structs": "./types/structs.d.ts", + "./types/protocol": "./types/protocol.d.ts", + "./lib/cli/program": "./lib/cli/program.js", + "./lib/utilsBundle": "./lib/utilsBundle.js", + "./lib/outofprocess": "./lib/outofprocess.js", + "./lib/image_tools/stats": "./lib/image_tools/stats.js", + "./lib/image_tools/compare": "./lib/image_tools/compare.js", + "./lib/server/registry/index": "./lib/server/registry/index.js", + "./lib/image_tools/colorUtils": "./lib/image_tools/colorUtils.js", + "./lib/remote/playwrightServer": "./lib/remote/playwrightServer.js", + "./lib/image_tools/imageChannel": "./lib/image_tools/imageChannel.js" + }, + "gitHead": "88bc8afc78ea6ff13d2bbb312b99eb924962766c", + "repository": { + "url": "git+https://github.com/microsoft/playwright.git", + "type": "git" + }, + "_npmVersion": "10.8.2", + "description": "A high-level API to automate web browsers", + "directories": {}, + "_nodeVersion": "18.20.5", + "_hasShrinkwrap": false + } + }, + "bugs": { + "url": "https://github.com/microsoft/playwright/issues" + }, + "author": { + "name": "Microsoft Corporation" + }, + "license": "Apache-2.0", + "homepage": "https://playwright.dev", + "repository": { + "url": "git+https://github.com/microsoft/playwright.git", + "type": "git" + }, + "description": "A high-level API to automate web browsers", + "readmeFilename": "" +} diff --git a/tests/registry/npm/playwright/playwright-1.49.1.tgz b/tests/registry/npm/playwright/playwright-1.49.1.tgz new file mode 100644 index 0000000000..b0d1b4e455 Binary files /dev/null and b/tests/registry/npm/playwright/playwright-1.49.1.tgz differ diff --git a/tests/registry/npm/playwright/registry.json b/tests/registry/npm/playwright/registry.json new file mode 100644 index 0000000000..a76a823676 --- /dev/null +++ b/tests/registry/npm/playwright/registry.json @@ -0,0 +1,108 @@ +{ + "name": "playwright", + "dist-tags": { + "latest": "1.49.1" + }, + "versions": { + "1.49.1": { + "name": "playwright", + "version": "1.49.1", + "author": { + "name": "Microsoft Corporation" + }, + "license": "Apache-2.0", + "_id": "playwright@1.49.1", + "bugs": { + "url": "https://github.com/microsoft/playwright/issues" + }, + "bin": { + "playwright": "cli.js" + }, + "dist": { + "shasum": "830266dbca3008022afa7b4783565db9944ded7c", + "tarball": "http://localhost:4260/playwright/playwright-1.49.1.tgz", + "fileCount": 108, + "integrity": "sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==", + "attestations": { + "url": "https://registry.npmjs.org/-/npm/v1/attestations/playwright@1.49.1", + "provenance": { + "predicateType": "https://slsa.dev/provenance/v1" + } + }, + "unpackedSize": 3149816 + }, + "main": "index.js", + "types": "./index.d.ts", + "engines": { + "node": ">=18" + }, + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./index.mjs", + "default": "./index.js", + "require": "./index.js" + }, + "./test": { + "types": "./test.d.ts", + "import": "./test.mjs", + "default": "./test.js", + "require": "./test.js" + }, + "./lib/util": "./lib/util.js", + "./types/test": { + "types": "./types/test.d.ts" + }, + "./jsx-runtime": { + "import": "./jsx-runtime.mjs", + "default": "./jsx-runtime.js", + "require": "./jsx-runtime.js" + }, + "./lib/plugins": "./lib/plugins/index.js", + "./lib/program": "./lib/program.js", + "./package.json": "./package.json", + "./lib/fsWatcher": "./lib/fsWatcher.js", + "./lib/utilsBundle": "./lib/utilsBundle.js", + "./types/testReporter": { + "types": "./types/testReporter.d.ts" + }, + "./lib/internalsForTest": "./lib/internalsForTest.js", + "./lib/common/configLoader": "./lib/common/configLoader.js", + "./lib/transform/esmLoader": "./lib/transform/esmLoader.js", + "./lib/transform/transform": "./lib/transform/transform.js", + "./lib/transform/babelBundle": "./lib/transform/babelBundle.js", + "./lib/transform/compilationCache": "./lib/transform/compilationCache.js" + }, + "gitHead": "88bc8afc78ea6ff13d2bbb312b99eb924962766c", + "repository": { + "url": "git+https://github.com/microsoft/playwright.git", + "type": "git" + }, + "_npmVersion": "10.8.2", + "description": "A high-level API to automate web browsers", + "directories": {}, + "_nodeVersion": "18.20.5", + "dependencies": { + "playwright-core": "1.49.1" + }, + "_hasShrinkwrap": false, + "optionalDependencies": { + "fsevents": "2.3.2" + } + } + }, + "bugs": { + "url": "https://github.com/microsoft/playwright/issues" + }, + "author": { + "name": "Microsoft Corporation" + }, + "license": "Apache-2.0", + "homepage": "https://playwright.dev", + "repository": { + "url": "git+https://github.com/microsoft/playwright.git", + "type": "git" + }, + "description": "A high-level API to automate web browsers", + "readmeFilename": "" +} diff --git a/tests/specs/npm/playwright_compat/__test__.jsonc b/tests/specs/npm/playwright_compat/__test__.jsonc new file mode 100644 index 0000000000..6702323ac0 --- /dev/null +++ b/tests/specs/npm/playwright_compat/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "envs": { + "PLAYWRIGHT_BROWSERS_PATH": "../../../../.ms-playwright" + }, + "steps": [{ + "args": "run -A npm:playwright install chromium", + "output": "[WILDCARD]" + }, { + // stdio pipes beyond stdin/stdout/stderr are not currently supported on windows + // https://github.com/denoland/deno/issues/23524 + // TODO(kt3k): enable this on windows when the issue is fixed + "if": "unix", + "args": "run -A main.ts", + "output": "chromium launched\n" + }] +} diff --git a/tests/specs/npm/playwright_compat/main.ts b/tests/specs/npm/playwright_compat/main.ts new file mode 100644 index 0000000000..b1cea8c7f8 --- /dev/null +++ b/tests/specs/npm/playwright_compat/main.ts @@ -0,0 +1,4 @@ +import { chromium } from "npm:playwright"; +await chromium.launch(); +console.log("chromium launched"); +Deno.exit(0);