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
13 changes: 6 additions & 7 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ on:
- '24'

jobs:
# TODO: Fix CI setup and re-enable
generate-node-version-matrix:
if: false
name: Generate Node Version Matrix
runs-on: ubuntu-latest
outputs:
Expand All @@ -41,26 +39,25 @@ jobs:

integration-tests:
name: Integration Tests (Node ${{ matrix.node-version }})
needs: generate-node-version-matrix
needs: [generate-node-version-matrix]
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: ${{ fromJson(needs.generate-node-version-matrix.outputs.node-versions) }}
node-version: ${{ fromJSON(needs.generate-node-version-matrix.outputs.node-versions) }}

steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
package-manager-cache: false

- name: Install dependencies
run: npm install
run: npm ci

- name: Build
run: npm run build || true
Expand All @@ -73,8 +70,10 @@ jobs:

- name: Run integration tests
run: npm run test:integration
timeout-minutes: 5
env:
HARPER_INTEGRATION_TEST_LOG_DIR: /tmp/harper-test-logs
FORCE_COLOR: '1'

- name: Upload Harper logs on failure
if: failure()
Expand Down
3 changes: 1 addition & 2 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
save-exact=true
package-lock=false
save-exact=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.22.2
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
Review the `README.md` and `CONTRIBUTING.md` for all relevant repository information.

## Development Tips

- Use `npm install` to install dependencies
- Use `npm run build` to build the project files
- Do not edit files in `dist/`; it is compiled output and gitignored.
- Do not run `npm version` or `npm publish`; these commands are for humans only.
- The `.cts` extension is intentional and load-order-sensitive. Do not change file extensions in `src/`.

## Code Style

- Use Prettier for formatting: `npm run format:fix`
- `src/plugin.ts` is ESM. `src/withHarper.cts` and `src/CacheHandler.cts` are CommonJS (required by Next.js config resolution). Keep them that way.

## Testing Tips

- Use `npm link` in this directory and `npm link @harperfast/nextjs` in other project directories to test out changes locally
- Run `npm run install:fixtures` before running tests for the first time, and again after changing any fixture's `package.json`.
- Run `npm run test:integration` to run all tests, or `npm run test:integration -- integrationTests/next-15.pw.ts` for a single file.
Expand Down
37 changes: 24 additions & 13 deletions integrationTests/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
createHarperContext,
setupHarperWithFixture,
teardownHarper,
HarperStartupError,
type HarperContext,
} from '@harperfast/integration-testing';
import { test as base, expect } from '@playwright/test';
Expand All @@ -22,20 +23,30 @@ export function makeHarperFixture(fixtureName: string) {
const fixturePath = join(import.meta.dirname, '..', 'fixtures', fixtureName);
const ctx = createHarperContext(fixtureName);

const started = await setupHarperWithFixture(ctx, fixturePath, {
harperBinPath: getHarperBinPath(),
startupTimeoutMs: STARTUP_TIMEOUT_MS,
config: {
logging: {
stdStreams: true,
let started;
try {
started = await setupHarperWithFixture(ctx, fixturePath, {
harperBinPath: getHarperBinPath(),
startupTimeoutMs: STARTUP_TIMEOUT_MS,
config: {
logging: {
stdStreams: true,
},
applications: {
lockdown: 'none',
moduleLoader: 'native',
dependencyLoader: 'native',
},
},
applications: {
lockdown: 'none',
moduleLoader: 'native',
dependencyLoader: 'native',
},
},
});
});
} catch (error) {
if (error instanceof HarperStartupError) {
console.error(`[${fixtureName}] Harper failed to start`);
if (error.stdout) console.error(`[${fixtureName}] stdout:\n${error.stdout}`);
if (error.stderr) console.error(`[${fixtureName}] stderr:\n${error.stderr}`);
}
throw error;
}

await use(started.harper);

Expand Down
4 changes: 2 additions & 2 deletions integrationTests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export default defineConfig({
forbidOnly: !!process.env.CI,

// Retry on CI to smooth over flakiness in Next.js startup timing
retries: process.env.CI ? 1 : 0,
// retries: process.env.CI ? 1 : 0,

reporter: process.env.CI ? 'github' : 'list',
reporter: process.env.CI ? [['list'], ['github']] : 'list',

use: {
// No baseURL — each test uses harper.httpURL from the fixture directly,
Expand Down
Loading
Loading