mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(test-runner): add jest-matcher-utils to dependencies (#8501)
This commit is contained in:
parent
54bda2c8dd
commit
5f6ec04cfe
102
package-lock.json
generated
102
package-lock.json
generated
@ -32,6 +32,7 @@
|
||||
"expect": "^26.4.2",
|
||||
"extract-zip": "^2.0.1",
|
||||
"https-proxy-agent": "^5.0.0",
|
||||
"jest-matcher-utils": "^26.4.2",
|
||||
"jpeg-js": "^0.4.2",
|
||||
"mime": "^2.4.6",
|
||||
"minimatch": "^3.0.3",
|
||||
@ -4503,6 +4504,21 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/expect/node_modules/chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/expect/node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
@ -4519,6 +4535,39 @@
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"node_modules/expect/node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/expect/node_modules/jest-matcher-utils": {
|
||||
"version": "26.6.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz",
|
||||
"integrity": "sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw==",
|
||||
"dependencies": {
|
||||
"chalk": "^4.0.0",
|
||||
"jest-diff": "^26.6.2",
|
||||
"jest-get-type": "^26.3.0",
|
||||
"pretty-format": "^26.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.14.2"
|
||||
}
|
||||
},
|
||||
"node_modules/expect/node_modules/supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/extend-shallow": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz",
|
||||
@ -6120,14 +6169,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/jest-matcher-utils": {
|
||||
"version": "26.6.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz",
|
||||
"integrity": "sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw==",
|
||||
"version": "26.4.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.4.2.tgz",
|
||||
"integrity": "sha512-KcbNqWfWUG24R7tu9WcAOKKdiXiXCbMvQYT6iodZ9k1f7065k0keUOW6XpJMMvah+hTfqkhJhRXmA3r3zMAg0Q==",
|
||||
"dependencies": {
|
||||
"chalk": "^4.0.0",
|
||||
"jest-diff": "^26.6.2",
|
||||
"jest-diff": "^26.4.2",
|
||||
"jest-get-type": "^26.3.0",
|
||||
"pretty-format": "^26.6.2"
|
||||
"pretty-format": "^26.4.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.14.2"
|
||||
@ -13871,6 +13920,15 @@
|
||||
"color-convert": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||
"requires": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
@ -13883,6 +13941,30 @@
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
|
||||
},
|
||||
"jest-matcher-utils": {
|
||||
"version": "26.6.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz",
|
||||
"integrity": "sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw==",
|
||||
"requires": {
|
||||
"chalk": "^4.0.0",
|
||||
"jest-diff": "^26.6.2",
|
||||
"jest-get-type": "^26.3.0",
|
||||
"pretty-format": "^26.6.2"
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"requires": {
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -15185,14 +15267,14 @@
|
||||
"integrity": "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig=="
|
||||
},
|
||||
"jest-matcher-utils": {
|
||||
"version": "26.6.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz",
|
||||
"integrity": "sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw==",
|
||||
"version": "26.4.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.4.2.tgz",
|
||||
"integrity": "sha512-KcbNqWfWUG24R7tu9WcAOKKdiXiXCbMvQYT6iodZ9k1f7065k0keUOW6XpJMMvah+hTfqkhJhRXmA3r3zMAg0Q==",
|
||||
"requires": {
|
||||
"chalk": "^4.0.0",
|
||||
"jest-diff": "^26.6.2",
|
||||
"jest-diff": "^26.4.2",
|
||||
"jest-get-type": "^26.3.0",
|
||||
"pretty-format": "^26.6.2"
|
||||
"pretty-format": "^26.4.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-styles": {
|
||||
|
@ -63,6 +63,7 @@
|
||||
"expect": "^26.4.2",
|
||||
"extract-zip": "^2.0.1",
|
||||
"https-proxy-agent": "^5.0.0",
|
||||
"jest-matcher-utils": "^26.4.2",
|
||||
"jpeg-js": "^0.4.2",
|
||||
"mime": "^2.4.6",
|
||||
"minimatch": "^3.0.3",
|
||||
|
@ -23,6 +23,7 @@ const path = require('path');
|
||||
async function checkDeps() {
|
||||
const root = path.normalize(path.join(__dirname, '..'));
|
||||
const src = path.normalize(path.join(__dirname, '..', 'src'));
|
||||
const packageJSON = require(path.join(root, 'package.json'));
|
||||
const program = ts.createProgram({
|
||||
options: {
|
||||
allowJs: true,
|
||||
@ -44,7 +45,7 @@ async function checkDeps() {
|
||||
if (errors.length) {
|
||||
console.log(`--------------------------------------------------------`);
|
||||
console.log(`Changing the project structure or adding new components?`);
|
||||
console.log(`Update DEPS in //${path.relative(root, __filename)}.`);
|
||||
console.log(`Update DEPS in ./${path.relative(root, __filename)}`);
|
||||
console.log(`--------------------------------------------------------`);
|
||||
}
|
||||
process.exit(errors.length ? 1 : 0);
|
||||
@ -55,6 +56,8 @@ async function checkDeps() {
|
||||
const importPath = path.resolve(path.dirname(fileName), importName) + '.ts';
|
||||
if (!allowImport(fileName, importPath))
|
||||
errors.push(`Disallowed import from ${path.relative(root, fileName)} to ${path.relative(root, importPath)}`);
|
||||
if (!alllowExternalImport(fileName, importPath, importName))
|
||||
errors.push(`Disallowed external dependency ${importName} from ${path.relative(root, fileName)}`);
|
||||
}
|
||||
ts.forEachChild(node, x => visit(x, fileName));
|
||||
}
|
||||
@ -91,6 +94,33 @@ async function checkDeps() {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function alllowExternalImport(from, importPath, importName) {
|
||||
const EXTERNAL_IMPORT_ALLOWLIST = ['electron'];
|
||||
// Only external imports are relevant. Files in src/web are bundled via webpack.
|
||||
if (importName.startsWith('.') || importPath.startsWith(path.join(src, 'web')))
|
||||
return true;
|
||||
if (EXTERNAL_IMPORT_ALLOWLIST.includes(importName))
|
||||
return true;
|
||||
try {
|
||||
const resolvedImport = require.resolve(importName)
|
||||
const resolvedImportRelativeToNodeModules = path.relative(path.join(root, 'node_modules'), resolvedImport);
|
||||
// Filter out internal Node.js modules
|
||||
if (!resolvedImportRelativeToNodeModules.startsWith(importName))
|
||||
return true;
|
||||
const resolvedImportRelativeToNodeModulesParts = resolvedImportRelativeToNodeModules.split(path.sep);
|
||||
if (packageJSON.dependencies[resolvedImportRelativeToNodeModulesParts[0]])
|
||||
return true;
|
||||
// handle e.g. @babel/code-frame
|
||||
if (resolvedImportRelativeToNodeModulesParts.length >= 2 && packageJSON.dependencies[resolvedImportRelativeToNodeModulesParts.splice(0, 2).join(path.sep)])
|
||||
return true;
|
||||
return false;
|
||||
} catch (error) {
|
||||
if (error.code !== 'MODULE_NOT_FOUND')
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function listAllFiles(dir) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user