Skip to content

Commit

Permalink
chore: Bundler integration tests (#5756)
Browse files Browse the repository at this point in the history
* Add react-cra5 test

* Add react-cra4 test

* Add react-vite test

* Add svelte-vite test

* Add solid-vite test

* Run prettier

* Rename script to test:bundle

* Add vue-vite test

* Run prettier
  • Loading branch information
lachlancollins authored Jul 21, 2023
1 parent b167883 commit 77bd2c3
Show file tree
Hide file tree
Showing 44 changed files with 20,624 additions and 8,927 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
timeout_minutes: 5
max_attempts: 3
command: npx nx affected --targets=test:eslint,test:lib,test:types,test:build
command: npx nx affected --targets=test:eslint,test:lib,test:types,test:build,test:bundle
- name: Stop Agents
run: npx nx-cloud stop-all-agents
- name: Upload coverage to Codecov
Expand Down
23 changes: 23 additions & 0 deletions integrations/react-cra4/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
26 changes: 26 additions & 0 deletions integrations/react-cra4/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "react-cra4",
"private": true,
"scripts": {
"test:bundle": "cross-env DISABLE_ESLINT_PLUGIN=true SKIP_PREFLIGHT_CHECK=true NODE_OPTIONS=--openssl-legacy-provider react-scripts build"
},
"dependencies": {
"@tanstack/react-query": "workspace:*",
"@tanstack/react-query-devtools": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "^4.0.3"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
11 changes: 11 additions & 0 deletions integrations/react-cra4/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
23 changes: 23 additions & 0 deletions integrations/react-cra4/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useQuery } from '@tanstack/react-query'

export const App = () => {
const query = useQuery({
queryKey: ['test'],
queryFn: async () => {
await new Promise((r) => setTimeout(r, 1000))
return 'Success'
},
})

if (query.isPending) {
return <div>Loading...</div>
}

if (query.isError) {
return <div>An error has occurred!</div>
}

return <div>{query.data}</div>
}

export default App
18 changes: 18 additions & 0 deletions integrations/react-cra4/src/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import App from './App'

const queryClient = new QueryClient()

const root = ReactDOM.createRoot(document.getElementById('root'))

root.render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<App />
<ReactQueryDevtools />
</QueryClientProvider>
</React.StrictMode>,
)
1 change: 1 addition & 0 deletions integrations/react-cra4/src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="react-scripts" />
23 changes: 23 additions & 0 deletions integrations/react-cra5/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
26 changes: 26 additions & 0 deletions integrations/react-cra5/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "react-cra5",
"private": true,
"scripts": {
"test:bundle": "cross-env DISABLE_ESLINT_PLUGIN=true react-scripts build"
},
"dependencies": {
"@tanstack/react-query": "workspace:*",
"@tanstack/react-query-devtools": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "^5.0.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
11 changes: 11 additions & 0 deletions integrations/react-cra5/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
23 changes: 23 additions & 0 deletions integrations/react-cra5/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useQuery } from '@tanstack/react-query'

export const App = () => {
const query = useQuery({
queryKey: ['test'],
queryFn: async () => {
await new Promise((r) => setTimeout(r, 1000))
return 'Success'
},
})

if (query.isPending) {
return <div>Loading...</div>
}

if (query.isError) {
return <div>An error has occurred!</div>
}

return <div>{query.data}</div>
}

export default App
18 changes: 18 additions & 0 deletions integrations/react-cra5/src/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import App from './App'

const queryClient = new QueryClient()

const root = ReactDOM.createRoot(document.getElementById('root'))

root.render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<App />
<ReactQueryDevtools />
</QueryClientProvider>
</React.StrictMode>,
)
1 change: 1 addition & 0 deletions integrations/react-cra5/src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="react-scripts" />
24 changes: 24 additions & 0 deletions integrations/react-vite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
11 changes: 11 additions & 0 deletions integrations/react-vite/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
16 changes: 16 additions & 0 deletions integrations/react-vite/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "react-vite",
"private": true,
"type": "module",
"scripts": {
"test:bundle": "vite build"
},
"dependencies": {
"@tanstack/react-query": "workspace:*",
"@tanstack/react-query-devtools": "workspace:*",
"@vitejs/plugin-react": "^4.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"vite": "^4.4.4"
}
}
23 changes: 23 additions & 0 deletions integrations/react-vite/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useQuery } from '@tanstack/react-query'

export const App = () => {
const query = useQuery({
queryKey: ['test'],
queryFn: async () => {
await new Promise((r) => setTimeout(r, 1000))
return 'Success'
},
})

if (query.isPending) {
return <div>Loading...</div>
}

if (query.isError) {
return <div>An error has occurred!</div>
}

return <div>{query.data}</div>
}

export default App
18 changes: 18 additions & 0 deletions integrations/react-vite/src/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import App from './App.jsx'

const queryClient = new QueryClient()

const root = ReactDOM.createRoot(document.getElementById('root'))

root.render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<App />
<ReactQueryDevtools />
</QueryClientProvider>
</React.StrictMode>,
)
6 changes: 6 additions & 0 deletions integrations/react-vite/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
plugins: [react()],
})
24 changes: 24 additions & 0 deletions integrations/solid-vite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
11 changes: 11 additions & 0 deletions integrations/solid-vite/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Vite + Solid</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
</body>
</html>
14 changes: 14 additions & 0 deletions integrations/solid-vite/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "solid-vite",
"private": true,
"type": "module",
"scripts": {
"test:bundle": "vite build"
},
"dependencies": {
"@tanstack/solid-query": "workspace:*",
"solid-js": "^1.6.13",
"vite": "^4.4.4",
"vite-plugin-solid": "^2.5.0"
}
}
Loading

0 comments on commit 77bd2c3

Please sign in to comment.