diff options
| author | 2023-04-28 01:36:44 +0800 | |
|---|---|---|
| committer | 2023-04-28 01:36:44 +0800 | |
| commit | dd84b9d64fb98746a230cd24233ff50a562c39c9 (patch) | |
| tree | b583261ef00b3afe72ec4d6dacb31e57779a6faf /packages/turbo-workspaces/__tests__/test-utils.ts | |
| parent | 0b46fcd72ac34382387b2bcf9095233efbcc52f4 (diff) | |
| download | HydroRoll-dd84b9d64fb98746a230cd24233ff50a562c39c9.tar.gz HydroRoll-dd84b9d64fb98746a230cd24233ff50a562c39c9.zip | |
Diffstat (limited to 'packages/turbo-workspaces/__tests__/test-utils.ts')
| -rw-r--r-- | packages/turbo-workspaces/__tests__/test-utils.ts | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/packages/turbo-workspaces/__tests__/test-utils.ts b/packages/turbo-workspaces/__tests__/test-utils.ts new file mode 100644 index 0000000..4d6c7c9 --- /dev/null +++ b/packages/turbo-workspaces/__tests__/test-utils.ts @@ -0,0 +1,153 @@ +import { PackageManager } from "../src/types"; + +const PACKAGE_MANAGERS: Array<PackageManager> = ["pnpm", "npm", "yarn"]; +const REPO_TYPES = ["monorepo", "non-monorepo"]; +const BOOLEAN_OPTIONS = [true, false]; + +export function generateConvertMatrix() { + const matrix = []; + for (const fixtureManager of PACKAGE_MANAGERS) { + for (const fixtureType of REPO_TYPES) { + for (const toManager of PACKAGE_MANAGERS) { + for (const interactive of BOOLEAN_OPTIONS) { + for (const dry of BOOLEAN_OPTIONS) { + for (const install of BOOLEAN_OPTIONS) { + matrix.push({ + fixtureManager, + fixtureType, + toManager, + interactive, + dry, + install, + }); + } + } + } + } + } + } + return matrix; +} + +export function generateDetectMatrix() { + const matrix = []; + for (const project of PACKAGE_MANAGERS) { + for (const manager of PACKAGE_MANAGERS) { + for (const type of REPO_TYPES) { + matrix.push({ + project, + manager, + type, + result: project === manager, + }); + } + } + } + return matrix; +} + +export function generateCreateMatrix() { + const matrix = []; + for (const project of PACKAGE_MANAGERS) { + for (const manager of PACKAGE_MANAGERS) { + for (const type of REPO_TYPES) { + for (const interactive of BOOLEAN_OPTIONS) { + for (const dry of BOOLEAN_OPTIONS) { + matrix.push({ + project, + manager, + type, + interactive, + dry, + }); + } + } + } + } + } + return matrix; +} + +export function generateReadMatrix() { + const matrix = []; + for (const fixtureManager of PACKAGE_MANAGERS) { + for (const fixtureType of REPO_TYPES) { + for (const toManager of PACKAGE_MANAGERS) { + matrix.push({ + fixtureManager, + fixtureType, + toManager, + shouldThrow: fixtureManager !== toManager, + }); + } + } + } + + return matrix; +} + +export function generateRemoveMatrix() { + const matrix = []; + for (const fixtureManager of PACKAGE_MANAGERS) { + for (const fixtureType of REPO_TYPES) { + for (const toManager of PACKAGE_MANAGERS) { + for (const withNodeModules of BOOLEAN_OPTIONS) { + for (const interactive of BOOLEAN_OPTIONS) { + for (const dry of BOOLEAN_OPTIONS) { + matrix.push({ + fixtureManager, + fixtureType, + withNodeModules, + toManager, + interactive, + dry, + }); + } + } + } + } + } + } + return matrix; +} + +export function generateCleanMatrix() { + const matrix = []; + for (const fixtureManager of PACKAGE_MANAGERS) { + for (const fixtureType of REPO_TYPES) { + for (const interactive of BOOLEAN_OPTIONS) { + for (const dry of BOOLEAN_OPTIONS) { + matrix.push({ + fixtureManager, + fixtureType, + interactive, + dry, + }); + } + } + } + } + return matrix; +} + +export function generateConvertLockMatrix() { + const matrix = []; + for (const fixtureManager of PACKAGE_MANAGERS) { + for (const fixtureType of REPO_TYPES) { + for (const toManager of PACKAGE_MANAGERS) { + for (const interactive of BOOLEAN_OPTIONS) { + for (const dry of BOOLEAN_OPTIONS) { + matrix.push({ + fixtureManager, + fixtureType, + toManager, + interactive, + dry, + }); + } + } + } + } + } + return matrix; +} |
