From f4ecc4ff13c97a4c9152834ff7876b6656953340 Mon Sep 17 00:00:00 2001 From: Dimitri Mitropoulos Date: Mon, 16 Sep 2024 20:40:59 -0400 Subject: [PATCH] updates snapshots for new syntax --- .../__tests__/add-package-manager.test.ts | 18 +- .../__tests__/add-package-names.test.ts | 14 +- .../__tests__/clean-globs.test.ts | 4 +- .../__tests__/create-turbo-config.test.ts | 60 +++--- .../__tests__/migrate-dot-env.test.ts | 34 ++-- .../migrate-env-var-dependencies.test.ts | 188 +++++++++--------- .../__tests__/rename-output-mode.test.ts | 38 ++-- .../__tests__/rename-pipeline.ts | 14 +- .../__tests__/set-default-outputs.test.ts | 38 ++-- .../__tests__/stabilize-env-mode.test.ts | 32 +-- .../__tests__/stabilize-ui.test.ts | 12 +- ...ransform-env-literals-to-wildcards.test.ts | 20 +- .../__tests__/getComparison.test.ts | 70 +++---- .../__tests__/getTurboConfigs.test.ts | 72 +++---- 14 files changed, 307 insertions(+), 307 deletions(-) diff --git a/packages/turbo-codemod/__tests__/add-package-manager.test.ts b/packages/turbo-codemod/__tests__/add-package-manager.test.ts index 02dc3b16e360fd..4ac4edb354e723 100644 --- a/packages/turbo-codemod/__tests__/add-package-manager.test.ts +++ b/packages/turbo-codemod/__tests__/add-package-manager.test.ts @@ -317,15 +317,15 @@ describe("add-package-manager-2", () => { "Encountered an error while transforming files" ); expect(result.changes).toMatchInlineSnapshot(` - Object { - "package.json": Object { - "action": "error", - "additions": 1, - "deletions": 0, - "error": [Error: could not write file], - }, - } - `); + { + "package.json": { + "action": "error", + "additions": 1, + "deletions": 0, + "error": [Error: could not write file], + }, + } + `); mockWriteJsonSync.mockRestore(); mockGetAvailablePackageManagers.mockRestore(); diff --git a/packages/turbo-codemod/__tests__/add-package-names.test.ts b/packages/turbo-codemod/__tests__/add-package-names.test.ts index 603d6e5621751f..4f842a2988d41e 100644 --- a/packages/turbo-codemod/__tests__/add-package-names.test.ts +++ b/packages/turbo-codemod/__tests__/add-package-names.test.ts @@ -22,13 +22,13 @@ describe("add-package-names", () => { // result should be correct expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "packages/ui/package.json": Object { + { + "packages/ui/package.json": { "action": "modified", "additions": 1, "deletions": 0, }, - "packages/utils/package.json": Object { + "packages/utils/package.json": { "action": "modified", "additions": 1, "deletions": 0, @@ -64,8 +64,8 @@ describe("add-package-names", () => { // result should be correct expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "packages/utils/package.json": Object { + { + "packages/utils/package.json": { "action": "modified", "additions": 1, "deletions": 1, @@ -100,7 +100,7 @@ describe("add-package-names", () => { // result should be correct expect(result.fatalError).toBeUndefined(); - expect(result.changes).toMatchInlineSnapshot(`Object {}`); + expect(result.changes).toMatchInlineSnapshot(`{}`); // validate unique names const names = new Set(); @@ -129,7 +129,7 @@ describe("add-package-names", () => { // result should be correct expect(result.fatalError).toBeUndefined(); - expect(result.changes).toMatchInlineSnapshot(`Object {}`); + expect(result.changes).toMatchInlineSnapshot(`{}`); // validate unique names const names = new Set(); diff --git a/packages/turbo-codemod/__tests__/clean-globs.test.ts b/packages/turbo-codemod/__tests__/clean-globs.test.ts index 67e4e03f6d2b39..02e649fe5b339f 100644 --- a/packages/turbo-codemod/__tests__/clean-globs.test.ts +++ b/packages/turbo-codemod/__tests__/clean-globs.test.ts @@ -22,8 +22,8 @@ describe("clean-globs", () => { // result should be correct expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 6, "deletions": 6, diff --git a/packages/turbo-codemod/__tests__/create-turbo-config.test.ts b/packages/turbo-codemod/__tests__/create-turbo-config.test.ts index d3165f07dac83f..78178560092f88 100644 --- a/packages/turbo-codemod/__tests__/create-turbo-config.test.ts +++ b/packages/turbo-codemod/__tests__/create-turbo-config.test.ts @@ -30,13 +30,13 @@ describe("create-turbo-config", () => { // result should be correct expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "package.json": Object { + { + "package.json": { "action": "modified", "additions": 0, "deletions": 1, }, - "turbo.json": Object { + "turbo.json": { "action": "modified", "additions": 1, "deletions": 0, @@ -67,13 +67,13 @@ describe("create-turbo-config", () => { // result should be correct expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "package.json": Object { + { + "package.json": { "action": "modified", "additions": 0, "deletions": 1, }, - "turbo.json": Object { + "turbo.json": { "action": "modified", "additions": 1, "deletions": 0, @@ -89,13 +89,13 @@ describe("create-turbo-config", () => { // result should be correct expect(repeatResult.fatalError).toBeUndefined(); expect(repeatResult.changes).toMatchInlineSnapshot(` - Object { - "package.json": Object { + { + "package.json": { "action": "unchanged", "additions": 0, "deletions": 0, }, - "turbo.json": Object { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -126,13 +126,13 @@ describe("create-turbo-config", () => { // result should be correct expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "package.json": Object { + { + "package.json": { "action": "skipped", "additions": 0, "deletions": 1, }, - "turbo.json": Object { + "turbo.json": { "action": "skipped", "additions": 1, "deletions": 0, @@ -163,13 +163,13 @@ describe("create-turbo-config", () => { // result should be correct expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "package.json": Object { + { + "package.json": { "action": "modified", "additions": 0, "deletions": 1, }, - "turbo.json": Object { + "turbo.json": { "action": "modified", "additions": 1, "deletions": 0, @@ -200,13 +200,13 @@ describe("create-turbo-config", () => { // result should be correct expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "package.json": Object { + { + "package.json": { "action": "skipped", "additions": 0, "deletions": 1, }, - "turbo.json": Object { + "turbo.json": { "action": "skipped", "additions": 1, "deletions": 0, @@ -241,13 +241,13 @@ describe("create-turbo-config", () => { // result should be correct expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "package.json": Object { + { + "package.json": { "action": "unchanged", "additions": 0, "deletions": 0, }, - "turbo.json": Object { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -305,13 +305,13 @@ describe("create-turbo-config", () => { // result should be correct expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "package.json": Object { + { + "package.json": { "action": "unchanged", "additions": 0, "deletions": 0, }, - "turbo.json": Object { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -348,13 +348,13 @@ describe("create-turbo-config", () => { // result should be correct expect(result.fatalError?.message).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "package.json": Object { + { + "package.json": { "action": "unchanged", "additions": 0, "deletions": 0, }, - "turbo.json": Object { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -395,14 +395,14 @@ describe("create-turbo-config", () => { "Encountered an error while transforming files" ); expect(result.changes).toMatchInlineSnapshot(` - Object { - "package.json": Object { + { + "package.json": { "action": "error", "additions": 0, "deletions": 1, "error": [Error: could not write file], }, - "turbo.json": Object { + "turbo.json": { "action": "error", "additions": 1, "deletions": 0, diff --git a/packages/turbo-codemod/__tests__/migrate-dot-env.test.ts b/packages/turbo-codemod/__tests__/migrate-dot-env.test.ts index 0d299928ce7404..878b0d61aa9ce2 100644 --- a/packages/turbo-codemod/__tests__/migrate-dot-env.test.ts +++ b/packages/turbo-codemod/__tests__/migrate-dot-env.test.ts @@ -35,8 +35,8 @@ describe("migrate-dot-env", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 3, "deletions": 3, @@ -100,23 +100,23 @@ describe("migrate-dot-env", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "apps/docs/turbo.json": Object { + { + "apps/docs/turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, }, - "apps/web/turbo.json": Object { + "apps/web/turbo.json": { "action": "modified", "additions": 1, "deletions": 0, }, - "packages/ui/turbo.json": Object { + "packages/ui/turbo.json": { "action": "modified", "additions": 1, "deletions": 1, }, - "turbo.json": Object { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 2, @@ -144,8 +144,8 @@ describe("migrate-dot-env", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "skipped", "additions": 3, "deletions": 3, @@ -182,8 +182,8 @@ describe("migrate-dot-env", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 3, "deletions": 3, @@ -211,8 +211,8 @@ describe("migrate-dot-env", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "skipped", "additions": 3, "deletions": 3, @@ -241,8 +241,8 @@ describe("migrate-dot-env", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -280,8 +280,8 @@ describe("migrate-dot-env", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, diff --git a/packages/turbo-codemod/__tests__/migrate-env-var-dependencies.test.ts b/packages/turbo-codemod/__tests__/migrate-env-var-dependencies.test.ts index e9c047d21d6cb8..473d3f0b4a9dae 100644 --- a/packages/turbo-codemod/__tests__/migrate-env-var-dependencies.test.ts +++ b/packages/turbo-codemod/__tests__/migrate-env-var-dependencies.test.ts @@ -44,12 +44,12 @@ describe("migrate-env-var-dependencies", () => { const { hasKeys, envVars } = hasLegacyEnvVarDependencies(config); expect(hasKeys).toEqual(true); expect(envVars).toMatchInlineSnapshot(` - Array [ - "$GLOBAL_ENV_KEY", - "$TASK_ENV_KEY", - "$ANOTHER_ENV_KEY", - ] - `); + [ + "$GLOBAL_ENV_KEY", + "$TASK_ENV_KEY", + "$ANOTHER_ENV_KEY", + ] + `); }); it("finds env keys in legacy turbo.json - multiple pipeline keys", () => { @@ -59,13 +59,13 @@ describe("migrate-env-var-dependencies", () => { const { hasKeys, envVars } = hasLegacyEnvVarDependencies(config); expect(hasKeys).toEqual(true); expect(envVars).toMatchInlineSnapshot(` - Array [ - "$GLOBAL_ENV_KEY", - "$MY_ENV", - "$TASK_ENV_KEY", - "$ANOTHER_ENV_KEY", - ] - `); + [ + "$GLOBAL_ENV_KEY", + "$MY_ENV", + "$TASK_ENV_KEY", + "$ANOTHER_ENV_KEY", + ] + `); }); it("finds env keys in legacy turbo.json - no keys", () => { @@ -76,7 +76,7 @@ describe("migrate-env-var-dependencies", () => { }); const { hasKeys, envVars } = hasLegacyEnvVarDependencies(config); expect(hasKeys).toEqual(false); - expect(envVars).toMatchInlineSnapshot(`Array []`); + expect(envVars).toMatchInlineSnapshot(`[]`); }); it("finds env keys in turbo.json - no global", () => { @@ -85,7 +85,7 @@ describe("migrate-env-var-dependencies", () => { }); expect(hasKeys).toEqual(true); expect(envVars).toMatchInlineSnapshot(` - Array [ + [ "$cool", ] `); @@ -99,13 +99,13 @@ describe("migrate-env-var-dependencies", () => { const pipeline = migratePipeline(build); expect(pipeline).toHaveProperty("env"); expect(pipeline.env).toMatchInlineSnapshot(` - Array [ + [ "TASK_ENV_KEY", "ANOTHER_ENV_KEY", ] `); expect(pipeline.dependsOn).toMatchInlineSnapshot(` - Array [ + [ "^build", ] `); @@ -117,7 +117,7 @@ describe("migrate-env-var-dependencies", () => { const pipeline = migratePipeline(test); expect(pipeline.env).toBeUndefined(); expect(pipeline.dependsOn).toMatchInlineSnapshot(` - Array [ + [ "^build", ] `); @@ -131,12 +131,12 @@ describe("migrate-env-var-dependencies", () => { const pipeline = migratePipeline(test); expect(pipeline).toHaveProperty("env"); expect(pipeline.env).toMatchInlineSnapshot(` - Array [ + [ "$MY_ENV", ] `); expect(pipeline.dependsOn).toMatchInlineSnapshot(` - Array [ + [ "^build", ] `); @@ -152,13 +152,13 @@ describe("migrate-env-var-dependencies", () => { const pipeline = migratePipeline(test); expect(pipeline).toHaveProperty("env"); expect(pipeline.env).toMatchInlineSnapshot(` - Array [ + [ "$MY_ENV", "SUPER_COOL", ] `); expect(pipeline.dependsOn).toMatchInlineSnapshot(` - Array [ + [ "^build", ] `); @@ -174,13 +174,13 @@ describe("migrate-env-var-dependencies", () => { const pipeline = migratePipeline(test); expect(pipeline).toHaveProperty("env"); expect(pipeline.env).toMatchInlineSnapshot(` - Array [ + [ "$MY_ENV", "MY_ENV", ] `); expect(pipeline.dependsOn).toMatchInlineSnapshot(` - Array [ + [ "^build", ] `); @@ -192,37 +192,37 @@ describe("migrate-env-var-dependencies", () => { const config = getTestTurboConfig(); const pipeline = migrateConfig(config); expect(pipeline).toMatchInlineSnapshot(` - Object { + { "$schema": "./docs/public/schema.json", - "globalEnv": Array [ + "globalEnv": [ "GLOBAL_ENV_KEY", ], - "pipeline": Object { - "build": Object { - "dependsOn": Array [ + "pipeline": { + "build": { + "dependsOn": [ "^build", ], - "env": Array [ + "env": [ "TASK_ENV_KEY", "ANOTHER_ENV_KEY", ], - "outputs": Array [ + "outputs": [ "dist/**/*", ".next/**/*", "!.next/cache/**", ], }, - "dev": Object { + "dev": { "cache": false, }, - "lint": Object { - "outputs": Array [], + "lint": { + "outputs": [], }, - "test": Object { - "dependsOn": Array [ + "test": { + "dependsOn": [ "^build", ], - "outputs": Array [ + "outputs": [ "coverage/**/*", ], }, @@ -240,30 +240,30 @@ describe("migrate-env-var-dependencies", () => { }); const pipeline = migrateConfig(config); expect(pipeline).toMatchInlineSnapshot(` - Object { + { "$schema": "./docs/public/schema.json", - "pipeline": Object { - "build": Object { - "dependsOn": Array [ + "pipeline": { + "build": { + "dependsOn": [ "^build", ], - "outputs": Array [ + "outputs": [ "dist/**/*", ".next/**/*", "!.next/cache/**", ], }, - "dev": Object { + "dev": { "cache": false, }, - "lint": Object { - "outputs": Array [], + "lint": { + "outputs": [], }, - "test": Object { - "dependsOn": Array [ + "test": { + "dependsOn": [ "^build", ], - "outputs": Array [ + "outputs": [ "coverage/**/*", ], }, @@ -280,41 +280,41 @@ describe("migrate-env-var-dependencies", () => { }); const pipeline = migrateConfig(config); expect(pipeline).toMatchInlineSnapshot(` - Object { + { "$schema": "./docs/public/schema.json", - "globalEnv": Array [ + "globalEnv": [ "GLOBAL_ENV_KEY", ], - "pipeline": Object { - "build": Object { - "dependsOn": Array [ + "pipeline": { + "build": { + "dependsOn": [ "^build", ], - "env": Array [ + "env": [ "TASK_ENV_KEY", "ANOTHER_ENV_KEY", ], - "outputs": Array [ + "outputs": [ "dist/**/*", ".next/**/*", "!.next/cache/**", ], }, - "dev": Object { + "dev": { "cache": false, }, - "lint": Object { - "outputs": Array [], + "lint": { + "outputs": [], }, - "test": Object { - "dependsOn": Array [ + "test": { + "dependsOn": [ "^build", ], - "env": Array [ + "env": [ "$MY_ENV", "SUPER_COOL", ], - "outputs": Array [ + "outputs": [ "coverage/**/*", ], }, @@ -331,41 +331,41 @@ describe("migrate-env-var-dependencies", () => { }); const pipeline = migrateConfig(config); expect(pipeline).toMatchInlineSnapshot(` - Object { + { "$schema": "./docs/public/schema.json", - "globalEnv": Array [ + "globalEnv": [ "GLOBAL_ENV_KEY", ], - "pipeline": Object { - "build": Object { - "dependsOn": Array [ + "pipeline": { + "build": { + "dependsOn": [ "^build", ], - "env": Array [ + "env": [ "TASK_ENV_KEY", "ANOTHER_ENV_KEY", ], - "outputs": Array [ + "outputs": [ "dist/**/*", ".next/**/*", "!.next/cache/**", ], }, - "dev": Object { + "dev": { "cache": false, }, - "lint": Object { - "outputs": Array [], + "lint": { + "outputs": [], }, - "test": Object { - "dependsOn": Array [ + "test": { + "dependsOn": [ "^build", ], - "env": Array [ + "env": [ "$MY_ENV", "MY_ENV", ], - "outputs": Array [ + "outputs": [ "coverage/**/*", ], }, @@ -421,8 +421,8 @@ describe("migrate-env-var-dependencies", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 4, "deletions": 4, @@ -495,18 +495,18 @@ describe("migrate-env-var-dependencies", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "apps/web/turbo.json": Object { + { + "apps/web/turbo.json": { "action": "modified", "additions": 1, "deletions": 0, }, - "packages/ui/turbo.json": Object { + "packages/ui/turbo.json": { "action": "modified", "additions": 1, "deletions": 1, }, - "turbo.json": Object { + "turbo.json": { "action": "modified", "additions": 4, "deletions": 4, @@ -555,8 +555,8 @@ describe("migrate-env-var-dependencies", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 4, "deletions": 4, @@ -572,8 +572,8 @@ describe("migrate-env-var-dependencies", () => { expect(repeatResult.fatalError).toBeUndefined(); expect(repeatResult.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -601,8 +601,8 @@ describe("migrate-env-var-dependencies", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "skipped", "additions": 4, "deletions": 4, @@ -651,8 +651,8 @@ describe("migrate-env-var-dependencies", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 4, "deletions": 4, @@ -680,8 +680,8 @@ describe("migrate-env-var-dependencies", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "skipped", "additions": 4, "deletions": 4, @@ -708,8 +708,8 @@ describe("migrate-env-var-dependencies", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, diff --git a/packages/turbo-codemod/__tests__/rename-output-mode.test.ts b/packages/turbo-codemod/__tests__/rename-output-mode.test.ts index caa422db48fc2a..0e9f6c7064aabd 100644 --- a/packages/turbo-codemod/__tests__/rename-output-mode.test.ts +++ b/packages/turbo-codemod/__tests__/rename-output-mode.test.ts @@ -34,8 +34,8 @@ describe("rename-output-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 2, @@ -99,23 +99,23 @@ describe("rename-output-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "apps/docs/turbo.json": Object { + { + "apps/docs/turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, }, - "apps/web/turbo.json": Object { + "apps/web/turbo.json": { "action": "modified", "additions": 1, "deletions": 0, }, - "packages/ui/turbo.json": Object { + "packages/ui/turbo.json": { "action": "modified", "additions": 1, "deletions": 1, }, - "turbo.json": Object { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 2, @@ -143,8 +143,8 @@ describe("rename-output-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "skipped", "additions": 2, "deletions": 2, @@ -180,8 +180,8 @@ describe("rename-output-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 2, @@ -209,8 +209,8 @@ describe("rename-output-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "skipped", "additions": 2, "deletions": 2, @@ -270,8 +270,8 @@ describe("rename-output-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 10, "deletions": 10, @@ -300,8 +300,8 @@ describe("rename-output-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -339,8 +339,8 @@ describe("rename-output-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, diff --git a/packages/turbo-codemod/__tests__/rename-pipeline.ts b/packages/turbo-codemod/__tests__/rename-pipeline.ts index 18e2cec7e6798b..f7cf3f909d5db5 100644 --- a/packages/turbo-codemod/__tests__/rename-pipeline.ts +++ b/packages/turbo-codemod/__tests__/rename-pipeline.ts @@ -31,8 +31,8 @@ describe("rename-pipeline", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 1, "deletions": 1, @@ -94,23 +94,23 @@ describe("rename-pipeline", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "apps/docs/turbo.json": Object { + { + "apps/docs/turbo.json": { "action": "modified", "additions": 1, "deletions": 1, }, - "apps/web/turbo.json": Object { + "apps/web/turbo.json": { "action": "modified", "additions": 1, "deletions": 1, }, - "packages/ui/turbo.json": Object { + "packages/ui/turbo.json": { "action": "modified", "additions": 1, "deletions": 1, }, - "turbo.json": Object { + "turbo.json": { "action": "modified", "additions": 1, "deletions": 1, diff --git a/packages/turbo-codemod/__tests__/set-default-outputs.test.ts b/packages/turbo-codemod/__tests__/set-default-outputs.test.ts index b6ef9e537bf588..707059eff45e61 100644 --- a/packages/turbo-codemod/__tests__/set-default-outputs.test.ts +++ b/packages/turbo-codemod/__tests__/set-default-outputs.test.ts @@ -34,8 +34,8 @@ describe("set-default-outputs", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 1, @@ -99,23 +99,23 @@ describe("set-default-outputs", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "apps/docs/turbo.json": Object { + { + "apps/docs/turbo.json": { "action": "modified", "additions": 1, "deletions": 1, }, - "apps/web/turbo.json": Object { + "apps/web/turbo.json": { "action": "modified", "additions": 1, "deletions": 0, }, - "packages/ui/turbo.json": Object { + "packages/ui/turbo.json": { "action": "modified", "additions": 1, "deletions": 1, }, - "turbo.json": Object { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 1, @@ -143,8 +143,8 @@ describe("set-default-outputs", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "skipped", "additions": 2, "deletions": 1, @@ -180,8 +180,8 @@ describe("set-default-outputs", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 1, @@ -209,8 +209,8 @@ describe("set-default-outputs", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "skipped", "additions": 2, "deletions": 1, @@ -270,8 +270,8 @@ describe("set-default-outputs", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 6, "deletions": 5, @@ -300,8 +300,8 @@ describe("set-default-outputs", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -341,8 +341,8 @@ describe("set-default-outputs", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 0, diff --git a/packages/turbo-codemod/__tests__/stabilize-env-mode.test.ts b/packages/turbo-codemod/__tests__/stabilize-env-mode.test.ts index 750646a2db0786..dcae6af493313e 100644 --- a/packages/turbo-codemod/__tests__/stabilize-env-mode.test.ts +++ b/packages/turbo-codemod/__tests__/stabilize-env-mode.test.ts @@ -34,8 +34,8 @@ describe("stabilize-env-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 4, @@ -76,8 +76,8 @@ describe("stabilize-env-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 6, @@ -110,8 +110,8 @@ describe("stabilize-env-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 2, @@ -141,8 +141,8 @@ describe("stabilize-env-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -175,8 +175,8 @@ describe("stabilize-env-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -209,8 +209,8 @@ describe("stabilize-env-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 2, @@ -270,18 +270,18 @@ describe("stabilize-env-mode", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "apps/docs/turbo.json": Object { + { + "apps/docs/turbo.json": { "action": "modified", "additions": 1, "deletions": 1, }, - "apps/website/turbo.json": Object { + "apps/website/turbo.json": { "action": "modified", "additions": 1, "deletions": 2, }, - "turbo.json": Object { + "turbo.json": { "action": "modified", "additions": 2, "deletions": 4, diff --git a/packages/turbo-codemod/__tests__/stabilize-ui.test.ts b/packages/turbo-codemod/__tests__/stabilize-ui.test.ts index 48f3e955010c6f..60364f7523b9e7 100644 --- a/packages/turbo-codemod/__tests__/stabilize-ui.test.ts +++ b/packages/turbo-codemod/__tests__/stabilize-ui.test.ts @@ -30,8 +30,8 @@ describe("stabilize-ui", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -63,8 +63,8 @@ describe("stabilize-ui", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 0, "deletions": 1, @@ -97,8 +97,8 @@ describe("stabilize-ui", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 1, "deletions": 1, diff --git a/packages/turbo-codemod/__tests__/transform-env-literals-to-wildcards.test.ts b/packages/turbo-codemod/__tests__/transform-env-literals-to-wildcards.test.ts index fd383e5d024e1a..11c24a90503995 100644 --- a/packages/turbo-codemod/__tests__/transform-env-literals-to-wildcards.test.ts +++ b/packages/turbo-codemod/__tests__/transform-env-literals-to-wildcards.test.ts @@ -33,8 +33,8 @@ describe.only("transform-env-literals-to-wildcards", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -64,8 +64,8 @@ describe.only("transform-env-literals-to-wildcards", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "unchanged", "additions": 0, "deletions": 0, @@ -100,8 +100,8 @@ describe.only("transform-env-literals-to-wildcards", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "turbo.json": Object { + { + "turbo.json": { "action": "modified", "additions": 4, "deletions": 4, @@ -156,18 +156,18 @@ describe.only("transform-env-literals-to-wildcards", () => { expect(result.fatalError).toBeUndefined(); expect(result.changes).toMatchInlineSnapshot(` - Object { - "apps/docs/turbo.json": Object { + { + "apps/docs/turbo.json": { "action": "modified", "additions": 2, "deletions": 2, }, - "apps/website/turbo.json": Object { + "apps/website/turbo.json": { "action": "modified", "additions": 2, "deletions": 2, }, - "turbo.json": Object { + "turbo.json": { "action": "modified", "additions": 4, "deletions": 4, diff --git a/packages/turbo-ignore/__tests__/getComparison.test.ts b/packages/turbo-ignore/__tests__/getComparison.test.ts index 8635964a53aa5c..e5b7b7f82bcb43 100644 --- a/packages/turbo-ignore/__tests__/getComparison.test.ts +++ b/packages/turbo-ignore/__tests__/getComparison.test.ts @@ -9,22 +9,22 @@ describe("getComparison()", () => { it("uses headRelative comparison when not running Vercel CI", () => { expect(getComparison({ workspace: "test-workspace" })) .toMatchInlineSnapshot(` - Object { - "ref": "HEAD^", - "type": "headRelative", - } - `); + { + "ref": "HEAD^", + "type": "headRelative", + } + `); expect(mockConsole.log).toHaveBeenCalledTimes(0); }); it("uses fallback comparison if provided when not running Vercel CI", () => { expect(getComparison({ workspace: "test-workspace", fallback: "HEAD^2" })) .toMatchInlineSnapshot(` - Object { - "ref": "HEAD^2", - "type": "customFallback", - } - `); + { + "ref": "HEAD^2", + "type": "customFallback", + } + `); validateLogs(["Falling back to ref HEAD^2"], mockConsole.log, { prefix: "≫ ", }); @@ -48,11 +48,11 @@ describe("getComparison()", () => { process.env.VERCEL_GIT_COMMIT_REF = "my-branch"; expect(getComparison({ workspace: "test-workspace", fallback: "HEAD^2" })) .toMatchInlineSnapshot(` - Object { - "ref": "HEAD^2", - "type": "customFallback", - } - `); + { + "ref": "HEAD^2", + "type": "customFallback", + } + `); validateLogs( [ @@ -68,11 +68,11 @@ describe("getComparison()", () => { process.env.VERCEL = "1"; expect(getComparison({ workspace: "test-workspace", fallback: "HEAD^2" })) .toMatchInlineSnapshot(` - Object { - "ref": "HEAD^2", - "type": "customFallback", - } - `); + { + "ref": "HEAD^2", + "type": "customFallback", + } + `); validateLogs( [ @@ -94,11 +94,11 @@ describe("getComparison()", () => { process.env.VERCEL_GIT_COMMIT_REF = "my-branch"; expect(getComparison({ workspace: "test-workspace" })) .toMatchInlineSnapshot(` - Object { - "ref": "mygitsha", - "type": "previousDeploy", - } - `); + { + "ref": "mygitsha", + "type": "previousDeploy", + } + `); validateLogs( [ @@ -123,11 +123,11 @@ describe("getComparison()", () => { process.env.VERCEL_GIT_COMMIT_REF = "my-branch"; expect(getComparison({ workspace: "test-workspace", fallback: "HEAD^2" })) .toMatchInlineSnapshot(` - Object { - "ref": "HEAD^2", - "type": "customFallback", - } - `); + { + "ref": "HEAD^2", + "type": "customFallback", + } + `); validateLogs( [ @@ -173,11 +173,11 @@ describe("getComparison()", () => { process.env.VERCEL_GIT_PREVIOUS_SHA = "mygitsha"; expect(getComparison({ workspace: "test-workspace" })) .toMatchInlineSnapshot(` - Object { - "ref": "mygitsha", - "type": "previousDeploy", - } - `); + { + "ref": "mygitsha", + "type": "previousDeploy", + } + `); validateLogs( ['Found previous deployment ("mygitsha") for "test-workspace"'], diff --git a/packages/turbo-utils/__tests__/getTurboConfigs.test.ts b/packages/turbo-utils/__tests__/getTurboConfigs.test.ts index 27b0e458e69174..cc96fee5484aff 100644 --- a/packages/turbo-utils/__tests__/getTurboConfigs.test.ts +++ b/packages/turbo-utils/__tests__/getTurboConfigs.test.ts @@ -14,40 +14,40 @@ describe("getTurboConfigs", () => { expect(configs).toHaveLength(1); expect(configs[0].isRootConfig).toBe(true); expect(configs[0].config).toMatchInlineSnapshot(` - Object { + { "$schema": "https://turbo.build/schema.json", - "globalEnv": Array [ + "globalEnv": [ "UNORDERED", "CI", ], - "tasks": Object { - "build": Object { - "dependsOn": Array [ + "tasks": { + "build": { + "dependsOn": [ "^build", ], }, - "deploy": Object { - "dependsOn": Array [ + "deploy": { + "dependsOn": [ "build", "test", "lint", ], - "outputs": Array [], + "outputs": [], }, - "lint": Object { - "outputs": Array [], + "lint": { + "outputs": [], }, - "test": Object { - "dependsOn": Array [ + "test": { + "dependsOn": [ "build", ], - "inputs": Array [ + "inputs": [ "src/**/*.tsx", "src/**/*.ts", "test/**/*.ts", "test/**/*.tsx", ], - "outputs": Array [], + "outputs": [], }, }, } @@ -61,14 +61,14 @@ describe("getTurboConfigs", () => { expect(configs).toHaveLength(3); expect(configs[0].isRootConfig).toBe(true); expect(configs[0].config).toMatchInlineSnapshot(` - Object { + { "$schema": "https://turbo.build/schema.json", - "globalEnv": Array [ + "globalEnv": [ "CI", ], - "tasks": Object { - "build": Object { - "env": Array [ + "tasks": { + "build": { + "env": [ "ENV_1", ], }, @@ -77,14 +77,14 @@ describe("getTurboConfigs", () => { `); expect(configs[1].isRootConfig).toBe(false); expect(configs[1].config).toMatchInlineSnapshot(` - Object { + { "$schema": "https://turbo.build/schema.json", - "extends": Array [ + "extends": [ "//", ], - "tasks": Object { - "build": Object { - "env": Array [ + "tasks": { + "build": { + "env": [ "ENV_2", ], }, @@ -94,14 +94,14 @@ describe("getTurboConfigs", () => { expect(configs[2].isRootConfig).toBe(false); expect(configs[2].config).toMatchInlineSnapshot(` - Object { + { "$schema": "https://turbo.build/schema.json", - "extends": Array [ + "extends": [ "//", ], - "tasks": Object { - "build": Object { - "env": Array [ + "tasks": { + "build": { + "env": [ "IS_SERVER", ], }, @@ -117,23 +117,23 @@ describe("getTurboConfigs", () => { expect(configs).toHaveLength(1); expect(configs[0].isRootConfig).toBe(true); expect(configs[0].config).toMatchInlineSnapshot(` - Object { + { "$schema": "https://turbo.build/schema.json", - "globalDependencies": Array [ + "globalDependencies": [ "**/.env.*local", ], - "tasks": Object { - "build": Object { - "outputs": Array [ + "tasks": { + "build": { + "outputs": [ ".next/**", "!.next/cache/**", ], }, - "dev": Object { + "dev": { "cache": false, "persistent": true, }, - "lint": Object {}, + "lint": {}, }, } `);