@dengzhibo/create-vue-template 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -7
- package/LICENSE +21 -21
- package/README.md +63 -63
- package/bin/index.js +39 -39
- package/lib/generate.js +100 -90
- package/lib/options.js +48 -48
- package/lib/prompts.js +317 -318
- package/package.json +1 -1
- package/templates/base/README.md +3 -3
- package/templates/features/JSX/package.fragment.json +5 -0
- package/templates/features/{unit-test → Vitest}/package.fragment.json +11 -11
- package/templates/features/{unit-test → Vitest}/src/components/__tests__/HelloWorld.spec.ts +11 -11
- package/templates/features/{unit-test → Vitest}/tsconfig.vitest.json +19 -19
- package/templates/features/{unit-test → Vitest}/vitest.config.ts +14 -14
- package/templates/features/code-quality/.editorconfig +8 -8
- package/templates/features/code-quality/.oxfmtrc.json +5 -5
- package/templates/features/code-quality/.oxlintrc.json +10 -10
- package/templates/features/code-quality/eslint.config.ts +38 -38
- package/templates/features/code-quality/package.fragment.json +21 -21
- package/templates/features/code-quality/settings.fragment.json +7 -7
- package/templates/features/e2e/e2e/tsconfig.json +4 -4
- package/templates/features/e2e/e2e/vue.spec.ts +8 -8
- package/templates/features/e2e/package.fragment.json +8 -8
- package/templates/features/e2e/playwright.config.ts +110 -110
package/package.json
CHANGED
package/templates/base/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# vue-project
|
|
2
2
|
|
|
3
3
|
This template should help get you started developing with Vue 3 in Vite.
|
|
4
4
|
|
|
@@ -53,7 +53,7 @@ pnpm test:unit
|
|
|
53
53
|
|
|
54
54
|
```sh
|
|
55
55
|
# Install browsers for the first run
|
|
56
|
-
|
|
56
|
+
npx playwright install
|
|
57
57
|
|
|
58
58
|
# When testing on CI, must build the project first
|
|
59
59
|
pnpm build
|
|
@@ -63,7 +63,7 @@ pnpm test:e2e
|
|
|
63
63
|
# Runs the tests only on Chromium
|
|
64
64
|
pnpm test:e2e --project=chromium
|
|
65
65
|
# Runs the tests of a specific file
|
|
66
|
-
pnpm test:e2e
|
|
66
|
+
pnpm test:e2e tests/example.spec.ts
|
|
67
67
|
# Runs the tests in debug mode
|
|
68
68
|
pnpm test:e2e --debug
|
|
69
69
|
```
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"scripts": {
|
|
3
|
-
"test:unit": "vitest"
|
|
4
|
-
},
|
|
5
|
-
"devDependencies": {
|
|
6
|
-
"@types/jsdom": "^30.0.0",
|
|
7
|
-
"@vue/test-utils": "^2.5.0",
|
|
8
|
-
"jsdom": "^30.0.1",
|
|
9
|
-
"vitest": "^4.1.11"
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"scripts": {
|
|
3
|
+
"test:unit": "vitest"
|
|
4
|
+
},
|
|
5
|
+
"devDependencies": {
|
|
6
|
+
"@types/jsdom": "^30.0.0",
|
|
7
|
+
"@vue/test-utils": "^2.5.0",
|
|
8
|
+
"jsdom": "^30.0.1",
|
|
9
|
+
"vitest": "^4.1.11"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
2
|
-
|
|
3
|
-
import { mount } from '@vue/test-utils'
|
|
4
|
-
import HelloWorld from '../HelloWorld.vue'
|
|
5
|
-
|
|
6
|
-
describe('HelloWorld', () => {
|
|
7
|
-
it('renders properly', () => {
|
|
8
|
-
const wrapper = mount(HelloWorld, { props: { msg: 'Hello Vitest' } })
|
|
9
|
-
expect(wrapper.text()).toContain('Hello Vitest')
|
|
10
|
-
})
|
|
11
|
-
})
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import { mount } from '@vue/test-utils'
|
|
4
|
+
import HelloWorld from '../HelloWorld.vue'
|
|
5
|
+
|
|
6
|
+
describe('HelloWorld', () => {
|
|
7
|
+
it('renders properly', () => {
|
|
8
|
+
const wrapper = mount(HelloWorld, { props: { msg: 'Hello Vitest' } })
|
|
9
|
+
expect(wrapper.text()).toContain('Hello Vitest')
|
|
10
|
+
})
|
|
11
|
+
})
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.app.json",
|
|
3
|
-
|
|
4
|
-
// Override to include only test files and clear exclusions.
|
|
5
|
-
// Application code imported in tests is automatically included via module resolution.
|
|
6
|
-
"include": ["src/**/__tests__/*", "env.d.ts"],
|
|
7
|
-
"exclude": [],
|
|
8
|
-
|
|
9
|
-
"compilerOptions": {
|
|
10
|
-
// Vitest runs in a different environment than the application code.
|
|
11
|
-
// Adjust lib and types accordingly.
|
|
12
|
-
"lib": [],
|
|
13
|
-
"types": ["node", "jsdom"],
|
|
14
|
-
|
|
15
|
-
// `vue-tsc --build` produces a .tsbuildinfo file for incremental type-checking.
|
|
16
|
-
// Specified here to keep it out of the root directory.
|
|
17
|
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.vitest.tsbuildinfo"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.app.json",
|
|
3
|
+
|
|
4
|
+
// Override to include only test files and clear exclusions.
|
|
5
|
+
// Application code imported in tests is automatically included via module resolution.
|
|
6
|
+
"include": ["src/**/__tests__/*", "env.d.ts"],
|
|
7
|
+
"exclude": [],
|
|
8
|
+
|
|
9
|
+
"compilerOptions": {
|
|
10
|
+
// Vitest runs in a different environment than the application code.
|
|
11
|
+
// Adjust lib and types accordingly.
|
|
12
|
+
"lib": [],
|
|
13
|
+
"types": ["node", "jsdom"],
|
|
14
|
+
|
|
15
|
+
// `vue-tsc --build` produces a .tsbuildinfo file for incremental type-checking.
|
|
16
|
+
// Specified here to keep it out of the root directory.
|
|
17
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.vitest.tsbuildinfo"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { fileURLToPath } from 'node:url'
|
|
2
|
-
import { mergeConfig, defineConfig, configDefaults } from 'vitest/config'
|
|
3
|
-
import viteConfig from './vite.config.ts'
|
|
4
|
-
|
|
5
|
-
export default mergeConfig(
|
|
6
|
-
viteConfig,
|
|
7
|
-
defineConfig({
|
|
8
|
-
test: {
|
|
9
|
-
environment: 'jsdom',
|
|
10
|
-
exclude: [...configDefaults.exclude, 'e2e/**'],
|
|
11
|
-
root: fileURLToPath(new URL('./', import.meta.url)),
|
|
12
|
-
},
|
|
13
|
-
}),
|
|
14
|
-
)
|
|
1
|
+
import { fileURLToPath } from 'node:url'
|
|
2
|
+
import { mergeConfig, defineConfig, configDefaults } from 'vitest/config'
|
|
3
|
+
import viteConfig from './vite.config.ts'
|
|
4
|
+
|
|
5
|
+
export default mergeConfig(
|
|
6
|
+
viteConfig,
|
|
7
|
+
defineConfig({
|
|
8
|
+
test: {
|
|
9
|
+
environment: 'jsdom',
|
|
10
|
+
exclude: [...configDefaults.exclude, 'e2e/**'],
|
|
11
|
+
root: fileURLToPath(new URL('./', import.meta.url)),
|
|
12
|
+
},
|
|
13
|
+
}),
|
|
14
|
+
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}]
|
|
2
|
-
charset = utf-8
|
|
3
|
-
indent_size = 2
|
|
4
|
-
indent_style = space
|
|
5
|
-
insert_final_newline = true
|
|
6
|
-
trim_trailing_whitespace = true
|
|
7
|
-
end_of_line = lf
|
|
8
|
-
max_line_length = 100
|
|
1
|
+
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}]
|
|
2
|
+
charset = utf-8
|
|
3
|
+
indent_size = 2
|
|
4
|
+
indent_style = space
|
|
5
|
+
insert_final_newline = true
|
|
6
|
+
trim_trailing_whitespace = true
|
|
7
|
+
end_of_line = lf
|
|
8
|
+
max_line_length = 100
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
|
3
|
-
"semi": false,
|
|
4
|
-
"singleQuote": true
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
|
3
|
+
"semi": false,
|
|
4
|
+
"singleQuote": true
|
|
5
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
-
"plugins": ["eslint", "typescript", "unicorn", "oxc", "vue", "vitest"],
|
|
4
|
-
"env": {
|
|
5
|
-
"browser": true
|
|
6
|
-
},
|
|
7
|
-
"categories": {
|
|
8
|
-
"correctness": "error"
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": ["eslint", "typescript", "unicorn", "oxc", "vue", "vitest"],
|
|
4
|
+
"env": {
|
|
5
|
+
"browser": true
|
|
6
|
+
},
|
|
7
|
+
"categories": {
|
|
8
|
+
"correctness": "error"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { globalIgnores } from 'eslint/config'
|
|
2
|
-
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
|
|
3
|
-
import pluginVue from 'eslint-plugin-vue'
|
|
4
|
-
import pluginPlaywright from 'eslint-plugin-playwright'
|
|
5
|
-
import pluginVitest from '@vitest/eslint-plugin'
|
|
6
|
-
import pluginOxlint from 'eslint-plugin-oxlint'
|
|
7
|
-
import skipFormatting from 'eslint-config-prettier/flat'
|
|
8
|
-
|
|
9
|
-
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
|
|
10
|
-
// import { configureVueProject } from '@vue/eslint-config-typescript'
|
|
11
|
-
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
|
|
12
|
-
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
|
|
13
|
-
|
|
14
|
-
export default defineConfigWithVueTs(
|
|
15
|
-
{
|
|
16
|
-
name: 'app/files-to-lint',
|
|
17
|
-
files: ['**/*.{vue,ts,mts,tsx}'],
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
|
|
21
|
-
|
|
22
|
-
...pluginVue.configs['flat/essential'],
|
|
23
|
-
vueTsConfigs.recommended,
|
|
24
|
-
|
|
25
|
-
{
|
|
26
|
-
...pluginPlaywright.configs['flat/recommended'],
|
|
27
|
-
files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'],
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
...pluginVitest.configs.recommended,
|
|
32
|
-
files: ['src/**/__tests__/*'],
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
...pluginOxlint.buildFromOxlintConfigFile('.oxlintrc.json'),
|
|
36
|
-
|
|
37
|
-
skipFormatting,
|
|
38
|
-
)
|
|
1
|
+
import { globalIgnores } from 'eslint/config'
|
|
2
|
+
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
|
|
3
|
+
import pluginVue from 'eslint-plugin-vue'
|
|
4
|
+
import pluginPlaywright from 'eslint-plugin-playwright'
|
|
5
|
+
import pluginVitest from '@vitest/eslint-plugin'
|
|
6
|
+
import pluginOxlint from 'eslint-plugin-oxlint'
|
|
7
|
+
import skipFormatting from 'eslint-config-prettier/flat'
|
|
8
|
+
|
|
9
|
+
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
|
|
10
|
+
// import { configureVueProject } from '@vue/eslint-config-typescript'
|
|
11
|
+
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
|
|
12
|
+
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
|
|
13
|
+
|
|
14
|
+
export default defineConfigWithVueTs(
|
|
15
|
+
{
|
|
16
|
+
name: 'app/files-to-lint',
|
|
17
|
+
files: ['**/*.{vue,ts,mts,tsx}'],
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
|
|
21
|
+
|
|
22
|
+
...pluginVue.configs['flat/essential'],
|
|
23
|
+
vueTsConfigs.recommended,
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
...pluginPlaywright.configs['flat/recommended'],
|
|
27
|
+
files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'],
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
{
|
|
31
|
+
...pluginVitest.configs.recommended,
|
|
32
|
+
files: ['src/**/__tests__/*'],
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
...pluginOxlint.buildFromOxlintConfigFile('.oxlintrc.json'),
|
|
36
|
+
|
|
37
|
+
skipFormatting,
|
|
38
|
+
)
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"scripts": {
|
|
3
|
-
"lint": "run-s \"lint:*\"",
|
|
4
|
-
"lint:oxlint": "oxlint . --fix",
|
|
5
|
-
"lint:eslint": "eslint . --fix --cache",
|
|
6
|
-
"format": "oxfmt src/"
|
|
7
|
-
},
|
|
8
|
-
"devDependencies": {
|
|
9
|
-
"@vitest/eslint-plugin": "^1.6.27",
|
|
10
|
-
"@vue/eslint-config-typescript": "^14.9.0",
|
|
11
|
-
"eslint": "^10.10.0",
|
|
12
|
-
"eslint-config-prettier": "^10.1.8",
|
|
13
|
-
"eslint-plugin-oxlint": "~1.82.0",
|
|
14
|
-
"eslint-plugin-playwright": "^2.12.0",
|
|
15
|
-
"eslint-plugin-vue": "~10.11.0",
|
|
16
|
-
"jiti": "^2.7.0",
|
|
17
|
-
"oxfmt": "^0.67.0",
|
|
18
|
-
"oxlint": "~1.82.0",
|
|
19
|
-
"vue-eslint-parser": "^10.4.1"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"scripts": {
|
|
3
|
+
"lint": "run-s \"lint:*\"",
|
|
4
|
+
"lint:oxlint": "oxlint . --fix",
|
|
5
|
+
"lint:eslint": "eslint . --fix --cache",
|
|
6
|
+
"format": "oxfmt src/"
|
|
7
|
+
},
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"@vitest/eslint-plugin": "^1.6.27",
|
|
10
|
+
"@vue/eslint-config-typescript": "^14.9.0",
|
|
11
|
+
"eslint": "^10.10.0",
|
|
12
|
+
"eslint-config-prettier": "^10.1.8",
|
|
13
|
+
"eslint-plugin-oxlint": "~1.82.0",
|
|
14
|
+
"eslint-plugin-playwright": "^2.12.0",
|
|
15
|
+
"eslint-plugin-vue": "~10.11.0",
|
|
16
|
+
"jiti": "^2.7.0",
|
|
17
|
+
"oxfmt": "^0.67.0",
|
|
18
|
+
"oxlint": "~1.82.0",
|
|
19
|
+
"vue-eslint-parser": "^10.4.1"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{
|
|
2
|
-
"editor.codeActionsOnSave": {
|
|
3
|
-
"source.fixAll": "explicit"
|
|
4
|
-
},
|
|
5
|
-
"editor.formatOnSave": true,
|
|
6
|
-
"editor.defaultFormatter": "oxc.oxc-vscode"
|
|
7
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"editor.codeActionsOnSave": {
|
|
3
|
+
"source.fixAll": "explicit"
|
|
4
|
+
},
|
|
5
|
+
"editor.formatOnSave": true,
|
|
6
|
+
"editor.defaultFormatter": "oxc.oxc-vscode"
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@tsconfig/node24/tsconfig.json",
|
|
3
|
-
"include": ["./**/*"]
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "@tsconfig/node24/tsconfig.json",
|
|
3
|
+
"include": ["./**/*"]
|
|
4
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test'
|
|
2
|
-
|
|
3
|
-
// See here how to get started:
|
|
4
|
-
// https://playwright.dev/docs/intro
|
|
5
|
-
test('visits the app root url', async ({ page }) => {
|
|
6
|
-
await page.goto('/')
|
|
7
|
-
await expect(page.locator('h1')).toHaveText('You did it!')
|
|
8
|
-
})
|
|
1
|
+
import { test, expect } from '@playwright/test'
|
|
2
|
+
|
|
3
|
+
// See here how to get started:
|
|
4
|
+
// https://playwright.dev/docs/intro
|
|
5
|
+
test('visits the app root url', async ({ page }) => {
|
|
6
|
+
await page.goto('/')
|
|
7
|
+
await expect(page.locator('h1')).toHaveText('You did it!')
|
|
8
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"scripts": {
|
|
3
|
-
"test:e2e": "playwright test"
|
|
4
|
-
},
|
|
5
|
-
"devDependencies": {
|
|
6
|
-
"@playwright/test": "^1.63.0"
|
|
7
|
-
}
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"scripts": {
|
|
3
|
+
"test:e2e": "playwright test"
|
|
4
|
+
},
|
|
5
|
+
"devDependencies": {
|
|
6
|
+
"@playwright/test": "^1.63.0"
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import process from 'node:process'
|
|
2
|
-
import { defineConfig, devices } from '@playwright/test'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Read environment variables from file.
|
|
6
|
-
* https://github.com/motdotla/dotenv
|
|
7
|
-
*/
|
|
8
|
-
// require('dotenv').config();
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* See https://playwright.dev/docs/test-configuration.
|
|
12
|
-
*/
|
|
13
|
-
export default defineConfig({
|
|
14
|
-
testDir: './e2e',
|
|
15
|
-
/* Maximum time one test can run for. */
|
|
16
|
-
timeout: 30 * 1000,
|
|
17
|
-
expect: {
|
|
18
|
-
/**
|
|
19
|
-
* Maximum time expect() should wait for the condition to be met.
|
|
20
|
-
* For example in `await expect(locator).toHaveText();`
|
|
21
|
-
*/
|
|
22
|
-
timeout: 5000,
|
|
23
|
-
},
|
|
24
|
-
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
25
|
-
forbidOnly: !!process.env.CI,
|
|
26
|
-
/* Retry on CI only */
|
|
27
|
-
retries: process.env.CI ? 2 : 0,
|
|
28
|
-
/* Opt out of parallel tests on CI. */
|
|
29
|
-
workers: process.env.CI ? 1 : undefined,
|
|
30
|
-
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
31
|
-
reporter: 'html',
|
|
32
|
-
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
33
|
-
use: {
|
|
34
|
-
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
|
|
35
|
-
actionTimeout: 0,
|
|
36
|
-
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
37
|
-
baseURL: process.env.CI ? 'http://localhost:4173' : 'http://localhost:5173',
|
|
38
|
-
|
|
39
|
-
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
40
|
-
trace: 'on-first-retry',
|
|
41
|
-
|
|
42
|
-
/* Only on CI systems run the tests headless */
|
|
43
|
-
headless: !!process.env.CI,
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
/* Configure projects for major browsers */
|
|
47
|
-
projects: [
|
|
48
|
-
{
|
|
49
|
-
name: 'chromium',
|
|
50
|
-
use: {
|
|
51
|
-
...devices['Desktop Chrome'],
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'firefox',
|
|
56
|
-
use: {
|
|
57
|
-
...devices['Desktop Firefox'],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: 'webkit',
|
|
62
|
-
use: {
|
|
63
|
-
...devices['Desktop Safari'],
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
/* Test against mobile viewports. */
|
|
68
|
-
// {
|
|
69
|
-
// name: 'Mobile Chrome',
|
|
70
|
-
// use: {
|
|
71
|
-
// ...devices['Pixel 5'],
|
|
72
|
-
// },
|
|
73
|
-
// },
|
|
74
|
-
// {
|
|
75
|
-
// name: 'Mobile Safari',
|
|
76
|
-
// use: {
|
|
77
|
-
// ...devices['iPhone 12'],
|
|
78
|
-
// },
|
|
79
|
-
// },
|
|
80
|
-
|
|
81
|
-
/* Test against branded browsers. */
|
|
82
|
-
// {
|
|
83
|
-
// name: 'Microsoft Edge',
|
|
84
|
-
// use: {
|
|
85
|
-
// channel: 'msedge',
|
|
86
|
-
// },
|
|
87
|
-
// },
|
|
88
|
-
// {
|
|
89
|
-
// name: 'Google Chrome',
|
|
90
|
-
// use: {
|
|
91
|
-
// channel: 'chrome',
|
|
92
|
-
// },
|
|
93
|
-
// },
|
|
94
|
-
],
|
|
95
|
-
|
|
96
|
-
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
|
|
97
|
-
// outputDir: 'test-results/',
|
|
98
|
-
|
|
99
|
-
/* Run your local dev server before starting the tests */
|
|
100
|
-
webServer: {
|
|
101
|
-
/**
|
|
102
|
-
* Use the dev server by default for faster feedback loop.
|
|
103
|
-
* Use the preview server on CI for more realistic testing.
|
|
104
|
-
* Playwright will re-use the local server if there is already a dev-server running.
|
|
105
|
-
*/
|
|
106
|
-
command: process.env.CI ? 'npm run preview' : 'npm run dev',
|
|
107
|
-
port: process.env.CI ? 4173 : 5173,
|
|
108
|
-
reuseExistingServer: !process.env.CI,
|
|
109
|
-
},
|
|
110
|
-
})
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
import { defineConfig, devices } from '@playwright/test'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Read environment variables from file.
|
|
6
|
+
* https://github.com/motdotla/dotenv
|
|
7
|
+
*/
|
|
8
|
+
// require('dotenv').config();
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* See https://playwright.dev/docs/test-configuration.
|
|
12
|
+
*/
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
testDir: './e2e',
|
|
15
|
+
/* Maximum time one test can run for. */
|
|
16
|
+
timeout: 30 * 1000,
|
|
17
|
+
expect: {
|
|
18
|
+
/**
|
|
19
|
+
* Maximum time expect() should wait for the condition to be met.
|
|
20
|
+
* For example in `await expect(locator).toHaveText();`
|
|
21
|
+
*/
|
|
22
|
+
timeout: 5000,
|
|
23
|
+
},
|
|
24
|
+
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
25
|
+
forbidOnly: !!process.env.CI,
|
|
26
|
+
/* Retry on CI only */
|
|
27
|
+
retries: process.env.CI ? 2 : 0,
|
|
28
|
+
/* Opt out of parallel tests on CI. */
|
|
29
|
+
workers: process.env.CI ? 1 : undefined,
|
|
30
|
+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
31
|
+
reporter: 'html',
|
|
32
|
+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
33
|
+
use: {
|
|
34
|
+
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
|
|
35
|
+
actionTimeout: 0,
|
|
36
|
+
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
37
|
+
baseURL: process.env.CI ? 'http://localhost:4173' : 'http://localhost:5173',
|
|
38
|
+
|
|
39
|
+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
40
|
+
trace: 'on-first-retry',
|
|
41
|
+
|
|
42
|
+
/* Only on CI systems run the tests headless */
|
|
43
|
+
headless: !!process.env.CI,
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
/* Configure projects for major browsers */
|
|
47
|
+
projects: [
|
|
48
|
+
{
|
|
49
|
+
name: 'chromium',
|
|
50
|
+
use: {
|
|
51
|
+
...devices['Desktop Chrome'],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'firefox',
|
|
56
|
+
use: {
|
|
57
|
+
...devices['Desktop Firefox'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'webkit',
|
|
62
|
+
use: {
|
|
63
|
+
...devices['Desktop Safari'],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
/* Test against mobile viewports. */
|
|
68
|
+
// {
|
|
69
|
+
// name: 'Mobile Chrome',
|
|
70
|
+
// use: {
|
|
71
|
+
// ...devices['Pixel 5'],
|
|
72
|
+
// },
|
|
73
|
+
// },
|
|
74
|
+
// {
|
|
75
|
+
// name: 'Mobile Safari',
|
|
76
|
+
// use: {
|
|
77
|
+
// ...devices['iPhone 12'],
|
|
78
|
+
// },
|
|
79
|
+
// },
|
|
80
|
+
|
|
81
|
+
/* Test against branded browsers. */
|
|
82
|
+
// {
|
|
83
|
+
// name: 'Microsoft Edge',
|
|
84
|
+
// use: {
|
|
85
|
+
// channel: 'msedge',
|
|
86
|
+
// },
|
|
87
|
+
// },
|
|
88
|
+
// {
|
|
89
|
+
// name: 'Google Chrome',
|
|
90
|
+
// use: {
|
|
91
|
+
// channel: 'chrome',
|
|
92
|
+
// },
|
|
93
|
+
// },
|
|
94
|
+
],
|
|
95
|
+
|
|
96
|
+
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
|
|
97
|
+
// outputDir: 'test-results/',
|
|
98
|
+
|
|
99
|
+
/* Run your local dev server before starting the tests */
|
|
100
|
+
webServer: {
|
|
101
|
+
/**
|
|
102
|
+
* Use the dev server by default for faster feedback loop.
|
|
103
|
+
* Use the preview server on CI for more realistic testing.
|
|
104
|
+
* Playwright will re-use the local server if there is already a dev-server running.
|
|
105
|
+
*/
|
|
106
|
+
command: process.env.CI ? 'npm run preview' : 'npm run dev',
|
|
107
|
+
port: process.env.CI ? 4173 : 5173,
|
|
108
|
+
reuseExistingServer: !process.env.CI,
|
|
109
|
+
},
|
|
110
|
+
})
|