Skip to content
Draft
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
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,15 @@ jobs:
- name: Build packages
run: pnpm exec turbo build --filter='...[origin/${{ github.base_ref }}]' --filter='!gt-next-middleware-e2e' --filter='!./examples/*'

- name: Run typecheck
run: pnpm exec turbo typecheck --filter='...[origin/${{ github.base_ref }}]' --filter='!gt-next-middleware-e2e' --filter='!./examples/*'

- name: Run tests
run: pnpm exec turbo test --filter='...[origin/${{ github.base_ref }}]' --filter='!gt-next-middleware-e2e' --filter='!./examples/*'

- name: Run smoke tests
run: pnpm exec turbo smoke --filter='...[origin/${{ github.base_ref }}]' --filter='!gt-next-middleware-e2e' --filter='!./examples/*'

test-builds:
strategy:
matrix:
Expand Down
3 changes: 2 additions & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"test:watch": "vitest",
"bench": "vitest bench --run --config vitest.config.bench.ts",
"bench:unit:json": "vitest bench --run --config vitest.config.bench.ts --outputJson benchmarks/results/unit-latest.json",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"smoke": "node scripts/smoke.mjs"
},
"repository": {
"type": "git",
Expand Down
37 changes: 37 additions & 0 deletions packages/next/scripts/smoke.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env node
// Import the built `gt-next/config` entry the way a real next.config does:
// plain Node, no bundler. Catches module-evaluation-time regressions the
// bundled test apps can't (e.g. bare `require`/`__dirname` in the ESM build,
// exports-map paths pointing at files that don't exist).
import { createRequire } from 'node:module';

const failures = [];

try {
const esm = await import('gt-next/config');
if (typeof esm.withGTConfig !== 'function') {
failures.push('ESM: withGTConfig is not a function');
}
} catch (error) {
failures.push(`ESM: import('gt-next/config') threw: ${error}`);
}

try {
const require = createRequire(import.meta.url);
const cjs = require('gt-next/config');
if (typeof cjs.withGTConfig !== 'function') {
failures.push('CJS: withGTConfig is not a function');
}
} catch (error) {
failures.push(`CJS: require('gt-next/config') threw: ${error}`);
}

if (failures.length > 0) {
console.error('gt-next smoke test failed:');
for (const failure of failures) {
console.error(` - ${failure}`);
}
process.exit(1);
}

console.warn('gt-next smoke test passed (ESM + CJS config entry)');
4 changes: 4 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
"cache": false,
"env": ["VITE_CI_TEST_GT_PROJECT_ID", "VITE_CI_TEST_GT_API_KEY"]
},
"smoke": {
"dependsOn": ["build", "^build"],
"cache": false
},
"test:watch": {
"cache": false,
"persistent": true
Expand Down
Loading