Skip to content

Commit

Permalink
Merge pull request #131 from jpkleemans/multiplatform-test
Browse files Browse the repository at this point in the history
Multiplatform test
  • Loading branch information
jpkleemans authored Nov 20, 2023
2 parents 5159aa9 + 95712ce commit 1ca910f
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 9 deletions.
122 changes: 116 additions & 6 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,126 @@
name: End-to-end tests
on: [push]
jobs:
cypress-run:
vite-latest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cypress run
- name: Install vue
run: npm create vite@latest test-app -- --template vue

- name: Add example code
run: |
mv ./example/src/App.vue ./test-app/src/App.vue
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
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
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
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:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install vue
run: npm create vite@4 test-app -- --template vue

- name: Add example code
run: |
mv ./example/src/App.vue ./test-app/src/App.vue
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
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
uses: actions/checkout@v4

- name: Install vue-ts
run: npm create vite@4 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
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:
build: npm run example:build
start: npm run example:preview
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
start: npm run test:preview
2 changes: 1 addition & 1 deletion cypress/integration/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 1ca910f

Please sign in to comment.