diff --git a/__tests__/frontend/basic.spec.ts b/__tests__/frontend/basic.spec.ts index 0d610aa1..e02167d1 100644 --- a/__tests__/frontend/basic.spec.ts +++ b/__tests__/frontend/basic.spec.ts @@ -7,7 +7,7 @@ test("works with basic configuration", async ({ page }) => { const getCalls = await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { response: [], status: "success" }, @@ -17,7 +17,7 @@ test("works with basic configuration", async ({ page }) => { value: { response: [], status: "success" }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { status: "success", value: { response: { errors: [] }, status: "success" }, diff --git a/__tests__/frontend/configuration.spec.ts b/__tests__/frontend/configuration.spec.ts index 81c12151..bb5a5a07 100644 --- a/__tests__/frontend/configuration.spec.ts +++ b/__tests__/frontend/configuration.spec.ts @@ -7,7 +7,7 @@ test("works with copy configuration", async ({ page }) => { const getCalls = await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { response: [], status: "success" }, @@ -17,7 +17,7 @@ test("works with copy configuration", async ({ page }) => { value: { response: [], status: "success" }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { status: "success", value: { response: { errors: [] }, status: "success" }, @@ -53,7 +53,7 @@ test("works with merge configuration", async ({ page }) => { const getCalls = await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { response: [], status: "success" }, @@ -63,7 +63,7 @@ test("works with merge configuration", async ({ page }) => { value: { response: [], status: "success" }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { status: "success", value: { response: { errors: [] }, status: "success" }, diff --git a/__tests__/frontend/destination-selection-api-error.spec.ts b/__tests__/frontend/destination-selection-api-error.spec.ts index 31444ef4..123bfeda 100644 --- a/__tests__/frontend/destination-selection-api-error.spec.ts +++ b/__tests__/frontend/destination-selection-api-error.spec.ts @@ -9,13 +9,13 @@ test("handles raw errors in source folder selection gracefully", async ({ await setup(page); await page.evaluate(() => { - window._endpointStubs.listFolders = [ + window._endpointStubs["listFolders"] = [ { status: "success", value: { status: "error", type: "DriveAPIError" }, }, ]; - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { diff --git a/__tests__/frontend/destination-selection-invalid-parameter-error.spec.ts b/__tests__/frontend/destination-selection-invalid-parameter-error.spec.ts index 7c83ee7f..5ba54e10 100644 --- a/__tests__/frontend/destination-selection-invalid-parameter-error.spec.ts +++ b/__tests__/frontend/destination-selection-invalid-parameter-error.spec.ts @@ -9,13 +9,13 @@ test("handles raw errors in source folder selection gracefully", async ({ await setup(page); await page.evaluate(() => { - window._endpointStubs.listFolders = [ + window._endpointStubs["listFolders"] = [ { status: "success", value: { status: "error", type: "invalidParameter" }, }, ]; - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { diff --git a/__tests__/frontend/destination-selection-unhandled-error.spec.ts b/__tests__/frontend/destination-selection-unhandled-error.spec.ts index fa529111..c017266e 100644 --- a/__tests__/frontend/destination-selection-unhandled-error.spec.ts +++ b/__tests__/frontend/destination-selection-unhandled-error.spec.ts @@ -9,13 +9,13 @@ test("handles raw errors in source folder selection gracefully", async ({ await setup(page); await page.evaluate(() => { - window._endpointStubs.listFolders = [ + window._endpointStubs["listFolders"] = [ { status: "failure", value: new Error("ERROR MESSAGE"), }, ]; - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { diff --git a/__tests__/frontend/destination-selection-unknown-error.spec.ts b/__tests__/frontend/destination-selection-unknown-error.spec.ts index 749df106..a8b427c6 100644 --- a/__tests__/frontend/destination-selection-unknown-error.spec.ts +++ b/__tests__/frontend/destination-selection-unknown-error.spec.ts @@ -9,13 +9,13 @@ test("handles raw errors in source folder selection gracefully", async ({ await setup(page); await page.evaluate(() => { - window._endpointStubs.listFolders = [ + window._endpointStubs["listFolders"] = [ { status: "success", value: { status: "error", type: "unknown" }, }, ]; - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { diff --git a/__tests__/frontend/move-api-error.spec.ts b/__tests__/frontend/move-api-error.spec.ts index a73f667f..f3a097ba 100644 --- a/__tests__/frontend/move-api-error.spec.ts +++ b/__tests__/frontend/move-api-error.spec.ts @@ -7,7 +7,7 @@ test("works with an API error", async ({ page }) => { await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { response: [], status: "success" }, @@ -17,7 +17,7 @@ test("works with an API error", async ({ page }) => { value: { response: [], status: "success" }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { status: "success", value: { status: "error", type: "DriveAPIError" }, diff --git a/__tests__/frontend/move-folders-equal-error.spec.ts b/__tests__/frontend/move-folders-equal-error.spec.ts index 203e5a0c..c1e80d48 100644 --- a/__tests__/frontend/move-folders-equal-error.spec.ts +++ b/__tests__/frontend/move-folders-equal-error.spec.ts @@ -9,7 +9,7 @@ test("works with source and destination folders being equal", async ({ await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { response: [], status: "success" }, @@ -19,7 +19,7 @@ test("works with source and destination folders being equal", async ({ value: { response: [], status: "success" }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { status: "success", value: { status: "error", type: "sourceEqualsDestination" }, diff --git a/__tests__/frontend/move-invalid-parameter-error.spec.ts b/__tests__/frontend/move-invalid-parameter-error.spec.ts index ef1b6105..8d683b3a 100644 --- a/__tests__/frontend/move-invalid-parameter-error.spec.ts +++ b/__tests__/frontend/move-invalid-parameter-error.spec.ts @@ -7,7 +7,7 @@ test("works with an API error", async ({ page }) => { await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { response: [], status: "success" }, @@ -17,7 +17,7 @@ test("works with an API error", async ({ page }) => { value: { response: [], status: "success" }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { status: "success", value: { status: "error", type: "invalidParameter" }, diff --git a/__tests__/frontend/move-repeat-after-timeout.spec.ts b/__tests__/frontend/move-repeat-after-timeout.spec.ts index c8f7f1f1..5efa38d2 100644 --- a/__tests__/frontend/move-repeat-after-timeout.spec.ts +++ b/__tests__/frontend/move-repeat-after-timeout.spec.ts @@ -9,7 +9,7 @@ test("works with an unhandled move error", async ({ page }) => { await page.evaluate(() => { const e = new Error(); e.name = "ScriptError"; - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { response: [], status: "success" }, @@ -19,7 +19,7 @@ test("works with an unhandled move error", async ({ page }) => { value: { response: [], status: "success" }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { status: "failure", value: e, diff --git a/__tests__/frontend/move-unhandled-error.spec.ts b/__tests__/frontend/move-unhandled-error.spec.ts index 2a2f3b8d..4517dafd 100644 --- a/__tests__/frontend/move-unhandled-error.spec.ts +++ b/__tests__/frontend/move-unhandled-error.spec.ts @@ -7,7 +7,7 @@ test("works with an unhandled move error", async ({ page }) => { await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { response: [], status: "success" }, @@ -17,7 +17,7 @@ test("works with an unhandled move error", async ({ page }) => { value: { response: [], status: "success" }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { status: "failure", value: new Error("ERROR MESSAGE"), diff --git a/__tests__/frontend/move-unknown-error.spec.ts b/__tests__/frontend/move-unknown-error.spec.ts index a5023d4e..3427888f 100644 --- a/__tests__/frontend/move-unknown-error.spec.ts +++ b/__tests__/frontend/move-unknown-error.spec.ts @@ -7,7 +7,7 @@ test("works with an unknown move error", async ({ page }) => { await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { response: [], status: "success" }, @@ -17,7 +17,7 @@ test("works with an unknown move error", async ({ page }) => { value: { response: [], status: "success" }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { status: "success", value: { status: "error", type: "unknown" }, diff --git a/__tests__/frontend/navigation.spec.ts b/__tests__/frontend/navigation.spec.ts index 64e034be..2f4c11b9 100644 --- a/__tests__/frontend/navigation.spec.ts +++ b/__tests__/frontend/navigation.spec.ts @@ -7,7 +7,7 @@ test("works with basic configuration", async ({ page }) => { const getCalls = await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { response: [], status: "success" }, @@ -33,7 +33,7 @@ test("works with basic configuration", async ({ page }) => { value: { response: [], status: "success" }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { status: "success", value: { response: { errors: [] }, status: "success" }, diff --git a/__tests__/frontend/non-empty.spec.ts b/__tests__/frontend/non-empty.spec.ts index 17ea65fa..a6e912cd 100644 --- a/__tests__/frontend/non-empty.spec.ts +++ b/__tests__/frontend/non-empty.spec.ts @@ -7,7 +7,7 @@ test("works with non-empty destination folder", async ({ page }) => { const getCalls = await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { response: [], status: "success" }, @@ -21,7 +21,7 @@ test("works with non-empty destination folder", async ({ page }) => { value: { response: [], status: "success" }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { delay: 500, status: "success", diff --git a/__tests__/frontend/source-destination-selection.spec.ts b/__tests__/frontend/source-destination-selection.spec.ts index 2dd0c67f..48a6260d 100644 --- a/__tests__/frontend/source-destination-selection.spec.ts +++ b/__tests__/frontend/source-destination-selection.spec.ts @@ -7,7 +7,7 @@ test("works with folder selection", async ({ page }) => { const getCalls = await setup(page); await page.evaluate(() => { - window._endpointStubs.listFolders = [ + window._endpointStubs["listFolders"] = [ { status: "success", value: { @@ -96,7 +96,7 @@ test("works with folder selection", async ({ page }) => { }, }, ]; - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { @@ -138,7 +138,7 @@ test("works with folder selection", async ({ page }) => { }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { status: "success", value: { response: { errors: [] }, status: "success" }, diff --git a/__tests__/frontend/source-selection-api-error.spec.ts b/__tests__/frontend/source-selection-api-error.spec.ts index 8510dd2c..6647038f 100644 --- a/__tests__/frontend/source-selection-api-error.spec.ts +++ b/__tests__/frontend/source-selection-api-error.spec.ts @@ -9,7 +9,7 @@ test("handles raw errors in source folder selection gracefully", async ({ await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { status: "error", type: "DriveAPIError" }, diff --git a/__tests__/frontend/source-selection-invalid-parameter-error.spec.ts b/__tests__/frontend/source-selection-invalid-parameter-error.spec.ts index ba2386b0..ea3c341d 100644 --- a/__tests__/frontend/source-selection-invalid-parameter-error.spec.ts +++ b/__tests__/frontend/source-selection-invalid-parameter-error.spec.ts @@ -9,7 +9,7 @@ test("handles invalid parameter errors in source folder selection gracefully", a await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { status: "error", type: "invalidParameter" }, diff --git a/__tests__/frontend/source-selection-unhandled-error.spec.ts b/__tests__/frontend/source-selection-unhandled-error.spec.ts index 48d5e684..578f306b 100644 --- a/__tests__/frontend/source-selection-unhandled-error.spec.ts +++ b/__tests__/frontend/source-selection-unhandled-error.spec.ts @@ -9,7 +9,7 @@ test("handles raw errors in source folder selection gracefully", async ({ await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "failure", value: new Error("ERROR MESSAGE"), diff --git a/__tests__/frontend/source-selection-unknown-error.spec.ts b/__tests__/frontend/source-selection-unknown-error.spec.ts index b823510f..84642e0a 100644 --- a/__tests__/frontend/source-selection-unknown-error.spec.ts +++ b/__tests__/frontend/source-selection-unknown-error.spec.ts @@ -9,7 +9,7 @@ test("handles raw errors in source folder selection gracefully", async ({ await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { status: "error", type: "unknown" }, diff --git a/__tests__/frontend/success-with-errors.spec.ts b/__tests__/frontend/success-with-errors.spec.ts index a2f20ec2..024c71a7 100644 --- a/__tests__/frontend/success-with-errors.spec.ts +++ b/__tests__/frontend/success-with-errors.spec.ts @@ -7,7 +7,7 @@ test("works and displays moving errors", async ({ page }) => { const getCalls = await setup(page); await page.evaluate(() => { - window._endpointStubs.listSharedDrives = [ + window._endpointStubs["listSharedDrives"] = [ { status: "success", value: { response: [], status: "success" }, @@ -17,7 +17,7 @@ test("works and displays moving errors", async ({ page }) => { value: { response: [], status: "success" }, }, ]; - window._endpointStubs.move = [ + window._endpointStubs["move"] = [ { status: "success", value: { diff --git a/playwright.config.ts b/playwright.config.ts index 942ffa73..70666037 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,7 +1,7 @@ import { defineConfig, devices } from "@playwright/test"; export default defineConfig({ - forbidOnly: process.env.CI !== undefined, + forbidOnly: process.env["CI"] !== undefined, fullyParallel: true, projects: [ { @@ -17,8 +17,8 @@ export default defineConfig({ use: { ...devices["Desktop Safari"] }, }, ], - reporter: process.env.CI !== undefined ? "html" : "list", - retries: process.env.CI !== undefined ? 2 : 0, + reporter: process.env["CI"] !== undefined ? "html" : "list", + retries: process.env["CI"] !== undefined ? 2 : 0, testDir: "./__tests__/frontend", use: { baseURL: "http://127.0.0.1:8080", @@ -26,9 +26,9 @@ export default defineConfig({ }, webServer: { command: "npm run start", - reuseExistingServer: process.env.CI === undefined, + reuseExistingServer: process.env["CI"] === undefined, url: "http://127.0.0.1:8080", }, // Opt out of parallel tests on CI. - //workers: process.env.CI !== undefined ? 1 : undefined, + //workers: process.env["CI"] !== undefined ? 1 : undefined, }); diff --git a/src/backend/index.ts b/src/backend/index.ts index 8749de66..667bd0c9 100644 --- a/src/backend/index.ts +++ b/src/backend/index.ts @@ -7,7 +7,7 @@ import { move } from "./move"; declare const global: google.script.PublicEndpoints; -global.doGet = doGet; -global.listFolders = listFolders; -global.listSharedDrives = listSharedDrives; -global.move = move; +global["doGet"] = doGet; +global["listFolders"] = listFolders; +global["listSharedDrives"] = listSharedDrives; +global["move"] = move; diff --git a/src/frontend/App.svelte b/src/frontend/App.svelte index 97f2cd62..816d8a9b 100644 --- a/src/frontend/App.svelte +++ b/src/frontend/App.svelte @@ -120,13 +120,9 @@ google.script.run .withSuccessHandler(moveSuccessHandler) .withFailureHandler(moveErrorHandler) - .move( - source.id, - destination.id, - copyComments, - mergeFolders, - forceNonEmpty, - ); + [ + "move" + ](source.id, destination.id, copyComments, mergeFolders, forceNonEmpty); } function showErrorDialogWithEvent( diff --git a/src/frontend/FolderSelection.svelte b/src/frontend/FolderSelection.svelte index 590d732b..07040774 100644 --- a/src/frontend/FolderSelection.svelte +++ b/src/frontend/FolderSelection.svelte @@ -65,12 +65,12 @@ google.script.run .withSuccessHandler(handleSharedDriveResponse) .withFailureHandler(handleError) - .listSharedDrives(); + ["listSharedDrives"](); } else { google.script.run .withSuccessHandler(handleFolderResponse) .withFailureHandler(handleError) - .listFolders(path[path.length - 1].id); + ["listFolders"](path[path.length - 1].id); } } diff --git a/tsconfig.json b/tsconfig.json index 9f99d8a5..90f595e5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,21 @@ { "compilerOptions": { + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, "module": "es6", "moduleResolution": "node", - "verbatimModuleSyntax": true, - "allowSyntheticDefaultImports": true, "resolveJsonModule": true, - "forceConsistentCasingInFileNames": true, + "verbatimModuleSyntax": true, + + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "exactOptionalPropertyTypes": true, "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, "noImplicitReturns": true, + "noPropertyAccessFromIndexSignature": true, "noUnusedLocals": true, "noUnusedParameters": true, - "skipLibCheck": true, "strict": true } }