From 7a56be51beca454198689e7b7ac01a27c8722643 Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 15:49:55 +0100 Subject: [PATCH 01/17] Try creating a test environment using npm create vite --- .github/workflows/e2e.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 2416809..241e7f8 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,16 +1,18 @@ name: End-to-end tests on: [push] jobs: - cypress-run: + vite-cli: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Cypress run - uses: cypress-io/github-action@v6 - with: - build: npm run example:build - start: npm run example:preview - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' + - uses: actions/checkout@v4 + - run: npm create vite@latest test-app -- --template vue-ts + - run: mv ./example/App.vue ./test-app/App.vue + - run: mv ./example/vite.config.ts ./test-app/vite.config.ts + - run: mv ./example/assets ./test-app/assets + - run: mv ./example/public ./test-app/public + - run: cd test-app + - run: npm install + - run: npm install vite-svg-loader --save-dev + - run: npm build + - run: npm preview + - uses: cypress-io/github-action@v6 From 61df68c7020d0ade20d870f35556a01152680d8a Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 15:50:54 +0100 Subject: [PATCH 02/17] Fix paths --- .github/workflows/e2e.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 241e7f8..7ec4785 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -6,9 +6,9 @@ jobs: steps: - uses: actions/checkout@v4 - run: npm create vite@latest test-app -- --template vue-ts - - run: mv ./example/App.vue ./test-app/App.vue + - run: mv ./example/src/App.vue ./test-app/src/App.vue - run: mv ./example/vite.config.ts ./test-app/vite.config.ts - - run: mv ./example/assets ./test-app/assets + - run: mv ./example/src/assets ./test-app/src/assets - run: mv ./example/public ./test-app/public - run: cd test-app - run: npm install From 9413fb88fef2e66fe036f88bcc7ba63bf81d49bf Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 15:53:59 +0100 Subject: [PATCH 03/17] Use multiline runs --- .github/workflows/e2e.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 7ec4785..c7b2990 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -6,13 +6,15 @@ jobs: steps: - uses: actions/checkout@v4 - run: npm create vite@latest test-app -- --template vue-ts - - run: mv ./example/src/App.vue ./test-app/src/App.vue - - run: mv ./example/vite.config.ts ./test-app/vite.config.ts - - run: mv ./example/src/assets ./test-app/src/assets - - run: mv ./example/public ./test-app/public - - run: cd test-app - - run: npm install - - run: npm install vite-svg-loader --save-dev - - run: npm build - - run: npm preview + - run: | + mv ./example/src/App.vue ./test-app/src/App.vue + mv ./example/vite.config.ts ./test-app/vite.config.ts + mv ./example/src/assets ./test-app/src/assets + mv ./example/public ./test-app/public + - run: | + cd test-app + npm install + npm install vite-svg-loader --save-dev + npm build + npm preview - uses: cypress-io/github-action@v6 From d49406685c4c529431605161fd386440a45bf571 Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 15:54:54 +0100 Subject: [PATCH 04/17] Fix commands --- .github/workflows/e2e.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c7b2990..0016fbb 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -15,6 +15,6 @@ jobs: cd test-app npm install npm install vite-svg-loader --save-dev - npm build - npm preview + npm run build + npm run preview - uses: cypress-io/github-action@v6 From 3727c79e1e3da9036af7654c54be5e9d9ce7bc83 Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 15:57:22 +0100 Subject: [PATCH 05/17] Copy vite-env.d.ts to test app --- .github/workflows/e2e.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 0016fbb..08181c5 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -9,6 +9,7 @@ jobs: - run: | mv ./example/src/App.vue ./test-app/src/App.vue mv ./example/vite.config.ts ./test-app/vite.config.ts + mv ./example/src/vite-env.d.ts ./test-app/src/vite-env.d.ts mv ./example/src/assets ./test-app/src/assets mv ./example/public ./test-app/public - run: | From e171b213c7a16719366b8fde04407882f23b2e6d Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 16:00:46 +0100 Subject: [PATCH 06/17] Move commands to cypress-io/github-action --- .github/workflows/e2e.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 08181c5..7f2b20b 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -16,6 +16,8 @@ jobs: cd test-app npm install npm install vite-svg-loader --save-dev - npm run build - npm run preview - uses: cypress-io/github-action@v6 + with: + working-directory: test-app + build: npm run example:build + start: npm run example:preview From a1aeabefd2c002bdc8dd17826819f5d7c09e65ac Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 16:02:08 +0100 Subject: [PATCH 07/17] Fix commands --- .github/workflows/e2e.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 7f2b20b..8d45a09 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -19,5 +19,5 @@ jobs: - uses: cypress-io/github-action@v6 with: working-directory: test-app - build: npm run example:build - start: npm run example:preview + build: npm run build + start: npm run preview From f3923f8383f21434e1aff6de00b0c014cbea203b Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 16:12:25 +0100 Subject: [PATCH 08/17] Fix mv commands --- .github/workflows/e2e.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 8d45a09..67d8ee1 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -10,8 +10,10 @@ jobs: mv ./example/src/App.vue ./test-app/src/App.vue mv ./example/vite.config.ts ./test-app/vite.config.ts mv ./example/src/vite-env.d.ts ./test-app/src/vite-env.d.ts - mv ./example/src/assets ./test-app/src/assets - mv ./example/public ./test-app/public + mv ./example/src/assets/test.svg ./test-app/src/assets/test.svg + mv ./example/src/assets/style.svg ./test-app/src/assets/style.svg + mv ./example/src/assets/circle.svg ./test-app/src/assets/circle.svg + mv ./example/public/root.svg ./test-app/public/root.svg - run: | cd test-app npm install From d87101880177b66c0d1b0dabc67e15b30447410e Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 16:15:11 +0100 Subject: [PATCH 09/17] RUn in correct directories --- .github/workflows/e2e.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 67d8ee1..e4e4afd 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -20,6 +20,5 @@ jobs: npm install vite-svg-loader --save-dev - uses: cypress-io/github-action@v6 with: - working-directory: test-app - build: npm run build - start: npm run preview + build: cd test-app && npm run build + start: cd test-app && npm run preview From 45e25d1fd92d022542c879c316cb5504c4d5a973 Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 16:19:37 +0100 Subject: [PATCH 10/17] Fix using correct directories --- .github/workflows/e2e.yml | 4 ++-- package.json | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index e4e4afd..2e5fae9 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -18,7 +18,7 @@ jobs: cd test-app npm install npm install vite-svg-loader --save-dev + npm run build - uses: cypress-io/github-action@v6 with: - build: cd test-app && npm run build - start: cd test-app && npm run preview + start: npm run test:preview diff --git a/package.json b/package.json index 62b4055..53233a3 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,7 @@ "scripts": { "lint": "standard --fix", "cypress": "cypress run", - "example:build": "cd ./example && npm ci && npm run build", - "example:preview": "cd ./example && npm run preview -- --host" + "test:preview": "cd ./test-app && npm run preview -- --host" }, "repository": { "type": "git", From 586c48a830ab11fd37ed6cd1d53c7841c9468f52 Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 16:27:37 +0100 Subject: [PATCH 11/17] Add vue-cli --- .github/workflows/e2e.yml | 50 +++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 2e5fae9..e37ca22 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -4,9 +4,14 @@ jobs: vite-cli: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - run: npm create vite@latest test-app -- --template vue-ts - - run: | + - name: Checkout + uses: actions/checkout@v4 + + - name: Install vue-ts + run: npm create vite@latest test-app -- --template vue-ts + + - name: Add example code + run: | mv ./example/src/App.vue ./test-app/src/App.vue mv ./example/vite.config.ts ./test-app/vite.config.ts mv ./example/src/vite-env.d.ts ./test-app/src/vite-env.d.ts @@ -14,11 +19,46 @@ jobs: mv ./example/src/assets/style.svg ./test-app/src/assets/style.svg mv ./example/src/assets/circle.svg ./test-app/src/assets/circle.svg mv ./example/public/root.svg ./test-app/public/root.svg - - run: | + + - name: Build + run: | cd test-app npm install npm install vite-svg-loader --save-dev npm run build - - uses: cypress-io/github-action@v6 + + - name: Test + uses: cypress-io/github-action@v6 + with: + start: npm run test:preview + + vue-cli: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install vue-ts + run: npm create vue@latest test-app -- --default --ts + + - name: Add example code + run: | + mv ./example/src/App.vue ./test-app/src/App.vue + mv ./example/vite.config.ts ./test-app/vite.config.ts + mv ./example/src/vite-env.d.ts ./test-app/src/vite-env.d.ts + mv ./example/src/assets/test.svg ./test-app/src/assets/test.svg + mv ./example/src/assets/style.svg ./test-app/src/assets/style.svg + mv ./example/src/assets/circle.svg ./test-app/src/assets/circle.svg + mv ./example/public/root.svg ./test-app/public/root.svg + + - name: Build + run: | + cd test-app + npm install + npm install vite-svg-loader --save-dev + npm run build + + - name: Test + uses: cypress-io/github-action@v6 with: start: npm run test:preview From 1a938dec77ec04ed7a6d99d9d61f9272111fc4c6 Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 16:49:22 +0100 Subject: [PATCH 12/17] Allow data- and relative URL --- cypress/integration/spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/spec.js b/cypress/integration/spec.js index 081e52c..8f19590 100644 --- a/cypress/integration/spec.js +++ b/cypress/integration/spec.js @@ -42,7 +42,7 @@ describe('Vite SVG Loader', () => { }) it('supports ?url param', () => { - cy.get('#url').contains(/^data:image\/svg\+xml/) + cy.get('#url').contains(/^data:image\/svg\+xml|^\/assets\/test\..+\.svg/) }) it('supports ?raw param', () => { From c42338d45bf572a0b66e201475312eb4cc10a236 Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 17:00:20 +0100 Subject: [PATCH 13/17] Fix regex --- cypress/integration/spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/spec.js b/cypress/integration/spec.js index 8f19590..c5bb520 100644 --- a/cypress/integration/spec.js +++ b/cypress/integration/spec.js @@ -42,7 +42,7 @@ describe('Vite SVG Loader', () => { }) it('supports ?url param', () => { - cy.get('#url').contains(/^data:image\/svg\+xml|^\/assets\/test\..+\.svg/) + cy.get('#url').contains(/^data:image\/svg\+xml|^\/assets\/test.*\.svg/) }) it('supports ?raw param', () => { From 3eec75dbbbe6af64c2cf57e34e6c1a3feb07df43 Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 17:05:39 +0100 Subject: [PATCH 14/17] Add test for vite 4 --- .github/workflows/e2e.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index e37ca22..3fa782d 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,7 +1,7 @@ name: End-to-end tests on: [push] jobs: - vite-cli: + vite-latest: runs-on: ubuntu-latest steps: - name: Checkout @@ -32,14 +32,14 @@ jobs: with: start: npm run test:preview - vue-cli: + vite-4: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Install vue-ts - run: npm create vue@latest test-app -- --default --ts + run: npm create vite@4 test-app -- --template vue-ts - name: Add example code run: | From 785c53182be40a237949baf7a97e35672513330f Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 17:07:05 +0100 Subject: [PATCH 15/17] Add tests for non-ts versions --- .github/workflows/e2e.yml | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 3fa782d..99e70f2 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -2,6 +2,37 @@ name: End-to-end tests on: [push] jobs: vite-latest: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install vue-ts + run: npm create vite@latest test-app -- --template vue + + - name: Add example code + run: | + mv ./example/src/App.vue ./test-app/src/App.vue + mv ./example/vite.config.ts ./test-app/vite.config.ts + mv ./example/src/vite-env.d.ts ./test-app/src/vite-env.d.ts + mv ./example/src/assets/test.svg ./test-app/src/assets/test.svg + mv ./example/src/assets/style.svg ./test-app/src/assets/style.svg + mv ./example/src/assets/circle.svg ./test-app/src/assets/circle.svg + mv ./example/public/root.svg ./test-app/public/root.svg + + - name: Build + run: | + cd test-app + npm install + npm install vite-svg-loader --save-dev + npm run build + + - name: Test + uses: cypress-io/github-action@v6 + with: + start: npm run test:preview + + vite-latest-ts: runs-on: ubuntu-latest steps: - name: Checkout @@ -33,6 +64,37 @@ jobs: start: npm run test:preview vite-4: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install vue-ts + run: npm create vite@4 test-app -- --template vue + + - name: Add example code + run: | + mv ./example/src/App.vue ./test-app/src/App.vue + mv ./example/vite.config.ts ./test-app/vite.config.ts + mv ./example/src/vite-env.d.ts ./test-app/src/vite-env.d.ts + mv ./example/src/assets/test.svg ./test-app/src/assets/test.svg + mv ./example/src/assets/style.svg ./test-app/src/assets/style.svg + mv ./example/src/assets/circle.svg ./test-app/src/assets/circle.svg + mv ./example/public/root.svg ./test-app/public/root.svg + + - name: Build + run: | + cd test-app + npm install + npm install vite-svg-loader --save-dev + npm run build + + - name: Test + uses: cypress-io/github-action@v6 + with: + start: npm run test:preview + + vite-4-ts: runs-on: ubuntu-latest steps: - name: Checkout From 7ed8bc415b85f2ed69cb011e36ca2aec2eea3e9e Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 17:13:11 +0100 Subject: [PATCH 16/17] Fix non-ts tests --- .github/workflows/e2e.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 99e70f2..019f909 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -13,8 +13,8 @@ jobs: - name: Add example code run: | mv ./example/src/App.vue ./test-app/src/App.vue - mv ./example/vite.config.ts ./test-app/vite.config.ts - mv ./example/src/vite-env.d.ts ./test-app/src/vite-env.d.ts + sed -i 's/ lang="ts"//' ./test-app/src/App.vue + mv ./example/vite.config.ts ./test-app/vite.config.js mv ./example/src/assets/test.svg ./test-app/src/assets/test.svg mv ./example/src/assets/style.svg ./test-app/src/assets/style.svg mv ./example/src/assets/circle.svg ./test-app/src/assets/circle.svg @@ -75,8 +75,8 @@ jobs: - name: Add example code run: | mv ./example/src/App.vue ./test-app/src/App.vue - mv ./example/vite.config.ts ./test-app/vite.config.ts - mv ./example/src/vite-env.d.ts ./test-app/src/vite-env.d.ts + sed -i 's/ lang="ts"//' ./test-app/src/App.vue + mv ./example/vite.config.ts ./test-app/vite.config.js mv ./example/src/assets/test.svg ./test-app/src/assets/test.svg mv ./example/src/assets/style.svg ./test-app/src/assets/style.svg mv ./example/src/assets/circle.svg ./test-app/src/assets/circle.svg From 95712cec22098f7f58b565a1f11e089c0f5ada48 Mon Sep 17 00:00:00 2001 From: Jan-Paul Kleemans Date: Mon, 20 Nov 2023 17:14:55 +0100 Subject: [PATCH 17/17] Fix step names --- .github/workflows/e2e.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 019f909..41fc0d3 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -7,7 +7,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install vue-ts + - name: Install vue run: npm create vite@latest test-app -- --template vue - name: Add example code @@ -69,7 +69,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install vue-ts + - name: Install vue run: npm create vite@4 test-app -- --template vue - name: Add example code