Skip to content

Commit ea6b91a

Browse files
authored
test: add simple npm monorepo and deploy from workspace directory without --filter (#305)
* test: add simple npm monorepo and deploy from workspace directory without --filter * test: use empty base and init git repo * test: use previous cli * Revert "test: use previous cli" This reverts commit d5368afb17a1d909f6f9354c10c2da215986cb9a. * chore: clearer names in create-e2e-fixtures * chore: upgrade turbo * test: install monorepo root deps as well with npm * test: maybe not run turbo in parallel * test: maybe not run any test in parallel * chore: more debug information on deployment failures * revert some debug changes * Revert "chore: more debug information on deployment failures" This reverts commit e3cbe529e624b1ba8833892ed8bbf7cf4f57e8f5. * remove .gitignore from fixture as there is common one * test: cleanup, remove empty destructuring * test: install latest cli in smoke test and don't rely on version in runner
1 parent 99b68c3 commit ea6b91a

File tree

13 files changed

+611
-58
lines changed

13 files changed

+611
-58
lines changed

.github/workflows/run-tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ jobs:
8080
run: npm ci
8181
- name: 'Build'
8282
run: npm run build
83-
- name: 'Lint'
84-
run: npm run lint
83+
- name: 'Netlify Login'
84+
env:
85+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
86+
run: |
87+
npm i -g netlify-cli
88+
netlify login
8589
- name: Compute Fixtures Cache Key
8690
id: fixture-cache-key
8791
# Fixtures only need to be rebuilt if anything in the tests/fixtures directory changes,

tests/smoke/deploy.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { expect, test } from 'vitest'
1+
import { expect, test, beforeAll } from 'vitest'
22
import { Fixture, fixtureFactories } from '../utils/create-e2e-fixture'
3+
import { execaCommand } from 'execa'
34

45
async function smokeTest(createFixture: () => Promise<Fixture>) {
56
const fixture = await createFixture()
@@ -14,3 +15,7 @@ async function smokeTest(createFixture: () => Promise<Fixture>) {
1415
test('yarn@3 monorepo with pnpm linker', async () => {
1516
await smokeTest(fixtureFactories.yarnMonorepoWithPnpmLinker)
1617
})
18+
19+
test('npm monorepo deploying from site directory without --filter', async () => {
20+
await smokeTest(fixtureFactories.npmMonorepoEmptyBaseNoPackagePath)
21+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build]
2+
base = ""
3+
command = "npm run build"
4+
publish = "apps/site/.next"
5+
6+
[[plugins]]
7+
package = "@netlify/plugin-nextjs"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
output: 'standalone',
4+
eslint: {
5+
ignoreDuringBuilds: true,
6+
},
7+
transpilePackages: ['@repo/ui'],
8+
}
9+
10+
module.exports = nextConfig
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@apps/site",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"build": "next build"
7+
},
8+
"dependencies": {
9+
"@packages/ui": "*",
10+
"next": "^14.0.3",
11+
"react": "^18.2.0",
12+
"react-dom": "^18.2.0"
13+
}
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { TestElement } from '@packages/ui/test.jsx'
2+
3+
export default function Home({ ssr }) {
4+
return (
5+
<main>
6+
<TestElement testid="smoke">SSR: {ssr ? 'yes' : 'no'}</TestElement>
7+
</main>
8+
)
9+
}
10+
11+
export const getServerSideProps = async () => {
12+
return {
13+
props: {
14+
ssr: true,
15+
},
16+
}
17+
}

0 commit comments

Comments
 (0)