Skip to content

Commit 4cb32b6

Browse files
authored
test(vue): test app now uses vite and vitest (#26045)
1 parent f74cba4 commit 4cb32b6

29 files changed

+6356
-27899
lines changed

packages/vue/test/apps/vue3/package-lock.json

Lines changed: 6148 additions & 27741 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vue/test/apps/vue3/package.json

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
"private": true,
55
"description": "An Ionic project",
66
"scripts": {
7-
"build": "vue-cli-service build",
8-
"test:unit": "vue-cli-service test:unit",
9-
"test:e2e": "concurrently \"npm run start -- --mode production\" \"wait-on http-get://localhost:8080 && npm run cypress\" --kill-others --success first",
10-
"lint": "vue-cli-service lint",
7+
"dev": "vite",
8+
"build": "vite build",
9+
"serve": "vite preview",
10+
"test:unit": "vitest",
11+
"test:e2e": "concurrently \"npm run build && npm run serve\" \"wait-on http-get://localhost:8080 && npm run cypress\" --kill-others --success first",
12+
"lint": "eslint --ext .js,.vue,.ts --ignore-path .gitignore --fix src",
1113
"cypress": "node_modules/.bin/cypress run --headless --browser chrome",
1214
"cypress.open": "cypress open",
13-
"start": "vue-cli-service serve",
15+
"start": "npm run dev",
1416
"sync": "sh ./scripts/sync.sh"
1517
},
1618
"dependencies": {
@@ -20,26 +22,19 @@
2022
"vue-router": "^4.0.14"
2123
},
2224
"devDependencies": {
23-
"@types/jest": "^27.5.2",
2425
"@typescript-eslint/eslint-plugin": "^5.4.0",
2526
"@typescript-eslint/parser": "^5.4.0",
26-
"@vue/cli-plugin-babel": "~5.0.3",
27-
"@vue/cli-plugin-e2e-cypress": "~5.0.3",
28-
"@vue/cli-plugin-eslint": "~5.0.3",
29-
"@vue/cli-plugin-router": "~5.0.3",
30-
"@vue/cli-plugin-typescript": "~5.0.3",
31-
"@vue/cli-plugin-unit-jest": "~5.0.3",
32-
"@vue/cli-service": "~5.0.3",
27+
"@vitejs/plugin-vue": "^3.1.0",
3328
"@vue/eslint-config-typescript": "^9.1.0",
3429
"@vue/test-utils": "^2.0.0-rc.18",
35-
"@vue/vue3-jest": "^27.0.0-alpha.4",
3630
"concurrently": "^6.0.0",
3731
"cypress": "^10.0.0",
3832
"eslint": "^7.32.0",
3933
"eslint-plugin-vue": "^8.0.3",
40-
"jest": "^27.1.0",
41-
"ts-jest": "^27.0.4",
34+
"jsdom": "^20.0.0",
4235
"typescript": "~4.5.5",
36+
"vite": "^3.1.4",
37+
"vitest": "^0.23.4",
4338
"wait-on": "^5.3.0"
4439
}
4540
}

packages/vue/test/base/babel.config.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/vue/test/base/cypress.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ export default defineConfig({
1515
},
1616
specPattern: 'tests/e2e/specs/**/*.cy.{js,jsx,ts,tsx}',
1717
supportFile: 'tests/e2e/support/index.js',
18+
baseUrl: 'http://localhost:8080'
1819
},
1920
})

packages/vue/test/base/public/index.html renamed to packages/vue/test/base/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
<meta name="format-detection" content="telephone=no" />
1515
<meta name="msapplication-tap-highlight" content="no" />
1616

17-
<link rel="shortcut icon" type="image/png" href="<%= BASE_URL %>assets/icon/favicon.png" />
17+
<link rel="shortcut icon" type="image/png" href="/assets/icon/favicon.png" />
1818

1919
<!-- add to homescreen for ios -->
2020
<meta name="apple-mobile-web-app-capable" content="yes" />
2121
<meta name="apple-mobile-web-app-title" content="Ionic App" />
2222
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
23+
24+
<script type="module" src="/src/main.ts"></script>
2325
</head>
2426

2527
<body>
-930 Bytes
Binary file not shown.
-23.2 KB
Binary file not shown.

packages/vue/test/base/public/assets/shapes.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/vue/test/base/src/router/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ const routes: Array<RouteRecordRaw> = [
140140
]
141141

142142
const router = createRouter({
143-
history: createWebHistory(process.env.BASE_URL),
143+
history: createWebHistory(import.meta.env.BASE_URL),
144144
routes
145145
});
146146

packages/vue/test/base/tests/e2e/specs/hbb.cy.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
describe('Hardware Back Button', () => {
22
it('should correctly go back to Tab 1', () => {
3-
cy.visit('http://localhost:8080/tabs');
3+
cy.visit('/tabs');
4+
cy.ionPageVisible('tab1');
45

56
cy.get('ion-tab-button#tab-button-tab2').click();
67
cy.ionPageHidden('tab1');
@@ -30,7 +31,8 @@ describe('Hardware Back Button', () => {
3031
});
3132

3233
it('should correctly go back to the root tab from child pages', () => {
33-
cy.visit('http://localhost:8080');
34+
cy.visit('/');
35+
cy.ionPageVisible('home');
3436

3537
cy.routerPush('/tabs');
3638
cy.ionPageHidden('home');
@@ -59,7 +61,8 @@ describe('Hardware Back Button', () => {
5961

6062
// TODO FW-1389
6163
it.skip('should correctly go back to the root tab after switching pages', () => {
62-
cy.visit('http://localhost:8080');
64+
cy.visit('/');
65+
cy.ionPageVisible('home');
6366

6467
cy.routerPush('/tabs');
6568
cy.ionPageHidden('home');

0 commit comments

Comments
 (0)