Skip to content
Open
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
44 changes: 44 additions & 0 deletions .github/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,47 @@
By participating in and contributing to the Architect community — including, but not limited to its open source projects, any related online venues such as GitHub, Slack, and in-person events, etc. — you agree to the [Architect Code of Conduct](/.github/code_of_conduct.md).

Lack of familiarity with this Code of Conduct is not an excuse for not adhering to it.

## Development Setup

### Prerequisites
- Node.js 20+ (required for native test runner)
- npm

### Testing

This project uses Node.js native test runner for all testing. The test suite is organized into unit and integration tests.

**Running Tests:**
```bash
# Run the full test suite (includes linting, tests, and type checking)
npm test

# Run tests without linting
npm run test:nolint

# Run specific test types
npm run test:unit # Unit tests only
npm run test:integration # Integration tests only
npm run test:types # TypeScript type tests

# Generate coverage reports
npm run coverage # Unit test coverage with lcov output
npm run coverage:text # Text-only coverage report
npm run coverage:all # Coverage for all tests
```

**Test Structure:**
- `test/unit/` - Unit tests for individual modules
- `test/integration/` - Integration tests that may require external services
- Tests use Node.js built-in `node:test` module and `node:assert` for assertions
- Coverage is generated using Node.js native coverage collection

**Writing Tests:**
When contributing new features or fixing bugs, please include appropriate tests:
- Unit tests for new functions or modules
- Integration tests for features that interact with external services
- Use Node.js native test patterns (see existing tests for examples)

**Test Migration:**
This project was recently migrated from Tape to Node.js native test runner. See `test/MIGRATION_GUIDE.md` for details about the migration utilities and patterns used.
11 changes: 2 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [ 16.x, 18.x, 20.x, 22.x ]
node-version: [ 20.x, 22.x, 24.x ]
os: [ windows-latest, ubuntu-latest, macOS-latest ]

# Go
Expand All @@ -40,15 +40,8 @@ jobs:
- name: Install
run: npm install

- name: Test (Node.js <= 16.x)
if: matrix.node-version <= '16.x'
run: npm run test:nolint
env:
CI: true

- name: Test
if: matrix.node-version > '16.x'
run: npm test
run: npm test # Uses Node.js native test runner (Node 20+)
env:
CI: true

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ scratch/
test/mock/*/src/*/*/vendor/
test/mock/tmp/
yarn.lock
.kiro
53 changes: 50 additions & 3 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,52 @@
# Contributing
## First: go read the [Begin Code of Conduct](https://github.com/smallwins/policy/blob/main/begin-community-code-of-conduct.md)

### Agreement to the Begin Community Code of Conduct
By participating and contributing to the Small Wins (aka Begin) community -- including, but not limited to its open source projects, any related online venues such as Github, Slack, and in-person events, etc. -- you agree to the [Begin Code of Conduct](https://github.com/smallwins/policy/blob/main/begin-community-code-of-conduct.md), found at the [Begin Policy archive](https://github.com/smallwins/policy). Lack of familiarity with this Code of Conduct is not an excuse for not adhering to it.
## First: go read the [Architect Code of Conduct](.github/code_of_conduct.md)

### Agreement to the Architect Code of Conduct
By participating in and contributing to the Architect community — including, but not limited to its open source projects, any related online venues such as GitHub, Slack, and in-person events, etc. — you agree to the [Architect Code of Conduct](.github/code_of_conduct.md).

Lack of familiarity with this Code of Conduct is not an excuse for not adhering to it.

## Development Setup

### Prerequisites
- Node.js 20+ (required for native test runner)
- npm

### Testing

This project uses Node.js native test runner for all testing. The test suite is organized into unit and integration tests.

**Running Tests:**
```bash
# Run the full test suite (includes linting, tests, and type checking)
npm test

# Run tests without linting
npm run test:nolint

# Run specific test types
npm run test:unit # Unit tests only
npm run test:integration # Integration tests only
npm run test:types # TypeScript type tests

# Generate coverage reports
npm run coverage # Unit test coverage with lcov output
npm run coverage:text # Text-only coverage report
npm run coverage:all # Coverage for all tests
```

**Test Structure:**
- `test/unit/` - Unit tests for individual modules
- `test/integration/` - Integration tests that may require external services
- Tests use Node.js built-in `node:test` module and `node:assert` for assertions
- Coverage is generated using Node.js native coverage collection

**Writing Tests:**
When contributing new features or fixing bugs, please include appropriate tests:
- Unit tests for new functions or modules
- Integration tests for features that interact with external services
- Use Node.js native test patterns (see existing tests for examples)

**Test Migration:**
This project was recently migrated from Tape to Node.js native test runner. See `test/MIGRATION_GUIDE.md` for details about the migration utilities and patterns used.
48 changes: 22 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@architect/functions",
"version": "8.1.9",
"version": "8.1.10-RC.0",
"description": "Runtime utility library for Functional Web Apps (FWAs) built with Architect (https://arc.codes)",
"homepage": "https://github.com/architect/functions",
"repository": {
Expand All @@ -11,56 +11,52 @@
"main": "src/index",
"types": "types/index.d.ts",
"scripts": {
"test:one": "cross-env tape 'test/unit/src/http/csrf/*-test.js' | tap-arc",
"lint": "eslint --fix .",
"test": "npm run lint && npm run test:integration && npm run coverage && npm run test:types",
"test:nolint": "npm run test:integration && npm run coverage && npm run test:types",
"test:unit": "cross-env tape 'test/unit/**/*-test.js' | tap-arc",
"test:integration": "cross-env tape 'test/integration/**/*-test.js' | tap-arc",
"coverage": "nyc --reporter=lcov --reporter=text npm run test:unit",
"test:unit": "node --test test/unit/**/*-test.js",
"test:integration": "node --test --test-concurrency=1 test/integration/*-test.js",
"test:types": "tsd --files types/*.test-d.ts",
"coverage": "node -e \"require('fs').mkdirSync('coverage', {recursive: true})\" && node --test --experimental-test-coverage --test-reporter=spec --test-reporter=lcov --test-reporter-destination=stdout --test-reporter-destination=coverage/lcov.info test/unit/**/*-test.js",
"coverage:text": "node --test --experimental-test-coverage --test-reporter=spec test/unit/**/*-test.js",
"coverage:lcov": "node -e \"require('fs').mkdirSync('coverage', {recursive: true})\" && node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info test/unit/**/*-test.js",
"coverage:all": "node -e \"require('fs').mkdirSync('coverage', {recursive: true})\" && node --test --experimental-test-coverage --test-reporter=spec --test-reporter=lcov --test-reporter-destination=stdout --test-reporter-destination=coverage/lcov.info test/unit/**/*-test.js test/integration/*-test.js",
"rc": "npm version prerelease --preid RC"
},
"engines": {
"node": ">=16"
"node": ">=20"
},
"author": "Brian LeRoux <[email protected]>",
"license": "Apache-2.0",
"dependencies": {
"@aws-lite/apigatewaymanagementapi": "^0.0.10",
"@aws-lite/client": "^0.22.4",
"@aws-lite/client": "^0.23.2",
"@aws-lite/dynamodb": "^0.3.9",
"@aws-lite/sns": "^0.0.8",
"@aws-lite/sqs": "^0.2.4",
"@aws-lite/ssm": "^0.2.5",
"cookie": "^1.0.2",
"cookie-signature": "^1.2.2",
"csrf": "^3.1.0",
"node-webtokens": "^1.0.4",
"run-parallel": "^1.2.0",
"run-waterfall": "^1.1.7",
"uid-safe": "^2.1.5"
"cookie": "1.0.2",
"cookie-signature": "1.2.2",
"csrf": "3.1.0",
"node-webtokens": "1.0.4",
"run-parallel": "1.2.0",
"run-waterfall": "1.1.7",
"uid-safe": "2.1.5"
},
"devDependencies": {
"@architect/asap": "^7.0.10",
"@architect/eslint-config": "^3.0.0",
"@architect/req-res-fixtures": "git+https://github.com/architect/req-res-fixtures.git",
"@architect/sandbox": "^6.0.5",
"@architect/sandbox": "^8.0.0-RC.2",
"@aws-lite/apigatewaymanagementapi-types": "^0.0.13",
"@aws-lite/dynamodb-types": "^0.3.11",
"@aws-lite/sns-types": "^0.0.10",
"@aws-lite/sqs-types": "^0.2.6",
"@types/aws-lambda": "^8.10.147",
"@types/node": "18",
"cross-env": "~7.0.3",
"eslint": "^9.19.0",
"nyc": "~17.1.0",
"proxyquire": "~2.1.3",
"sinon": "^19.0.2",
"tap-arc": "^1.3.2",
"tape": "^5.9.0",
"tiny-json-http": "^7.5.1",
"tsd": "^0.31.2"
"@types/node": "^24.5.2",
"eslint": "9.19.0",
"tiny-json-http": "7.5.1",
"tsd": "0.33.0"
},
"files": [
"types/*",
Expand All @@ -85,4 +81,4 @@
"strict": false
}
}
}
}
28 changes: 28 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,34 @@
Check out the full docs for [this library](https://arc.codes/docs/en/reference/runtime-helpers/node.js) and [Architect](https://arc.codes)


## Development

### Testing

This project uses Node.js native test runner (Node.js 20+) for testing. The test suite includes both unit and integration tests.

**Run all tests:**
```bash
npm test
```

**Run specific test types:**
```bash
npm run test:unit # Unit tests only
npm run test:integration # Integration tests only
npm run test:types # TypeScript type tests
```

**Generate coverage reports:**
```bash
npm run coverage # Coverage with lcov output
npm run coverage:text # Coverage with text output only
npm run coverage:all # Coverage for all tests (unit + integration)
```

The test suite uses Node.js built-in test runner and assert module. Coverage reporting is handled by Node.js native coverage collection (`--experimental-test-coverage`).


## Install

Within your Architect project directory, add `@architect/function` to its root `package.json`:
Expand Down
Loading
Loading