mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 06:43:06 +00:00
fix(ci): isola bundle e2e do servidor de desenvolvimento
This commit is contained in:
parent
b6be493cdf
commit
7ca0efc95c
6 changed files with 22 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
# next.js
|
# next.js
|
||||||
/.next/
|
/.next/
|
||||||
|
/.next-e2e/
|
||||||
/out/
|
/out/
|
||||||
|
|
||||||
# production
|
# production
|
||||||
|
|
|
||||||
|
|
@ -154,12 +154,9 @@ export default defineConfig({
|
||||||
* e2e states stay deterministic (see `googleCalendarTestKey.ts`).
|
* e2e states stay deterministic (see `googleCalendarTestKey.ts`).
|
||||||
*/
|
*/
|
||||||
[GOOGLE_CALENDAR_SERVICE_ACCOUNT_KEY_ENV_NAME]: GOOGLE_CALENDAR_TEST_KEY,
|
[GOOGLE_CALENDAR_SERVICE_ACCOUNT_KEY_ENV_NAME]: GOOGLE_CALENDAR_TEST_KEY,
|
||||||
// Fixed dist dir: Next dev appends `<distDir>/types/**/*.ts` to
|
// Keep e2e artifacts outside `.next`: a concurrent development server
|
||||||
// tsconfig.json's include with an EXACT-string check, so per-process
|
// owns that entire directory and may clear nested production bundles.
|
||||||
// names polluted tsconfig with one entry per run. A prior Playwright
|
NEXT_DIST_DIR: process.env.NEXT_DIST_DIR ?? '.next-e2e',
|
||||||
// process tearing down late can, rarely, delete files of the next run's
|
|
||||||
// server — if a boot flakes, rerun (dev-only trade-off).
|
|
||||||
NEXT_DIST_DIR: '.next/e2e',
|
|
||||||
PAYLOAD_SECRET: process.env.PAYLOAD_SECRET ?? 'test-only-secret-not-used-in-production',
|
PAYLOAD_SECRET: process.env.PAYLOAD_SECRET ?? 'test-only-secret-not-used-in-production',
|
||||||
NEXT_PUBLIC_SITE_URL: process.env.NEXT_PUBLIC_SITE_URL ?? baseURL,
|
NEXT_PUBLIC_SITE_URL: process.env.NEXT_PUBLIC_SITE_URL ?? baseURL,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -149,9 +149,9 @@ const main = async () => {
|
||||||
run('playwright install chromium', 'pnpm', ['exec', 'playwright', 'install', 'chromium'])
|
run('playwright install chromium', 'pnpm', ['exec', 'playwright', 'install', 'chromium'])
|
||||||
run('e2e migrate', 'pnpm', ['migrate'], dbEnv)
|
run('e2e migrate', 'pnpm', ['migrate'], dbEnv)
|
||||||
run('e2e seed:minimal', 'pnpm', ['db:seed:minimal'], dbEnv)
|
run('e2e seed:minimal', 'pnpm', ['db:seed:minimal'], dbEnv)
|
||||||
run('e2e build', 'pnpm', ['build'], { ...dbEnv, NEXT_DIST_DIR: '.next/e2e' })
|
run('e2e build', 'pnpm', ['build'], { ...dbEnv, NEXT_DIST_DIR: '.next-e2e' })
|
||||||
|
|
||||||
const e2eEnv = { ...dbEnv, E2E_PROD: '1', CI: '1', NEXT_DIST_DIR: '.next/e2e' }
|
const e2eEnv = { ...dbEnv, E2E_PROD: '1', CI: '1', NEXT_DIST_DIR: '.next-e2e' }
|
||||||
if (scope.e2e.mode === 'full') {
|
if (scope.e2e.mode === 'full') {
|
||||||
run('test:e2e (full)', 'pnpm', ['test:e2e'], e2eEnv)
|
run('test:e2e (full)', 'pnpm', ['test:e2e'], e2eEnv)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
* run-e2e-affected — local mirror of the CI (PR) e2e job:
|
* run-e2e-affected — local mirror of the CI (PR) e2e job:
|
||||||
* 1. `e2e-affected.mjs` picks full vs manifest-selected vs skip (same base ref).
|
* 1. `e2e-affected.mjs` picks full vs manifest-selected vs skip (same base ref).
|
||||||
* 2. migrate + db:seed:minimal when anything would run.
|
* 2. migrate + db:seed:minimal when anything would run.
|
||||||
* 3. optional production build into `.next/e2e` when `E2E_PROD=1`.
|
* 3. optional production build into `.next-e2e` when `E2E_PROD=1`.
|
||||||
* 4. `pnpm test:e2e` (set `CI=1` and `E2E_PROD=1` together for prod mode).
|
* 4. `pnpm test:e2e` (set `CI=1` and `E2E_PROD=1` together for prod mode).
|
||||||
*
|
*
|
||||||
* Extra Playwright args after `--` are forwarded (e.g. a single spec while debugging).
|
* Extra Playwright args after `--` are forwarded (e.g. a single spec while debugging).
|
||||||
|
|
@ -48,7 +48,7 @@ const run = (command, args, env = {}) => {
|
||||||
run('pnpm', ['migrate'])
|
run('pnpm', ['migrate'])
|
||||||
run('pnpm', ['db:seed:minimal'])
|
run('pnpm', ['db:seed:minimal'])
|
||||||
if (process.env.E2E_PROD === '1') {
|
if (process.env.E2E_PROD === '1') {
|
||||||
run('pnpm', ['build'], { NEXT_DIST_DIR: '.next/e2e' })
|
run('pnpm', ['build'], { NEXT_DIST_DIR: '.next-e2e' })
|
||||||
}
|
}
|
||||||
|
|
||||||
const playwrightArgs = ['test:e2e']
|
const playwrightArgs = ['test:e2e']
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,19 @@ describe('ciSkipInvariants', () => {
|
||||||
expect(CANONICAL_E2E_SPEC_SUFFIX).toBe('.e2e.spec.ts')
|
expect(CANONICAL_E2E_SPEC_SUFFIX).toBe('.e2e.spec.ts')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('keeps local e2e build artifacts outside the development dist directory', () => {
|
||||||
|
for (const file of [
|
||||||
|
'playwright.config.ts',
|
||||||
|
'scripts/gate-ci.mjs',
|
||||||
|
'scripts/run-e2e-affected.mjs',
|
||||||
|
'tsconfig.json',
|
||||||
|
]) {
|
||||||
|
const source = readFileSync(join(repoRoot, file), 'utf8')
|
||||||
|
expect(source, file).not.toContain('.next/e2e')
|
||||||
|
expect(source, file).toContain('.next-e2e')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
it('skip classifiers and invariant specs are high-risk (force full suite)', () => {
|
it('skip classifiers and invariant specs are high-risk (force full suite)', () => {
|
||||||
for (const path of [
|
for (const path of [
|
||||||
'scripts/lib/test-affected-core.mjs',
|
'scripts/lib/test-affected-core.mjs',
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
"next-env.d.ts",
|
"next-env.d.ts",
|
||||||
".next/types/**/*.ts",
|
".next/types/**/*.ts",
|
||||||
".next/dev/types/**/*.ts",
|
".next/dev/types/**/*.ts",
|
||||||
".next/e2e/types/**/*.ts"
|
".next-e2e/types/**/*.ts"
|
||||||
],
|
],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue