From 2375787b23d45760fba937cd2445612a60a6e8e8 Mon Sep 17 00:00:00 2001 From: Han Yeong-woo Date: Sat, 2 Sep 2023 06:49:03 +0900 Subject: [PATCH] Move test fixtures to parent directory --- .github/workflows/deploy.yml | 8 ++++---- src/utils.test.ts | 8 ++++---- test/empty/package.json | 3 +++ test/fixtures/empty/.gitkeep | 0 test/fixtures/npm/package-lock.json | 0 test/fixtures/pnpm/pnpm-lock.yaml | 0 test/fixtures/yarn/yarn.lock | 0 test/npm/package-lock.json | 10 ++++++++++ test/npm/package.json | 3 +++ test/pnpm/package.json | 3 +++ test/pnpm/pnpm-lock.yaml | 5 +++++ test/yarn/package.json | 3 +++ test/yarn/yarn.lock | 4 ++++ 13 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 test/empty/package.json delete mode 100644 test/fixtures/empty/.gitkeep delete mode 100644 test/fixtures/npm/package-lock.json delete mode 100644 test/fixtures/pnpm/pnpm-lock.yaml delete mode 100644 test/fixtures/yarn/yarn.lock create mode 100644 test/npm/package-lock.json create mode 100644 test/npm/package.json create mode 100644 test/pnpm/package.json create mode 100644 test/pnpm/pnpm-lock.yaml create mode 100644 test/yarn/package.json create mode 100644 test/yarn/yarn.lock diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b1ae2f8..0aa60bf 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -116,7 +116,7 @@ jobs: - name: Support packageManager variable uses: ./ with: - workingDirectory: "./test/fixtures/empty" + workingDirectory: "./test/empty" packageManager: "npm" apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} @@ -125,7 +125,7 @@ jobs: - name: Support npm package manager uses: ./ with: - workingDirectory: "./test/fixtures/npm" + workingDirectory: "./test/npm" apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} command: deploy --dry-run @@ -133,7 +133,7 @@ jobs: - name: Support yarn package manager uses: ./ with: - workingDirectory: "./test/fixtures/yarn" + workingDirectory: "./test/yarn" apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} command: deploy --dry-run @@ -141,7 +141,7 @@ jobs: - name: Support pnpm package manager uses: ./ with: - workingDirectory: "./test/fixtures/pnpm" + workingDirectory: "./test/pnpm" apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} command: deploy --dry-run diff --git a/src/utils.test.ts b/src/utils.test.ts index 812e2c8..e02c84d 100644 --- a/src/utils.test.ts +++ b/src/utils.test.ts @@ -42,19 +42,19 @@ describe("detectPackageManager", () => { }); test("should return npm if package-lock.json exists", () => { - expect(detectPackageManager("test/fixtures/npm")).toBe("npm"); + expect(detectPackageManager("test/npm")).toBe("npm"); }); test("should return yarn if yarn.lock exists", () => { - expect(detectPackageManager("test/fixtures/yarn")).toBe("yarn"); + expect(detectPackageManager("test/yarn")).toBe("yarn"); }); test("should return pnpm if pnpm-lock.yaml exists", () => { - expect(detectPackageManager("test/fixtures/pnpm")).toBe("pnpm"); + expect(detectPackageManager("test/pnpm")).toBe("pnpm"); }); test("should return null if no package manager is detected", () => { - expect(detectPackageManager("test/fixtures/empty")).toBe(null); + expect(detectPackageManager("test/empty")).toBe(null); }); }); diff --git a/test/empty/package.json b/test/empty/package.json new file mode 100644 index 0000000..b913772 --- /dev/null +++ b/test/empty/package.json @@ -0,0 +1,3 @@ +{ + "name": "wrangler-action-detect-package-manager-test" +} diff --git a/test/fixtures/empty/.gitkeep b/test/fixtures/empty/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test/fixtures/npm/package-lock.json b/test/fixtures/npm/package-lock.json deleted file mode 100644 index e69de29..0000000 diff --git a/test/fixtures/pnpm/pnpm-lock.yaml b/test/fixtures/pnpm/pnpm-lock.yaml deleted file mode 100644 index e69de29..0000000 diff --git a/test/fixtures/yarn/yarn.lock b/test/fixtures/yarn/yarn.lock deleted file mode 100644 index e69de29..0000000 diff --git a/test/npm/package-lock.json b/test/npm/package-lock.json new file mode 100644 index 0000000..d7687e4 --- /dev/null +++ b/test/npm/package-lock.json @@ -0,0 +1,10 @@ +{ + "name": "wrangler-action-npm-test", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "wrangler-action-npm-test" + } + } +} diff --git a/test/npm/package.json b/test/npm/package.json new file mode 100644 index 0000000..85a4647 --- /dev/null +++ b/test/npm/package.json @@ -0,0 +1,3 @@ +{ + "name": "wrangler-action-npm-test" +} diff --git a/test/pnpm/package.json b/test/pnpm/package.json new file mode 100644 index 0000000..4c2f915 --- /dev/null +++ b/test/pnpm/package.json @@ -0,0 +1,3 @@ +{ + "name": "wrangler-action-pnpm-test" +} diff --git a/test/pnpm/pnpm-lock.yaml b/test/pnpm/pnpm-lock.yaml new file mode 100644 index 0000000..2b9f188 --- /dev/null +++ b/test/pnpm/pnpm-lock.yaml @@ -0,0 +1,5 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false diff --git a/test/yarn/package.json b/test/yarn/package.json new file mode 100644 index 0000000..f10de0a --- /dev/null +++ b/test/yarn/package.json @@ -0,0 +1,3 @@ +{ + "name": "wrangler-action-yarn-test" +} diff --git a/test/yarn/yarn.lock b/test/yarn/yarn.lock new file mode 100644 index 0000000..fb57ccd --- /dev/null +++ b/test/yarn/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + +