mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: simplify installation tests (#9945)
This commit is contained in:
parent
327febe2c9
commit
de0cc3245e
422
package-lock.json
generated
422
package-lock.json
generated
@ -68,6 +68,7 @@
|
|||||||
"pngjs": "7.0.0",
|
"pngjs": "7.0.0",
|
||||||
"prettier": "2.8.4",
|
"prettier": "2.8.4",
|
||||||
"puppeteer": "file:packages/puppeteer",
|
"puppeteer": "file:packages/puppeteer",
|
||||||
|
"rimraf": "3.0.2",
|
||||||
"rollup": "3.18.0",
|
"rollup": "3.18.0",
|
||||||
"semver": "7.3.8",
|
"semver": "7.3.8",
|
||||||
"sinon": "15.0.1",
|
"sinon": "15.0.1",
|
||||||
@ -1139,41 +1140,6 @@
|
|||||||
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
|
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@npmcli/move-file/node_modules/glob": {
|
|
||||||
"version": "7.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
|
||||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"fs.realpath": "^1.0.0",
|
|
||||||
"inflight": "^1.0.4",
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "^3.1.1",
|
|
||||||
"once": "^1.3.0",
|
|
||||||
"path-is-absolute": "^1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@npmcli/move-file/node_modules/rimraf": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"glob": "^7.1.3"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"rimraf": "bin.js"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@npmcli/node-gyp": {
|
"node_modules/@npmcli/node-gyp": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@ -2402,41 +2368,6 @@
|
|||||||
"wrap-ansi": "^7.0.0"
|
"wrap-ansi": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/c8/node_modules/glob": {
|
|
||||||
"version": "7.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
|
||||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"fs.realpath": "^1.0.0",
|
|
||||||
"inflight": "^1.0.4",
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "^3.1.1",
|
|
||||||
"once": "^1.3.0",
|
|
||||||
"path-is-absolute": "^1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/c8/node_modules/rimraf": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"glob": "^7.1.3"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"rimraf": "bin.js"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/c8/node_modules/yargs": {
|
"node_modules/c8/node_modules/yargs": {
|
||||||
"version": "16.2.0",
|
"version": "16.2.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@ -4028,41 +3959,6 @@
|
|||||||
"node": "^10.12.0 || >=12.0.0"
|
"node": "^10.12.0 || >=12.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/flat-cache/node_modules/glob": {
|
|
||||||
"version": "7.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
|
||||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"fs.realpath": "^1.0.0",
|
|
||||||
"inflight": "^1.0.4",
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "^3.1.1",
|
|
||||||
"once": "^1.3.0",
|
|
||||||
"path-is-absolute": "^1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/flat-cache/node_modules/rimraf": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"glob": "^7.1.3"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"rimraf": "bin.js"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/flatted": {
|
"node_modules/flatted": {
|
||||||
"version": "3.2.7",
|
"version": "3.2.7",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@ -4368,26 +4264,6 @@
|
|||||||
"typescript": ">=3"
|
"typescript": ">=3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/gts/node_modules/glob": {
|
|
||||||
"version": "7.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
|
||||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"fs.realpath": "^1.0.0",
|
|
||||||
"inflight": "^1.0.4",
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "^3.1.1",
|
|
||||||
"once": "^1.3.0",
|
|
||||||
"path-is-absolute": "^1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/gts/node_modules/meow": {
|
"node_modules/gts/node_modules/meow": {
|
||||||
"version": "9.0.0",
|
"version": "9.0.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@ -4427,21 +4303,6 @@
|
|||||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/gts/node_modules/rimraf": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"glob": "^7.1.3"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"rimraf": "bin.js"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/gts/node_modules/type-fest": {
|
"node_modules/gts/node_modules/type-fest": {
|
||||||
"version": "0.18.1",
|
"version": "0.18.1",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@ -5782,63 +5643,6 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/make-fetch-happen/node_modules/rimraf": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"glob": "^7.1.3"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"rimraf": "bin.js"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/make-fetch-happen/node_modules/rimraf/node_modules/brace-expansion": {
|
|
||||||
"version": "1.1.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
|
||||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"balanced-match": "^1.0.0",
|
|
||||||
"concat-map": "0.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/make-fetch-happen/node_modules/rimraf/node_modules/glob": {
|
|
||||||
"version": "7.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
|
||||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"fs.realpath": "^1.0.0",
|
|
||||||
"inflight": "^1.0.4",
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "^3.1.1",
|
|
||||||
"once": "^1.3.0",
|
|
||||||
"path-is-absolute": "^1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/make-fetch-happen/node_modules/rimraf/node_modules/minimatch": {
|
|
||||||
"version": "3.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
|
||||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"brace-expansion": "^1.1.7"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/make-fetch-happen/node_modules/ssri": {
|
"node_modules/make-fetch-happen/node_modules/ssri": {
|
||||||
"version": "9.0.1",
|
"version": "9.0.1",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@ -6488,21 +6292,6 @@
|
|||||||
"url": "https://github.com/sponsors/isaacs"
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-gyp/node_modules/rimraf": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"glob": "^7.1.3"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"rimraf": "bin.js"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/nopt": {
|
"node_modules/nopt": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@ -7895,6 +7684,41 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/rimraf": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"glob": "^7.1.3"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"rimraf": "bin.js"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/rimraf/node_modules/glob": {
|
||||||
|
"version": "7.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||||
|
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"fs.realpath": "^1.0.0",
|
||||||
|
"inflight": "^1.0.4",
|
||||||
|
"inherits": "2",
|
||||||
|
"minimatch": "^3.1.1",
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"path-is-absolute": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/rollup": {
|
"node_modules/rollup": {
|
||||||
"version": "3.18.0",
|
"version": "3.18.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@ -10294,31 +10118,6 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"mkdirp": "^1.0.4",
|
"mkdirp": "^1.0.4",
|
||||||
"rimraf": "^3.0.2"
|
"rimraf": "^3.0.2"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"glob": {
|
|
||||||
"version": "7.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
|
||||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"fs.realpath": "^1.0.0",
|
|
||||||
"inflight": "^1.0.4",
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "^3.1.1",
|
|
||||||
"once": "^1.3.0",
|
|
||||||
"path-is-absolute": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rimraf": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"glob": "^7.1.3"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@npmcli/node-gyp": {
|
"@npmcli/node-gyp": {
|
||||||
@ -11250,29 +11049,6 @@
|
|||||||
"wrap-ansi": "^7.0.0"
|
"wrap-ansi": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"glob": {
|
|
||||||
"version": "7.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
|
||||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"fs.realpath": "^1.0.0",
|
|
||||||
"inflight": "^1.0.4",
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "^3.1.1",
|
|
||||||
"once": "^1.3.0",
|
|
||||||
"path-is-absolute": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rimraf": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"glob": "^7.1.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"yargs": {
|
"yargs": {
|
||||||
"version": "16.2.0",
|
"version": "16.2.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@ -12294,31 +12070,6 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"flatted": "^3.1.0",
|
"flatted": "^3.1.0",
|
||||||
"rimraf": "^3.0.2"
|
"rimraf": "^3.0.2"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"glob": {
|
|
||||||
"version": "7.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
|
||||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"fs.realpath": "^1.0.0",
|
|
||||||
"inflight": "^1.0.4",
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "^3.1.1",
|
|
||||||
"once": "^1.3.0",
|
|
||||||
"path-is-absolute": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rimraf": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"glob": "^7.1.3"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flatted": {
|
"flatted": {
|
||||||
@ -12521,20 +12272,6 @@
|
|||||||
"write-file-atomic": "^4.0.0"
|
"write-file-atomic": "^4.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"glob": {
|
|
||||||
"version": "7.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
|
||||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"fs.realpath": "^1.0.0",
|
|
||||||
"inflight": "^1.0.4",
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "^3.1.1",
|
|
||||||
"once": "^1.3.0",
|
|
||||||
"path-is-absolute": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"meow": {
|
"meow": {
|
||||||
"version": "9.0.0",
|
"version": "9.0.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@ -12557,15 +12294,6 @@
|
|||||||
"version": "2.7.1",
|
"version": "2.7.1",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"rimraf": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"glob": "^7.1.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type-fest": {
|
"type-fest": {
|
||||||
"version": "0.18.1",
|
"version": "0.18.1",
|
||||||
"dev": true
|
"dev": true
|
||||||
@ -13427,50 +13155,6 @@
|
|||||||
"yallist": "^4.0.0"
|
"yallist": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rimraf": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"glob": "^7.1.3"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"brace-expansion": {
|
|
||||||
"version": "1.1.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
|
||||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"balanced-match": "^1.0.0",
|
|
||||||
"concat-map": "0.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"glob": {
|
|
||||||
"version": "7.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
|
||||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"fs.realpath": "^1.0.0",
|
|
||||||
"inflight": "^1.0.4",
|
|
||||||
"inherits": "2",
|
|
||||||
"minimatch": "^3.1.1",
|
|
||||||
"once": "^1.3.0",
|
|
||||||
"path-is-absolute": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"minimatch": {
|
|
||||||
"version": "3.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
|
||||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"brace-expansion": "^1.1.7"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ssri": {
|
"ssri": {
|
||||||
"version": "9.0.1",
|
"version": "9.0.1",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@ -13903,15 +13587,6 @@
|
|||||||
"once": "^1.3.0",
|
"once": "^1.3.0",
|
||||||
"path-is-absolute": "^1.0.0"
|
"path-is-absolute": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"rimraf": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"glob": "^7.1.3"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -14832,6 +14507,31 @@
|
|||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"rimraf": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"glob": "^7.1.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"glob": {
|
||||||
|
"version": "7.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||||
|
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"fs.realpath": "^1.0.0",
|
||||||
|
"inflight": "^1.0.4",
|
||||||
|
"inherits": "2",
|
||||||
|
"minimatch": "^3.1.1",
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"path-is-absolute": "^1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"rollup": {
|
"rollup": {
|
||||||
"version": "3.18.0",
|
"version": "3.18.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
@ -172,6 +172,7 @@
|
|||||||
"pngjs": "7.0.0",
|
"pngjs": "7.0.0",
|
||||||
"prettier": "2.8.4",
|
"prettier": "2.8.4",
|
||||||
"puppeteer": "file:packages/puppeteer",
|
"puppeteer": "file:packages/puppeteer",
|
||||||
|
"rimraf": "3.0.2",
|
||||||
"rollup": "3.18.0",
|
"rollup": "3.18.0",
|
||||||
"semver": "7.3.8",
|
"semver": "7.3.8",
|
||||||
"sinon": "15.0.1",
|
"sinon": "15.0.1",
|
||||||
|
@ -18,6 +18,4 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
spec: ['build/**/*.spec.js'],
|
spec: ['build/**/*.spec.js'],
|
||||||
timeout: '240000ms',
|
timeout: '240000ms',
|
||||||
// Parallel processing fails on other package managers due to caching.
|
|
||||||
parallel: (process.env['PKG_MANAGER'] ?? 'npm') === 'npm',
|
|
||||||
};
|
};
|
||||||
|
@ -18,27 +18,31 @@ import assert from 'assert';
|
|||||||
import {readdir, writeFile} from 'fs/promises';
|
import {readdir, writeFile} from 'fs/promises';
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
|
||||||
import {describeInstallation} from './describeInstallation.js';
|
import {configureSandbox} from './sandbox.js';
|
||||||
import {readAsset} from './util.js';
|
import {readAsset} from './util.js';
|
||||||
|
|
||||||
describeInstallation(
|
describe('`puppeteer` with configuration', () => {
|
||||||
'`puppeteer` with configuration',
|
configureSandbox({
|
||||||
{
|
dependencies: ['@puppeteer/browsers', 'puppeteer-core', 'puppeteer'],
|
||||||
dependencies: ['puppeteer-core', '@puppeteer/browsers', 'puppeteer'],
|
env: cwd => {
|
||||||
|
return {
|
||||||
|
PUPPETEER_CACHE_DIR: join(cwd, '.cache', 'puppeteer'),
|
||||||
|
};
|
||||||
|
},
|
||||||
before: async cwd => {
|
before: async cwd => {
|
||||||
await writeFile(
|
await writeFile(
|
||||||
join(cwd, '.puppeteerrc.cjs'),
|
join(cwd, '.puppeteerrc.cjs'),
|
||||||
await readAsset('puppeteer', 'configuration', '.puppeteerrc.cjs')
|
await readAsset('puppeteer', 'configuration', '.puppeteerrc.cjs')
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
({itEvaluates}) => {
|
|
||||||
itEvaluates('properly', async cwd => {
|
|
||||||
const files = await readdir(join(cwd, '.cache', 'puppeteer'));
|
|
||||||
assert.equal(files.length, 1);
|
|
||||||
assert.equal(files[0], 'chrome');
|
|
||||||
|
|
||||||
return readAsset('puppeteer', 'basic.js');
|
it('evaluates', async function () {
|
||||||
});
|
const files = await readdir(join(this.sandbox, '.cache', 'puppeteer'));
|
||||||
}
|
assert.equal(files.length, 1);
|
||||||
);
|
assert.equal(files[0], 'chrome');
|
||||||
|
|
||||||
|
const script = await readAsset('puppeteer', 'basic.js');
|
||||||
|
await this.runScript(script, 'mjs');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@ -14,31 +14,31 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {describeInstallation} from './describeInstallation.js';
|
import {configureSandbox} from './sandbox.js';
|
||||||
import {readAsset} from './util.js';
|
import {readAsset} from './util.js';
|
||||||
|
|
||||||
describeInstallation(
|
describe('`puppeteer-core`', () => {
|
||||||
'`puppeteer-core`',
|
configureSandbox({
|
||||||
{dependencies: ['@puppeteer/browsers', 'puppeteer-core']},
|
dependencies: ['@puppeteer/browsers', 'puppeteer-core'],
|
||||||
({itEvaluates}) => {
|
});
|
||||||
itEvaluates('CommonJS', {commonjs: true}, async () => {
|
|
||||||
return readAsset('puppeteer-core', 'requires.cjs');
|
|
||||||
});
|
|
||||||
|
|
||||||
itEvaluates('ES modules', async () => {
|
it('evaluates CommonJS', async function () {
|
||||||
return readAsset('puppeteer-core', 'imports.js');
|
const script = await readAsset('puppeteer-core', 'requires.cjs');
|
||||||
});
|
await this.runScript(script, 'cjs');
|
||||||
|
});
|
||||||
|
|
||||||
for (const product of ['firefox', 'chrome']) {
|
it('evaluates ES modules', async function () {
|
||||||
itEvaluates(
|
const script = await readAsset('puppeteer-core', 'imports.js');
|
||||||
`\`launch\` for \`${product}\` with a bad \`executablePath\``,
|
await this.runScript(script, 'mjs');
|
||||||
async () => {
|
});
|
||||||
return (await readAsset('puppeteer-core', 'launch.js')).replace(
|
|
||||||
'${product}',
|
for (const product of ['firefox', 'chrome']) {
|
||||||
product
|
it(`\`launch\` for \`${product}\` with a bad \`executablePath\``, async function () {
|
||||||
);
|
const script = (await readAsset('puppeteer-core', 'launch.js')).replace(
|
||||||
}
|
'${product}',
|
||||||
|
product
|
||||||
);
|
);
|
||||||
}
|
await this.runScript(script, 'mjs');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
@ -18,12 +18,11 @@ import assert from 'assert';
|
|||||||
import {readdir} from 'fs/promises';
|
import {readdir} from 'fs/promises';
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
|
||||||
import {describeInstallation} from './describeInstallation.js';
|
import {configureSandbox} from './sandbox.js';
|
||||||
import {readAsset} from './util.js';
|
import {readAsset} from './util.js';
|
||||||
|
|
||||||
describeInstallation(
|
describe('`puppeteer` with Firefox', () => {
|
||||||
'`puppeteer` with Firefox',
|
configureSandbox({
|
||||||
{
|
|
||||||
dependencies: ['@puppeteer/browsers', 'puppeteer-core', 'puppeteer'],
|
dependencies: ['@puppeteer/browsers', 'puppeteer-core', 'puppeteer'],
|
||||||
env: cwd => {
|
env: cwd => {
|
||||||
return {
|
return {
|
||||||
@ -31,18 +30,18 @@ describeInstallation(
|
|||||||
PUPPETEER_PRODUCT: 'firefox',
|
PUPPETEER_PRODUCT: 'firefox',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
({itEvaluates}) => {
|
|
||||||
itEvaluates('CommonJS', {commonjs: true}, async cwd => {
|
|
||||||
const files = await readdir(join(cwd, '.cache', 'puppeteer'));
|
|
||||||
assert.equal(files.length, 1);
|
|
||||||
assert.equal(files[0], 'firefox');
|
|
||||||
|
|
||||||
return readAsset('puppeteer-core', 'requires.cjs');
|
it('evaluates CommonJS', async function () {
|
||||||
});
|
const files = await readdir(join(this.sandbox, '.cache', 'puppeteer'));
|
||||||
|
assert.equal(files.length, 1);
|
||||||
|
assert.equal(files[0], 'firefox');
|
||||||
|
const script = await readAsset('puppeteer-core', 'requires.cjs');
|
||||||
|
await this.runScript(script, 'cjs');
|
||||||
|
});
|
||||||
|
|
||||||
itEvaluates('ES modules', async () => {
|
it('evaluates ES modules', async function () {
|
||||||
return readAsset('puppeteer-core', 'imports.js');
|
const script = await readAsset('puppeteer-core', 'imports.js');
|
||||||
});
|
await this.runScript(script, 'mjs');
|
||||||
}
|
});
|
||||||
);
|
});
|
||||||
|
@ -17,12 +17,11 @@
|
|||||||
import {readFile, rm, writeFile} from 'fs/promises';
|
import {readFile, rm, writeFile} from 'fs/promises';
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
|
||||||
import {describeInstallation} from './describeInstallation.js';
|
import {configureSandbox} from './sandbox.js';
|
||||||
import {execFile, readAsset} from './util.js';
|
import {execFile, readAsset} from './util.js';
|
||||||
|
|
||||||
describeInstallation(
|
describe('`puppeteer` with Webpack', () => {
|
||||||
'`puppeteer` with Webpack',
|
configureSandbox({
|
||||||
{
|
|
||||||
dependencies: ['@puppeteer/browsers', 'puppeteer-core', 'puppeteer'],
|
dependencies: ['@puppeteer/browsers', 'puppeteer-core', 'puppeteer'],
|
||||||
devDependencies: ['webpack', 'webpack-cli'],
|
devDependencies: ['webpack', 'webpack-cli'],
|
||||||
env: cwd => {
|
env: cwd => {
|
||||||
@ -30,29 +29,29 @@ describeInstallation(
|
|||||||
PUPPETEER_CACHE_DIR: join(cwd, '.cache', 'puppeteer'),
|
PUPPETEER_CACHE_DIR: join(cwd, '.cache', 'puppeteer'),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
({itEvaluates}) => {
|
|
||||||
itEvaluates('Webpack bundles', {commonjs: true}, async cwd => {
|
|
||||||
// Write a Webpack configuration.
|
|
||||||
await writeFile(
|
|
||||||
join(cwd, 'webpack.config.mjs'),
|
|
||||||
await readAsset('puppeteer', 'webpack', 'webpack.config.js')
|
|
||||||
);
|
|
||||||
|
|
||||||
// Write the source code.
|
it('evaluates WebPack Bundles', async function () {
|
||||||
await writeFile(
|
// Write a Webpack configuration.
|
||||||
join(cwd, 'index.js'),
|
await writeFile(
|
||||||
await readAsset('puppeteer', 'basic.js')
|
join(this.sandbox, 'webpack.config.mjs'),
|
||||||
);
|
await readAsset('puppeteer', 'webpack', 'webpack.config.js')
|
||||||
|
);
|
||||||
|
|
||||||
// Bundle.
|
// Write the source code.
|
||||||
await execFile('npx', ['webpack'], {cwd, shell: true});
|
await writeFile(
|
||||||
|
join(this.sandbox, 'index.js'),
|
||||||
|
await readAsset('puppeteer', 'basic.js')
|
||||||
|
);
|
||||||
|
|
||||||
// Remove `node_modules` to test independence.
|
// Bundle.
|
||||||
await rm('node_modules', {recursive: true, force: true});
|
await execFile('npx', ['webpack'], {cwd: this.sandbox, shell: true});
|
||||||
|
|
||||||
// Read the bundled file.
|
// Remove `node_modules` to test independence.
|
||||||
return await readFile(join(cwd, 'bundle.js'), 'utf-8');
|
await rm('node_modules', {recursive: true, force: true});
|
||||||
});
|
|
||||||
}
|
const script = await readFile(join(this.sandbox, 'bundle.js'), 'utf-8');
|
||||||
);
|
|
||||||
|
await this.runScript(script, 'cjs');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@ -18,30 +18,29 @@ import assert from 'assert';
|
|||||||
import {readdir} from 'fs/promises';
|
import {readdir} from 'fs/promises';
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
|
||||||
import {describeInstallation} from './describeInstallation.js';
|
import {configureSandbox} from './sandbox.js';
|
||||||
import {readAsset} from './util.js';
|
import {readAsset} from './util.js';
|
||||||
|
|
||||||
describeInstallation(
|
describe('`puppeteer`', () => {
|
||||||
'`puppeteer`',
|
configureSandbox({
|
||||||
{
|
|
||||||
dependencies: ['@puppeteer/browsers', 'puppeteer-core', 'puppeteer'],
|
dependencies: ['@puppeteer/browsers', 'puppeteer-core', 'puppeteer'],
|
||||||
env: cwd => {
|
env: cwd => {
|
||||||
return {
|
return {
|
||||||
PUPPETEER_CACHE_DIR: join(cwd, '.cache', 'puppeteer'),
|
PUPPETEER_CACHE_DIR: join(cwd, '.cache', 'puppeteer'),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
({itEvaluates}) => {
|
|
||||||
itEvaluates('CommonJS', {commonjs: true}, async cwd => {
|
|
||||||
const files = await readdir(join(cwd, '.cache', 'puppeteer'));
|
|
||||||
assert.equal(files.length, 1);
|
|
||||||
assert.equal(files[0], 'chrome');
|
|
||||||
|
|
||||||
return readAsset('puppeteer-core', 'requires.cjs');
|
it('evaluates CommonJS', async function () {
|
||||||
});
|
const files = await readdir(join(this.sandbox, '.cache', 'puppeteer'));
|
||||||
|
assert.equal(files.length, 1);
|
||||||
|
assert.equal(files[0], 'chrome');
|
||||||
|
const script = await readAsset('puppeteer-core', 'requires.cjs');
|
||||||
|
await this.runScript(script, 'cjs');
|
||||||
|
});
|
||||||
|
|
||||||
itEvaluates('ES modules', async () => {
|
it('evaluates ES modules', async function () {
|
||||||
return readAsset('puppeteer-core', 'imports.js');
|
const script = await readAsset('puppeteer-core', 'imports.js');
|
||||||
});
|
await this.runScript(script, 'mjs');
|
||||||
}
|
});
|
||||||
);
|
});
|
||||||
|
137
test/installation/src/sandbox.ts
Normal file
137
test/installation/src/sandbox.ts
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2022 Google Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
import crypto from 'crypto';
|
||||||
|
import {mkdtemp, rm, writeFile} from 'fs/promises';
|
||||||
|
import {tmpdir} from 'os';
|
||||||
|
import {join} from 'path';
|
||||||
|
|
||||||
|
import {
|
||||||
|
PUPPETEER_CORE_PACKAGE_PATH,
|
||||||
|
PUPPETEER_PACKAGE_PATH,
|
||||||
|
PUPPETEER_BROWSERS_PACKAGE_PATH,
|
||||||
|
} from './constants.js';
|
||||||
|
import {execFile} from './util.js';
|
||||||
|
|
||||||
|
const PKG_MANAGER = process.env['PKG_MANAGER'] || 'npm';
|
||||||
|
|
||||||
|
let ADD_PKG_SUBCOMMAND = 'install';
|
||||||
|
if (PKG_MANAGER !== 'npm') {
|
||||||
|
ADD_PKG_SUBCOMMAND = 'add';
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ItEvaluatesOptions {
|
||||||
|
commonjs?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ItEvaluatesFn {
|
||||||
|
(
|
||||||
|
title: string,
|
||||||
|
options: ItEvaluatesOptions,
|
||||||
|
getScriptContent: (cwd: string) => Promise<string>
|
||||||
|
): void;
|
||||||
|
(title: string, getScriptContent: (cwd: string) => Promise<string>): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SandboxOptions {
|
||||||
|
dependencies?: string[];
|
||||||
|
devDependencies?: string[];
|
||||||
|
/**
|
||||||
|
* This should be idempotent.
|
||||||
|
*/
|
||||||
|
env?: ((cwd: string) => NodeJS.ProcessEnv) | NodeJS.ProcessEnv;
|
||||||
|
before?: (cwd: string) => Promise<void>;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'mocha' {
|
||||||
|
export interface Context {
|
||||||
|
/**
|
||||||
|
* The path to the root of the sandbox folder.
|
||||||
|
*/
|
||||||
|
sandbox: string;
|
||||||
|
env: NodeJS.ProcessEnv | undefined;
|
||||||
|
runScript: (content: string, type: 'cjs' | 'mjs') => Promise<void>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures mocha before/after hooks to create a temp folder and install
|
||||||
|
* specified dependencies.
|
||||||
|
*/
|
||||||
|
export const configureSandbox = (options: SandboxOptions): void => {
|
||||||
|
before(async function (): Promise<void> {
|
||||||
|
const sandbox = await mkdtemp(join(tmpdir(), 'puppeteer-'));
|
||||||
|
const dependencies = (options.dependencies ?? []).map(module => {
|
||||||
|
switch (module) {
|
||||||
|
case 'puppeteer':
|
||||||
|
return PUPPETEER_PACKAGE_PATH;
|
||||||
|
case 'puppeteer-core':
|
||||||
|
return PUPPETEER_CORE_PACKAGE_PATH;
|
||||||
|
case '@puppeteer/browsers':
|
||||||
|
return PUPPETEER_BROWSERS_PACKAGE_PATH;
|
||||||
|
default:
|
||||||
|
return module;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const devDependencies = options.devDependencies ?? [];
|
||||||
|
|
||||||
|
let getEnv: (cwd: string) => NodeJS.ProcessEnv | undefined;
|
||||||
|
if (typeof options.env === 'function') {
|
||||||
|
getEnv = options.env;
|
||||||
|
} else {
|
||||||
|
const env = options.env;
|
||||||
|
getEnv = () => {
|
||||||
|
return env;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const env = {...process.env, ...getEnv(sandbox)};
|
||||||
|
|
||||||
|
await options.before?.(sandbox);
|
||||||
|
if (dependencies.length > 0) {
|
||||||
|
await execFile(PKG_MANAGER, [ADD_PKG_SUBCOMMAND, ...dependencies], {
|
||||||
|
cwd: sandbox,
|
||||||
|
env,
|
||||||
|
shell: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (devDependencies.length > 0) {
|
||||||
|
await execFile(
|
||||||
|
PKG_MANAGER,
|
||||||
|
[ADD_PKG_SUBCOMMAND, '-D', ...devDependencies],
|
||||||
|
{
|
||||||
|
cwd: sandbox,
|
||||||
|
env,
|
||||||
|
shell: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sandbox = sandbox;
|
||||||
|
this.env = env;
|
||||||
|
this.runScript = async (content: string, type: 'cjs' | 'mjs') => {
|
||||||
|
const script = join(sandbox, `script-${crypto.randomUUID()}.${type}`);
|
||||||
|
await writeFile(script, content);
|
||||||
|
await execFile('node', [script], {cwd: sandbox, env});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
after(async function () {
|
||||||
|
if (!process.env['KEEP_SANDBOX']) {
|
||||||
|
await rm(this.sandbox, {recursive: true, force: true, maxRetries: 5});
|
||||||
|
} else {
|
||||||
|
console.log('sandbox saved in', this.sandbox);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user