mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore(ct): type checking (#17931)
This commit is contained in:
parent
7ab4c17519
commit
689c3eb5fe
@ -5,7 +5,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview",
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||||
"allowJs": false,
|
"allowJs": false,
|
||||||
"skipLibCheck": false,
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": false,
|
"esModuleInterop": false,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject",
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { test, expect } from '@playwright/experimental-ct-react'
|
import { test, expect } from '@playwright/experimental-ct-react';
|
||||||
import { serverFixtures } from '../../../../tests/config/serverFixtures';
|
const { serverFixtures } = require('../../../../tests/config/serverFixtures');
|
||||||
import Fetch from './components/Fetch';
|
import Fetch from './components/Fetch';
|
||||||
import DelayedData from './components/DelayedData';
|
import DelayedData from './components/DelayedData';
|
||||||
import Button from './components/Button';
|
import Button from './components/Button';
|
||||||
@ -137,7 +137,7 @@ test('get textContent of the empty fragment', async ({ mount }) => {
|
|||||||
|
|
||||||
const testWithServer = test.extend(serverFixtures);
|
const testWithServer = test.extend(serverFixtures);
|
||||||
testWithServer('components routing should go through context', async ({ mount, context, server }) => {
|
testWithServer('components routing should go through context', async ({ mount, context, server }) => {
|
||||||
server.setRoute('/hello', (req, res) => {
|
server.setRoute('/hello', (req: any, res: any) => {
|
||||||
res.write('served via server');
|
res.write('served via server');
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
@ -152,7 +152,7 @@ testWithServer('components routing should go through context', async ({ mount, c
|
|||||||
});
|
});
|
||||||
|
|
||||||
const whoServedTheRequest = Promise.race([
|
const whoServedTheRequest = Promise.race([
|
||||||
server.waitForRequest('/hello').then((req) => `served via server: ${req.method} ${req.url}`),
|
server.waitForRequest('/hello').then((req: any) => `served via server: ${req.method} ${req.url}`),
|
||||||
routedViaContext.then(req => `served via context: ${req}`),
|
routedViaContext.then(req => `served via context: ${req}`),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
"start": "vite",
|
"start": "vite",
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"serve": "vite preview"
|
"serve": "vite preview",
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"jsxImportSource": "solid-js",
|
"jsxImportSource": "solid-js",
|
||||||
"types": ["vite/client"],
|
"types": ["vite/client"],
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"isolatedModules": true
|
"isolatedModules": true,
|
||||||
|
"skipLibCheck": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"check": "svelte-check --tsconfig ./tsconfig.json"
|
"typecheck": "svelte-check --tsconfig ./tsconfig.json"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/vite-plugin-svelte": "^1.0.1",
|
"@sveltejs/vite-plugin-svelte": "^1.0.1",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { update, remountCount } from '../store'
|
import { update, remountCount } from '../store'
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
export let count;
|
export let count: number;
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
update();
|
update();
|
||||||
</script>
|
</script>
|
||||||
|
@ -2,7 +2,7 @@ import App from './App.svelte';
|
|||||||
import './assets/index.css';
|
import './assets/index.css';
|
||||||
|
|
||||||
const app = new App({
|
const app = new App({
|
||||||
target: document.getElementById('app')
|
target: document.getElementById('app')!
|
||||||
});
|
});
|
||||||
|
|
||||||
export default app;
|
export default app;
|
||||||
|
4
tests/components/ct-svelte-vite/src/svelte.d.ts
vendored
Normal file
4
tests/components/ct-svelte-vite/src/svelte.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
declare module '*.svelte' {
|
||||||
|
const value: any; // Add better type definitions here if desired.
|
||||||
|
export default value;
|
||||||
|
}
|
@ -64,13 +64,13 @@ test('renderer updates event listeners without remounting', async ({ mount }) =>
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
const component = await mount(Button, {
|
const component = await mount(Button, {
|
||||||
props: {
|
props: {
|
||||||
title: 'Submit'
|
title: 'Submit'
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
submit: data => messages.push(data)
|
submit: (data: string) => messages.push(data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await component.click()
|
await component.click()
|
||||||
@ -100,7 +100,7 @@ test('render a component with a named slot', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('run hooks', async ({ page, mount }) => {
|
test('run hooks', async ({ page, mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
page.on('console', m => messages.push(m.text()))
|
page.on('console', m => messages.push(m.text()))
|
||||||
await mount(Button, {
|
await mount(Button, {
|
||||||
props: {
|
props: {
|
||||||
|
@ -13,8 +13,10 @@
|
|||||||
* of JS in `.svelte` files.
|
* of JS in `.svelte` files.
|
||||||
*/
|
*/
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"checkJs": true
|
"checkJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strict": true
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
|
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte", "src/**/*.spec.*/*"],
|
||||||
"references": [{ "path": "./tsconfig.node.json" }]
|
"references": [{ "path": "./tsconfig.node.json" }]
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rollup -c",
|
"build": "rollup -c",
|
||||||
"dev": "rollup -c -w",
|
"dev": "rollup -c -w",
|
||||||
"start": "sirv public --no-clear"
|
"start": "sirv public --no-clear",
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-commonjs": "^17.0.0",
|
"@rollup/plugin-commonjs": "^17.0.0",
|
||||||
@ -15,13 +16,13 @@
|
|||||||
"rollup-plugin-livereload": "^2.0.0",
|
"rollup-plugin-livereload": "^2.0.0",
|
||||||
"rollup-plugin-svelte": "^7.0.0",
|
"rollup-plugin-svelte": "^7.0.0",
|
||||||
"rollup-plugin-terser": "^7.0.0",
|
"rollup-plugin-terser": "^7.0.0",
|
||||||
"svelte": "^3.0.0"
|
"sirv-cli": "^2.0.0"
|
||||||
},
|
},
|
||||||
"@standaloneDevDependencies": {
|
"@standaloneDevDependencies": {
|
||||||
"@playwright/experimental-ct-svelte": "^1.22.2",
|
"@playwright/experimental-ct-svelte": "^1.22.2",
|
||||||
"@playwright/test": "^1.22.2"
|
"@playwright/test": "^1.22.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"sirv-cli": "^2.0.0"
|
"svelte": "^3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<script lang="ts">
|
<script>
|
||||||
import { update, remountCount } from '../store'
|
import { update, remountCount } from '../store'
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
export let count;
|
export let count;
|
||||||
|
@ -65,13 +65,13 @@ test('renderer updates event listeners without remounting', async ({ mount }) =>
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
const component = await mount(Button, {
|
const component = await mount(Button, {
|
||||||
props: {
|
props: {
|
||||||
title: 'Submit'
|
title: 'Submit'
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
submit: data => messages.push(data)
|
submit: (data: string) => messages.push(data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await component.click()
|
await component.click()
|
||||||
@ -106,7 +106,7 @@ test('render a component without options', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('run hooks', async ({ page, mount }) => {
|
test('run hooks', async ({ page, mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
page.on('console', m => messages.push(m.text()))
|
page.on('console', m => messages.push(m.text()))
|
||||||
await mount(Button, {
|
await mount(Button, {
|
||||||
props: {
|
props: {
|
||||||
|
11
tests/components/ct-svelte/tsconfig.json
Normal file
11
tests/components/ct-svelte/tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "ESNext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"moduleResolution": "node"
|
||||||
|
}
|
||||||
|
}
|
1
tests/components/ct-vue-cli/.gitignore
vendored
1
tests/components/ct-vue-cli/.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
/dist
|
/dist
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
# local env files
|
# local env files
|
||||||
.env.local
|
.env.local
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es5",
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"module": "esnext",
|
|
||||||
"baseUrl": "./",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"paths": {
|
|
||||||
"@/*": [
|
|
||||||
"src/*"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"lib": [
|
|
||||||
"esnext",
|
|
||||||
"dom",
|
|
||||||
"dom.iterable",
|
|
||||||
"scripthost"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,7 +5,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
"build": "vue-cli-service build",
|
"build": "vue-cli-service build",
|
||||||
"lint": "vue-cli-service lint"
|
"lint": "vue-cli-service lint",
|
||||||
|
"typecheck": "tsc --noEmit --project tsconfig.test.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"core-js": "^3.8.3",
|
"core-js": "^3.8.3",
|
||||||
@ -17,6 +18,7 @@
|
|||||||
"@vue/cli-plugin-babel": "~5.0.0",
|
"@vue/cli-plugin-babel": "~5.0.0",
|
||||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
"@vue/cli-plugin-eslint": "~5.0.0",
|
||||||
"@vue/cli-service": "~5.0.0",
|
"@vue/cli-service": "~5.0.0",
|
||||||
|
"@vue/tsconfig": "^0.1.3",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-plugin-vue": "^8.0.3"
|
"eslint-plugin-vue": "^8.0.3"
|
||||||
},
|
},
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script lang="ts" setup>
|
||||||
defineProps({
|
defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
let remountCount = 0
|
let remountCount = 0
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup>
|
<script lang="ts" setup>
|
||||||
defineProps({
|
defineProps({
|
||||||
count: {
|
count: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -27,10 +27,13 @@ test('renderer and keep the component instance intact', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
const component = await mount(<Button title='Submit' v-on:submit={data => {
|
const component = await mount(<Button
|
||||||
messages.push(data)
|
title="Submit"
|
||||||
}}></Button>)
|
v-on:submit={(data: string) => {
|
||||||
|
messages.push(data)
|
||||||
|
}}
|
||||||
|
/>)
|
||||||
await component.click()
|
await component.click()
|
||||||
expect(messages).toEqual(['hello'])
|
expect(messages).toEqual(['hello'])
|
||||||
})
|
})
|
||||||
@ -78,7 +81,7 @@ test('emit a event when a slot is clicked', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('run hooks', async ({ page, mount }) => {
|
test('run hooks', async ({ page, mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
page.on('console', m => messages.push(m.text()))
|
page.on('console', m => messages.push(m.text()))
|
||||||
await mount(<Button title="Submit" />, {
|
await mount(<Button title="Submit" />, {
|
||||||
hooksConfig: { route: 'A' }
|
hooksConfig: { route: 'A' }
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { test, expect } from '@playwright/experimental-ct-vue'
|
import { test, expect } from '@playwright/experimental-ct-vue'
|
||||||
|
|
||||||
import Button from './components/Button.vue'
|
import Button from './components/Button.vue'
|
||||||
import Counter from './components/Counter.vue'
|
import Counter from './components/Counter.vue'
|
||||||
import DefaultSlot from './components/DefaultSlot.vue'
|
import DefaultSlot from './components/DefaultSlot.vue'
|
||||||
@ -37,13 +36,13 @@ test('renderer and keep the component instance intact', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
const component = await mount(Button, {
|
const component = await mount(Button, {
|
||||||
props: {
|
props: {
|
||||||
title: 'Submit'
|
title: 'Submit'
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
submit: data => messages.push(data)
|
submit: (data: string) => messages.push(data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await component.click()
|
await component.click()
|
||||||
@ -88,7 +87,7 @@ test('render a component without options', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('run hooks', async ({ page, mount }) => {
|
test('run hooks', async ({ page, mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
page.on('console', m => messages.push(m.text()))
|
page.on('console', m => messages.push(m.text()))
|
||||||
await mount(Button, {
|
await mount(Button, {
|
||||||
props: {
|
props: {
|
||||||
|
12
tests/components/ct-vue-cli/tsconfig.app.json
Normal file
12
tests/components/ct-vue-cli/tsconfig.app.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig/tsconfig.web.json",
|
||||||
|
"include": ["src/**/*", "src/**/*.vue"],
|
||||||
|
"exclude": ["src/**/*.spec.*/*"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
tests/components/ct-vue-cli/tsconfig.config.json
Normal file
8
tests/components/ct-vue-cli/tsconfig.config.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig/tsconfig.node.json",
|
||||||
|
"include": ["playwright.config.*"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"types": ["node"]
|
||||||
|
}
|
||||||
|
}
|
14
tests/components/ct-vue-cli/tsconfig.json
Normal file
14
tests/components/ct-vue-cli/tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.config.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.app.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.test.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
10
tests/components/ct-vue-cli/tsconfig.test.json
Normal file
10
tests/components/ct-vue-cli/tsconfig.test.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.app.json",
|
||||||
|
"exclude": [],
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"lib": [],
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"types": ["node"]
|
||||||
|
}
|
||||||
|
}
|
4
tests/components/ct-vue-cli/vue.d.ts
vendored
Normal file
4
tests/components/ct-vue-cli/vue.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
declare module '*.vue' {
|
||||||
|
const value: any;
|
||||||
|
export default value;
|
||||||
|
}
|
1
tests/components/ct-vue-vite/.gitignore
vendored
1
tests/components/ct-vue-vite/.gitignore
vendored
@ -6,6 +6,7 @@ yarn-debug.log*
|
|||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
pnpm-debug.log*
|
pnpm-debug.log*
|
||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
1
tests/components/ct-vue-vite/env.d.ts
vendored
Normal file
1
tests/components/ct-vue-vite/env.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
@ -4,14 +4,17 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview --port 5050"
|
"preview": "vite preview --port 5050",
|
||||||
|
"typecheck": "vue-tsc --noEmit --project tsconfig.test.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vue": "^3.2.31"
|
"vue": "^3.2.31"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^2.2.2",
|
"@vitejs/plugin-vue": "^2.2.2",
|
||||||
"vite": "^2.8.4"
|
"@vue/tsconfig": "^0.1.3",
|
||||||
|
"vite": "^2.8.4",
|
||||||
|
"vue-tsc": "^1.0.0"
|
||||||
},
|
},
|
||||||
"@standaloneDevDependencies": {
|
"@standaloneDevDependencies": {
|
||||||
"@playwright/experimental-ct-vue": "^1.22.2",
|
"@playwright/experimental-ct-vue": "^1.22.2",
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
<script setup>
|
<script lang="ts" setup>
|
||||||
defineProps({
|
defineProps<{ title: string }>()
|
||||||
title: {
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -7,17 +7,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
let remountCount = 0
|
let remountCount = 0
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup>
|
<script lang="ts" setup>
|
||||||
defineProps({
|
defineProps<{ count?: number }>()
|
||||||
count: {
|
|
||||||
type: Number,
|
|
||||||
required: false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
remountCount++
|
remountCount++
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
<header>
|
<header>
|
||||||
<slot name="header" />
|
<slot name="header" />
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<slot name="main" />
|
<slot name="main" />
|
||||||
</main>
|
</main>
|
||||||
|
@ -27,8 +27,9 @@ test('renderer updates props without remounting', async ({ mount }) => {
|
|||||||
test('renderer updates event listeners without remounting', async ({ mount }) => {
|
test('renderer updates event listeners without remounting', async ({ mount }) => {
|
||||||
const component = await mount(<Counter />)
|
const component = await mount(<Counter />)
|
||||||
|
|
||||||
const messages = []
|
|
||||||
await component.update(<Counter v-on:submit={count => {
|
const messages: string[] = []
|
||||||
|
await component.update(<Counter v-on:submit={(count: string) => {
|
||||||
messages.push(count)
|
messages.push(count)
|
||||||
}} />)
|
}} />)
|
||||||
await component.click();
|
await component.click();
|
||||||
@ -51,10 +52,13 @@ test('renderer updates slots without remounting', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
const component = await mount(<Button title='Submit' v-on:submit={data => {
|
const component = await mount(<Button
|
||||||
messages.push(data)
|
title="Submit"
|
||||||
}}></Button>)
|
v-on:submit={(data: string) => {
|
||||||
|
messages.push(data)
|
||||||
|
}}
|
||||||
|
/>)
|
||||||
await component.click()
|
await component.click()
|
||||||
expect(messages).toEqual(['hello'])
|
expect(messages).toEqual(['hello'])
|
||||||
})
|
})
|
||||||
@ -102,7 +106,7 @@ test('emit a event when a slot is clicked', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('run hooks', async ({ page, mount }) => {
|
test('run hooks', async ({ page, mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
page.on('console', m => messages.push(m.text()))
|
page.on('console', m => messages.push(m.text()))
|
||||||
await mount(<Button title="Submit" />, {
|
await mount(<Button title="Submit" />, {
|
||||||
hooksConfig: { route: 'A' }
|
hooksConfig: { route: 'A' }
|
||||||
@ -112,12 +116,9 @@ test('run hooks', async ({ page, mount }) => {
|
|||||||
|
|
||||||
test('unmount a multi root component', async ({ mount, page }) => {
|
test('unmount a multi root component', async ({ mount, page }) => {
|
||||||
const component = await mount(<MultiRoot />)
|
const component = await mount(<MultiRoot />)
|
||||||
|
|
||||||
await expect(page.locator('#root')).toContainText('root 1')
|
await expect(page.locator('#root')).toContainText('root 1')
|
||||||
await expect(page.locator('#root')).toContainText('root 2')
|
await expect(page.locator('#root')).toContainText('root 2')
|
||||||
|
|
||||||
await component.unmount()
|
await component.unmount()
|
||||||
|
|
||||||
await expect(page.locator('#root')).not.toContainText('root 1')
|
await expect(page.locator('#root')).not.toContainText('root 1')
|
||||||
await expect(page.locator('#root')).not.toContainText('root 2')
|
await expect(page.locator('#root')).not.toContainText('root 2')
|
||||||
})
|
})
|
||||||
|
@ -40,7 +40,7 @@ test('renderer updates event listeners without remounting', async ({ mount }) =>
|
|||||||
const messages = []
|
const messages = []
|
||||||
await component.update({
|
await component.update({
|
||||||
on: {
|
on: {
|
||||||
submit: count => messages.push(count)
|
submit: (count) => messages.push(count)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await component.click();
|
await component.click();
|
||||||
@ -71,7 +71,7 @@ test('emit an submit event when the button is clicked', async ({ mount }) => {
|
|||||||
title: 'Submit'
|
title: 'Submit'
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
submit: data => messages.push(data)
|
submit: (data) => messages.push(data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await component.click()
|
await component.click()
|
||||||
|
@ -37,10 +37,10 @@ test('renderer updates props without remounting', async ({ mount }) => {
|
|||||||
test('renderer updates event listeners without remounting', async ({ mount }) => {
|
test('renderer updates event listeners without remounting', async ({ mount }) => {
|
||||||
const component = await mount(Counter)
|
const component = await mount(Counter)
|
||||||
|
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
await component.update({
|
await component.update({
|
||||||
on: {
|
on: {
|
||||||
submit: data => messages.push(data)
|
submit: (data: string) => messages.push(data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await component.click();
|
await component.click();
|
||||||
@ -65,13 +65,13 @@ test('renderer updates slots without remounting', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
const component = await mount(Button, {
|
const component = await mount(Button, {
|
||||||
props: {
|
props: {
|
||||||
title: 'Submit'
|
title: 'Submit'
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
submit: data => messages.push(data)
|
submit: (data: string) => messages.push(data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await component.click()
|
await component.click()
|
||||||
@ -116,7 +116,7 @@ test('render a component without options', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('run hooks', async ({ page, mount }) => {
|
test('run hooks', async ({ page, mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
page.on('console', m => messages.push(m.text()))
|
page.on('console', m => messages.push(m.text()))
|
||||||
await mount(Button, {
|
await mount(Button, {
|
||||||
props: {
|
props: {
|
||||||
@ -140,12 +140,9 @@ test('unmount', async ({ page, mount }) => {
|
|||||||
|
|
||||||
test('unmount a multi root component', async ({ mount, page }) => {
|
test('unmount a multi root component', async ({ mount, page }) => {
|
||||||
const component = await mount(MultiRoot)
|
const component = await mount(MultiRoot)
|
||||||
|
|
||||||
await expect(page.locator('#root')).toContainText('root 1')
|
await expect(page.locator('#root')).toContainText('root 1')
|
||||||
await expect(page.locator('#root')).toContainText('root 2')
|
await expect(page.locator('#root')).toContainText('root 2')
|
||||||
|
|
||||||
await component.unmount()
|
await component.unmount()
|
||||||
|
|
||||||
await expect(page.locator('#root')).not.toContainText('root 1')
|
await expect(page.locator('#root')).not.toContainText('root 1')
|
||||||
await expect(page.locator('#root')).not.toContainText('root 2')
|
await expect(page.locator('#root')).not.toContainText('root 2')
|
||||||
})
|
})
|
||||||
|
12
tests/components/ct-vue-vite/tsconfig.app.json
Normal file
12
tests/components/ct-vue-vite/tsconfig.app.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig/tsconfig.web.json",
|
||||||
|
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
|
||||||
|
"exclude": ["src/**/*.spec.*/*"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
tests/components/ct-vue-vite/tsconfig.config.json
Normal file
8
tests/components/ct-vue-vite/tsconfig.config.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig/tsconfig.node.json",
|
||||||
|
"include": ["vite.config.*", "playwright.config.*"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"types": ["node"]
|
||||||
|
}
|
||||||
|
}
|
14
tests/components/ct-vue-vite/tsconfig.json
Normal file
14
tests/components/ct-vue-vite/tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.config.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.app.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.test.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
9
tests/components/ct-vue-vite/tsconfig.test.json
Normal file
9
tests/components/ct-vue-vite/tsconfig.test.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.app.json",
|
||||||
|
"exclude": [],
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"lib": [],
|
||||||
|
"types": ["node"]
|
||||||
|
}
|
||||||
|
}
|
1
tests/components/ct-vue-vite/vue.d.ts
vendored
1
tests/components/ct-vue-vite/vue.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
declare module '*.vue';
|
|
2
tests/components/ct-vue2-cli/.gitignore
vendored
2
tests/components/ct-vue2-cli/.gitignore
vendored
@ -1,7 +1,7 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
/dist
|
/dist
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
# local env files
|
# local env files
|
||||||
.env.local
|
.env.local
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
"build": "vue-cli-service build",
|
"build": "vue-cli-service build",
|
||||||
"lint": "vue-cli-service lint"
|
"lint": "vue-cli-service lint",
|
||||||
|
"typecheck": "tsc --noEmit --project tsconfig.test.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"core-js": "^3.8.3",
|
"core-js": "^3.8.3",
|
||||||
@ -17,6 +18,7 @@
|
|||||||
"@vue/cli-plugin-babel": "~5.0.0",
|
"@vue/cli-plugin-babel": "~5.0.0",
|
||||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
"@vue/cli-plugin-eslint": "~5.0.0",
|
||||||
"@vue/cli-service": "~5.0.0",
|
"@vue/cli-service": "~5.0.0",
|
||||||
|
"@vue/tsconfig": "^0.1.3",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-plugin-vue": "^8.0.3",
|
"eslint-plugin-vue": "^8.0.3",
|
||||||
"vue-template-compiler": "^2.6.14"
|
"vue-template-compiler": "^2.6.14"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<button @click="$emit('submit', 'hello')">{{ title }}</button>
|
<button @click="$emit('submit', 'hello')">{{ title }}</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: 'ButtonButton',
|
name: 'ButtonButton',
|
||||||
props: ['title']
|
props: ['title']
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
let remountCount = 0;
|
let remountCount = 0;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: 'HelloWorld',
|
name: 'HelloWorld',
|
||||||
props: {
|
props: {
|
||||||
|
@ -24,12 +24,14 @@ test('renderer updates props without remounting', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('renderer updates event listeners without remounting', async ({ mount }) => {
|
test('renderer updates event listeners without remounting', async ({ mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
const component = await mount(<Counter />)
|
const component = await mount(<Counter />)
|
||||||
|
|
||||||
await component.update(<Counter v-on:submit={count => {
|
await component.update(<Counter
|
||||||
messages.push(count)
|
v-on:submit={(count: string) => {
|
||||||
}} />)
|
messages.push(count)
|
||||||
|
}}
|
||||||
|
/>)
|
||||||
await component.click();
|
await component.click();
|
||||||
expect(messages).toEqual(['hello'])
|
expect(messages).toEqual(['hello'])
|
||||||
|
|
||||||
@ -50,10 +52,13 @@ test('renderer updates slots without remounting', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
const component = await mount(<Button title='Submit' v-on:submit={data => {
|
const component = await mount(<Button
|
||||||
messages.push(data)
|
title="Submit"
|
||||||
}}></Button>)
|
v-on:submit={(data: string) => {
|
||||||
|
messages.push(data)
|
||||||
|
}}
|
||||||
|
/>)
|
||||||
await component.click()
|
await component.click()
|
||||||
expect(messages).toEqual(['hello'])
|
expect(messages).toEqual(['hello'])
|
||||||
})
|
})
|
||||||
@ -101,7 +106,7 @@ test('emit a event when a slot is clicked', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('run hooks', async ({ page, mount }) => {
|
test('run hooks', async ({ page, mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
page.on('console', m => messages.push(m.text()))
|
page.on('console', m => messages.push(m.text()))
|
||||||
await mount(<Button title="Submit" />, {
|
await mount(<Button title="Submit" />, {
|
||||||
hooksConfig: { route: 'A' }
|
hooksConfig: { route: 'A' }
|
||||||
|
@ -35,10 +35,10 @@ test('renderer updates props without remounting', async ({ mount }) => {
|
|||||||
test('renderer updates event listeners without remounting', async ({ mount }) => {
|
test('renderer updates event listeners without remounting', async ({ mount }) => {
|
||||||
const component = await mount(Counter)
|
const component = await mount(Counter)
|
||||||
|
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
await component.update({
|
await component.update({
|
||||||
on: {
|
on: {
|
||||||
submit: data => messages.push(data)
|
submit: (data: string) => messages.push(data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await component.click();
|
await component.click();
|
||||||
@ -69,13 +69,13 @@ test('renderer updates slots without remounting', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
const component = await mount(Button, {
|
const component = await mount(Button, {
|
||||||
props: {
|
props: {
|
||||||
title: 'Submit'
|
title: 'Submit'
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
submit: data => messages.push(data)
|
submit: (data: string) => messages.push(data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await component.click()
|
await component.click()
|
||||||
@ -120,7 +120,7 @@ test('render a component without options', async ({ mount }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('run hooks', async ({ page, mount }) => {
|
test('run hooks', async ({ page, mount }) => {
|
||||||
const messages = []
|
const messages: string[] = []
|
||||||
page.on('console', m => messages.push(m.text()))
|
page.on('console', m => messages.push(m.text()))
|
||||||
await mount(Button, {
|
await mount(Button, {
|
||||||
props: {
|
props: {
|
||||||
|
4
tests/components/ct-vue2-cli/src/shims-vue.d.ts
vendored
Normal file
4
tests/components/ct-vue2-cli/src/shims-vue.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
declare module '*.vue' {
|
||||||
|
import Vue from 'vue';
|
||||||
|
export default Vue;
|
||||||
|
}
|
1
tests/components/ct-vue2-cli/src/vue.d.ts
vendored
1
tests/components/ct-vue2-cli/src/vue.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
declare module '*.vue';
|
|
12
tests/components/ct-vue2-cli/tsconfig.app.json
Normal file
12
tests/components/ct-vue2-cli/tsconfig.app.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig/tsconfig.web.json",
|
||||||
|
"include": ["src/**/*", "src/**/*.vue"],
|
||||||
|
"exclude": ["src/**/*.spec.*/*"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
tests/components/ct-vue2-cli/tsconfig.config.json
Normal file
8
tests/components/ct-vue2-cli/tsconfig.config.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig/tsconfig.node.json",
|
||||||
|
"include": ["playwright.config.*"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"types": ["node"]
|
||||||
|
}
|
||||||
|
}
|
14
tests/components/ct-vue2-cli/tsconfig.json
Normal file
14
tests/components/ct-vue2-cli/tsconfig.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.config.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.app.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.test.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
9
tests/components/ct-vue2-cli/tsconfig.test.json
Normal file
9
tests/components/ct-vue2-cli/tsconfig.test.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.app.json",
|
||||||
|
"exclude": [],
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"lib": [],
|
||||||
|
"types": ["node"]
|
||||||
|
}
|
||||||
|
}
|
@ -14,11 +14,15 @@ for (const dir of fs.readdirSync(__dirname)) {
|
|||||||
await run('npm', ['i'], folder);
|
await run('npm', ['i'], folder);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('typecheck', async () => {
|
||||||
|
await run('npm', ['run', 'typecheck'], folder);
|
||||||
|
});
|
||||||
|
|
||||||
for (const project of ['chromium', 'firefox', 'webkit']) {
|
for (const project of ['chromium', 'firefox', 'webkit']) {
|
||||||
test(project, async () => {
|
test(project, async () => {
|
||||||
await run('npx', ['playwright', 'test', '--project=' + project, '--reporter=list'], folder);
|
await run('npx', ['playwright', 'test', '--project=' + project, '--reporter=list'], folder);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user