Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
// manually bumping
"node",

"generouted", // testing lib shipping JSX (new version ship transpiled JS)

// breaking changes
"source-map", // `source-map:v0.7.0+` needs more investigation
"kill-port", // `kill-port:^2.0.0 has perf issues (#8392)
Expand Down
10 changes: 0 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,5 @@
"playground/**/__tests__/**/*.ts": [
"eslint --cache --fix"
]
},
"pnpm": {
"packageExtensions": {
"generouted": {
"peerDependencies": {
"react": "*",
"react-router-dom": "*"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import { expect, test } from '@playwright/test'
import { type Page, expect, test } from '@playwright/test'
import { setupBuildAndPreview, setupDevServer } from '../../utils.ts'

test('TS lib build', async ({ page }) => {
const { testUrl, server } = await setupBuildAndPreview('ts-lib')
await page.goto(testUrl)
await expect(page.locator('main')).toHaveText('Home page')

await page.locator('a', { hasText: 'About' }).click()
await expect(page.locator('main')).toHaveText('About page')

await testNonJs(page)
await server.httpServer.close()
})

test('TS lib dev', async ({ page }) => {
const { testUrl, server } = await setupDevServer('ts-lib')
await page.goto(testUrl)
await expect(page.locator('main')).toHaveText('Home page')

await page.locator('a', { hasText: 'About' }).click()
await expect(page.locator('main')).toHaveText('About page')

await testNonJs(page)
await server.close()
})

async function testNonJs(page: Page) {
await expect(page.getByTestId('test-non-js')).toHaveText('test-non-js: 0')
await page.getByTestId('test-non-js').click()
await expect(page.getByTestId('test-non-js')).toHaveText('test-non-js: 1')
}
6 changes: 2 additions & 4 deletions packages/plugin-react-swc/playground/ts-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
"preview": "vite preview"
},
"dependencies": {
"@generouted/react-router": "^1.20.0",
"generouted": "1.11.7",
"@vitejs/test-dep-non-js": "file:./test-dep/non-js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this as the same behaviour as being in node_modules because node_modules is not in the resolved path

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file:./ doesn't create a symlink, so the scenario should be same. I also confirmed manually adding back if (id.includes("node_modules")) return; indeed broke the tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok thanks for testing!

"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-router-dom": "^7.6.3"
"react-dom": "^19.1.0"
},
"devDependencies": {
"@types/react": "^19.1.8",
Expand Down
11 changes: 11 additions & 0 deletions packages/plugin-react-swc/playground/ts-lib/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import TestNonJs from '@vitejs/test-dep-non-js'

export default function App() {
return (
<section style={{ margin: 24 }}>
<main>
<TestNonJs />
</main>
</section>
)
}
4 changes: 2 additions & 2 deletions packages/plugin-react-swc/playground/ts-lib/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { Routes } from 'generouted/react-router'
import App from './app'

createRoot(document.getElementById('root')!).render(
<StrictMode>
<Routes />
<App />
</StrictMode>,
)
3 changes: 0 additions & 3 deletions packages/plugin-react-swc/playground/ts-lib/src/pages/404.tsx

This file was deleted.

16 changes: 0 additions & 16 deletions packages/plugin-react-swc/playground/ts-lib/src/pages/_app.tsx

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions packages/plugin-react-swc/playground/ts-lib/src/pages/index.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'

export default function TestNonJs() {
const [count, setCount] = React.useState(0)
return (
<button data-testid="test-non-js" onClick={() => setCount(count + 1)}>
test-non-js: {count}
</button>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@vitejs/test-dep-non-js",
"private": true,
"type": "module",
"exports": "./index.tsx",
"peerDependencies": {
"react": "*"
}
}
1 change: 0 additions & 1 deletion packages/plugin-react-swc/playground/ts-lib/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'

export default defineConfig({
optimizeDeps: { include: ['react-router-dom'] },
plugins: [react()],
})
99 changes: 14 additions & 85 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading