Created
April 8, 2020 21:26
-
-
Save JamieMagee/235950f9c07e0a72ce71a2844432fc3f to your computer and use it in GitHub Desktop.
Yarn V2 test fixes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/workers/branch/lock-files/__snapshots__/yarn.spec.ts.snap b/lib/workers/branch/lock-files/__snapshots__/yarn.spec.ts.snap | |
index a95efc06f..e9f07d0bf 100644 | |
--- a/lib/workers/branch/lock-files/__snapshots__/yarn.spec.ts.snap | |
+++ b/lib/workers/branch/lock-files/__snapshots__/yarn.spec.ts.snap | |
@@ -105,6 +105,85 @@ Array [ | |
] | |
`; | |
+exports[`generateLockFile finds yarn v1.0.0 globally 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-scripts --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`generateLockFile finds yarn v2.0.0 globally 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ "YARN_ENABLE_SCRIPTS": "0", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
exports[`generateLockFile generates lock files 1`] = ` | |
Array [ | |
Object { | |
@@ -161,6 +240,159 @@ Array [ | |
] | |
`; | |
+exports[`generateLockFile generates lock files 2`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ "YARN_ENABLE_SCRIPTS": "0", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`generateLockFile generates lock files using yarn v1.0.0 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-scripts --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "npx yarn-deduplicate@1.1.1 --strategy fewer && yarn", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "npx yarn-deduplicate@1.1.1 --strategy highest && yarn", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`generateLockFile generates lock files using yarn v2.0.0 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ "YARN_ENABLE_SCRIPTS": "0", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
exports[`generateLockFile performs lock file updates 1`] = ` | |
Array [ | |
Object { | |
@@ -200,8 +432,617 @@ Array [ | |
] | |
`; | |
-exports[`generateLockFile uses fallback yarn 1`] = ` | |
+exports[`generateLockFile performs lock file updates using yarn v1.0.0 1`] = ` | |
Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-scripts --ignore-engines --ignore-platform --mutex file:/tmp/yarn.mutext", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> upgrade some-dep --ignore-scripts --ignore-engines --ignore-platform --mutex file:/tmp/yarn.mutext", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`generateLockFile performs lock file updates using yarn v2.0.0 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-engines --ignore-platform --mutex file:/tmp/yarn.mutext", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ "YARN_ENABLE_SCRIPTS": "0", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> upgrade some-dep --ignore-engines --ignore-platform --mutex file:/tmp/yarn.mutext", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`generateLockFile uses fallback yarn 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "yarn install --ignore-scripts --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`workers/branch/lock-files/yarn detects yarnIntegrity using yarn v1.0.0 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-scripts --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> upgrade some-dep --ignore-scripts --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`workers/branch/lock-files/yarn detects yarnIntegrity using yarn v2.0.0 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ "YARN_ENABLE_SCRIPTS": "0", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> upgrade some-dep --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`workers/branch/lock-files/yarn finds yarn embedded in renovate 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-scripts --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`workers/branch/lock-files/yarn finds yarn v1.0.0 globally 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-scripts --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`workers/branch/lock-files/yarn finds yarn v2.0.0 globally 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ "YARN_ENABLE_SCRIPTS": "0", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`workers/branch/lock-files/yarn generates lock files using yarn v1.0.0 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-scripts --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "npx yarn-deduplicate@1.1.1 --strategy fewer && yarn", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "npx yarn-deduplicate@1.1.1 --strategy highest && yarn", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`workers/branch/lock-files/yarn generates lock files using yarn v2.0.0 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-engines --ignore-platform --mutex network:31879", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ "YARN_ENABLE_SCRIPTS": "0", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`workers/branch/lock-files/yarn performs lock file updates using yarn v1.0.0 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-scripts --ignore-engines --ignore-platform --mutex file:/tmp/yarn.mutext", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> upgrade some-dep --ignore-scripts --ignore-engines --ignore-platform --mutex file:/tmp/yarn.mutext", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`workers/branch/lock-files/yarn performs lock file updates using yarn v2.0.0 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "<yarn> --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> install --ignore-engines --ignore-platform --mutex file:/tmp/yarn.mutext", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ "YARN_ENABLE_SCRIPTS": "0", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+ Object { | |
+ "cmd": "<yarn> upgrade some-dep --ignore-engines --ignore-platform --mutex file:/tmp/yarn.mutext", | |
+ "options": Object { | |
+ "cwd": "some-dir", | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
+] | |
+`; | |
+ | |
+exports[`workers/branch/lock-files/yarn uses fallback yarn 1`] = ` | |
+Array [ | |
+ Object { | |
+ "cmd": "yarn --version", | |
+ "options": Object { | |
+ "cwd": null, | |
+ "encoding": "utf-8", | |
+ "env": Object { | |
+ "HOME": "/home/user", | |
+ "HTTPS_PROXY": "https://example.com", | |
+ "HTTP_PROXY": "http://example.com", | |
+ "LANG": "en_US.UTF-8", | |
+ "LC_ALL": "en_US", | |
+ "NO_PROXY": "localhost", | |
+ "PATH": "/tmp/path", | |
+ }, | |
+ "timeout": 900000, | |
+ }, | |
+ }, | |
Object { | |
"cmd": "yarn install --ignore-scripts --ignore-engines --ignore-platform --mutex network:31879", | |
"options": Object { | |
diff --git a/lib/workers/branch/lock-files/yarn.spec.ts b/lib/workers/branch/lock-files/yarn.spec.ts | |
index 0c23560e8..9291becd3 100644 | |
--- a/lib/workers/branch/lock-files/yarn.spec.ts | |
+++ b/lib/workers/branch/lock-files/yarn.spec.ts | |
@@ -2,7 +2,7 @@ import { getInstalledPath } from 'get-installed-path'; | |
import _fs from 'fs-extra'; | |
import { exec as _exec } from 'child_process'; | |
import * as _yarnHelper from '../../../manager/npm/post-update/yarn'; | |
-import { mocked } from '../../../../test/util'; | |
+import { getName, mocked } from '../../../../test/util'; | |
import { ExecSnapshots, envMock, mockExecAll } from '../../../../test/execUtil'; | |
import * as _env from '../../../util/exec/env'; | |
import { BinarySource } from '../../../util/exec/common'; | |
@@ -26,55 +26,73 @@ const fixSnapshots = (snapshots: ExecSnapshots): ExecSnapshots => | |
cmd: snapshot.cmd.replace(/^.*\/yarn.*?\.js\s+/, '<yarn> '), | |
})); | |
-describe('generateLockFile', () => { | |
+describe(getName(__filename), () => { | |
beforeEach(() => { | |
delete process.env.YARN_MUTEX_FILE; | |
jest.resetAllMocks(); | |
env.getChildProcessEnv.mockReturnValue(envMock.basic); | |
}); | |
- it('generates lock files', async () => { | |
- const execSnapshots = mockExecAll(exec); | |
- getInstalledPath.mockReturnValueOnce('node_modules/yarn'); | |
- fs.readFile = jest.fn(() => 'package-lock-contents') as never; | |
- const config = { | |
- postUpdateOptions: ['yarnDedupeFewer', 'yarnDedupeHighest'], | |
- }; | |
- const res = await yarnHelper.generateLockFile('some-dir', {}, config); | |
- expect(fs.readFile).toHaveBeenCalledTimes(1); | |
- expect(res.lockFile).toEqual('package-lock-contents'); | |
- expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); | |
- }); | |
- it('performs lock file updates', async () => { | |
- const execSnapshots = mockExecAll(exec); | |
+ it.each([['1.0.0'], ['2.0.0']])( | |
+ 'generates lock files using yarn v%s', | |
+ async yarnVersion => { | |
+ const execSnapshots = mockExecAll(exec, { | |
+ stdout: yarnVersion, | |
+ stderr: '', | |
+ }); | |
+ getInstalledPath.mockReturnValueOnce('node_modules/yarn'); | |
+ fs.readFile = jest.fn(() => 'package-lock-contents') as never; | |
+ const config = { | |
+ postUpdateOptions: ['yarnDedupeFewer', 'yarnDedupeHighest'], | |
+ }; | |
+ const res = await yarnHelper.generateLockFile('some-dir', {}, config); | |
+ expect(fs.readFile).toHaveBeenCalledTimes(1); | |
+ expect(res.lockFile).toEqual('package-lock-contents'); | |
+ expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); | |
+ } | |
+ ); | |
+ it.each([['1.0.0'], ['2.0.0']])( | |
+ 'performs lock file updates using yarn v%s', | |
+ async yarnVersion => { | |
+ const execSnapshots = mockExecAll(exec, { | |
+ stdout: yarnVersion, | |
+ stderr: '', | |
+ }); | |
- getInstalledPath.mockReturnValueOnce('node_modules/yarn'); | |
+ getInstalledPath.mockReturnValueOnce('node_modules/yarn'); | |
- fs.readFile = jest.fn(() => 'package-lock-contents') as never; | |
- process.env.YARN_MUTEX_FILE = '/tmp/yarn.mutext'; | |
- const res = await yarnHelper.generateLockFile('some-dir', {}, {}, [ | |
- { depName: 'some-dep', isLockfileUpdate: true }, | |
- ]); | |
- expect(res.lockFile).toEqual('package-lock-contents'); | |
- expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); | |
- }); | |
- it('detects yarnIntegrity', async () => { | |
- const execSnapshots = mockExecAll(exec); | |
+ fs.readFile = jest.fn(() => 'package-lock-contents') as never; | |
+ process.env.YARN_MUTEX_FILE = '/tmp/yarn.mutext'; | |
+ const res = await yarnHelper.generateLockFile('some-dir', {}, {}, [ | |
+ { depName: 'some-dep', isLockfileUpdate: true }, | |
+ ]); | |
+ expect(res.lockFile).toEqual('package-lock-contents'); | |
+ expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); | |
+ } | |
+ ); | |
+ it.each([['1.0.0'], ['2.0.0']])( | |
+ 'detects yarnIntegrity using yarn v%s', | |
+ async yarnVersion => { | |
+ const execSnapshots = mockExecAll(exec, { | |
+ stdout: yarnVersion, | |
+ stderr: '', | |
+ }); | |
- getInstalledPath.mockReturnValueOnce('node_modules/yarn'); | |
- fs.readFile = jest.fn(() => 'package-lock-contents') as never; | |
- const config = { | |
- upgrades: [{ yarnIntegrity: true }], | |
- }; | |
- const res = await yarnHelper.generateLockFile('some-dir', {}, config, [ | |
- { depName: 'some-dep', isLockfileUpdate: true }, | |
- ]); | |
- expect(res.lockFile).toEqual('package-lock-contents'); | |
- expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); | |
- }); | |
+ getInstalledPath.mockReturnValueOnce('node_modules/yarn'); | |
+ fs.readFile = jest.fn(() => 'package-lock-contents') as never; | |
+ const config = { | |
+ upgrades: [{ yarnIntegrity: true }], | |
+ }; | |
+ const res = await yarnHelper.generateLockFile('some-dir', {}, config, [ | |
+ { depName: 'some-dep', isLockfileUpdate: true }, | |
+ ]); | |
+ expect(res.lockFile).toEqual('package-lock-contents'); | |
+ expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); | |
+ } | |
+ ); | |
it('catches errors', async () => { | |
getInstalledPath.mockReturnValueOnce('node_modules/yarn'); | |
const execSnapshots = mockExecAll(exec, { | |
- stdout: '', | |
+ stdout: '1.9.4', | |
stderr: 'some-error', | |
}); | |
fs.readFile = jest.fn(() => { | |
@@ -87,7 +105,10 @@ describe('generateLockFile', () => { | |
expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); | |
}); | |
it('finds yarn embedded in renovate', async () => { | |
- const execSnapshots = mockExecAll(exec); | |
+ const execSnapshots = mockExecAll(exec, { | |
+ stdout: '1.9.4', | |
+ stderr: '', | |
+ }); | |
getInstalledPath.mockImplementationOnce(() => { | |
throw new Error('not found'); | |
}); | |
@@ -101,24 +122,33 @@ describe('generateLockFile', () => { | |
expect(res.lockFile).toEqual('package-lock-contents'); | |
expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); | |
}); | |
- it('finds yarn globally', async () => { | |
- const execSnapshots = mockExecAll(exec); | |
- getInstalledPath.mockImplementationOnce(() => { | |
- throw new Error('not found'); | |
- }); | |
- getInstalledPath.mockImplementationOnce(() => '/node_modules/renovate'); | |
- getInstalledPath.mockImplementationOnce(() => { | |
- throw new Error('not found'); | |
- }); | |
- getInstalledPath.mockImplementationOnce(() => '/node_modules/yarn'); | |
- fs.readFile = jest.fn(() => 'package-lock-contents') as never; | |
- const res = await yarnHelper.generateLockFile('some-dir'); | |
- expect(fs.readFile).toHaveBeenCalledTimes(1); | |
- expect(res.lockFile).toEqual('package-lock-contents'); | |
- expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); | |
- }); | |
+ it.each([['1.0.0'], ['2.0.0']])( | |
+ 'finds yarn v%s globally', | |
+ async yarnVersion => { | |
+ const execSnapshots = mockExecAll(exec, { | |
+ stdout: yarnVersion, | |
+ stderr: '', | |
+ }); | |
+ getInstalledPath.mockImplementationOnce(() => { | |
+ throw new Error('not found'); | |
+ }); | |
+ getInstalledPath.mockImplementationOnce(() => '/node_modules/renovate'); | |
+ getInstalledPath.mockImplementationOnce(() => { | |
+ throw new Error('not found'); | |
+ }); | |
+ getInstalledPath.mockImplementationOnce(() => '/node_modules/yarn'); | |
+ fs.readFile = jest.fn(() => 'package-lock-contents') as never; | |
+ const res = await yarnHelper.generateLockFile('some-dir'); | |
+ expect(fs.readFile).toHaveBeenCalledTimes(1); | |
+ expect(res.lockFile).toEqual('package-lock-contents'); | |
+ expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); | |
+ } | |
+ ); | |
it('uses fallback yarn', async () => { | |
- const execSnapshots = mockExecAll(exec); | |
+ const execSnapshots = mockExecAll(exec, { | |
+ stdout: '1.9.4', | |
+ stderr: '', | |
+ }); | |
getInstalledPath.mockImplementationOnce(() => { | |
throw new Error('not found'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment