Skip to content

Commit 3b891c7

Browse files
committed
chore: migrate to node test runner
1 parent ce1b2aa commit 3b891c7

38 files changed

+2938
-1724
lines changed

.github/contributing.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,47 @@
66
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).
77

88
Lack of familiarity with this Code of Conduct is not an excuse for not adhering to it.
9+
10+
## Development Setup
11+
12+
### Prerequisites
13+
- Node.js 20+ (required for native test runner)
14+
- npm
15+
16+
### Testing
17+
18+
This project uses Node.js native test runner for all testing. The test suite is organized into unit and integration tests.
19+
20+
**Running Tests:**
21+
```bash
22+
# Run the full test suite (includes linting, tests, and type checking)
23+
npm test
24+
25+
# Run tests without linting
26+
npm run test:nolint
27+
28+
# Run specific test types
29+
npm run test:unit # Unit tests only
30+
npm run test:integration # Integration tests only
31+
npm run test:types # TypeScript type tests
32+
33+
# Generate coverage reports
34+
npm run coverage # Unit test coverage with lcov output
35+
npm run coverage:text # Text-only coverage report
36+
npm run coverage:all # Coverage for all tests
37+
```
38+
39+
**Test Structure:**
40+
- `test/unit/` - Unit tests for individual modules
41+
- `test/integration/` - Integration tests that may require external services
42+
- Tests use Node.js built-in `node:test` module and `node:assert` for assertions
43+
- Coverage is generated using Node.js native coverage collection
44+
45+
**Writing Tests:**
46+
When contributing new features or fixing bugs, please include appropriate tests:
47+
- Unit tests for new functions or modules
48+
- Integration tests for features that interact with external services
49+
- Use Node.js native test patterns (see existing tests for examples)
50+
51+
**Test Migration:**
52+
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.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: npm install
4242

4343
- name: Test
44-
run: npm test
44+
run: npm test # Uses Node.js native test runner (Node 20+)
4545
env:
4646
CI: true
4747

contributing.md

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
11
# Contributing
2-
## First: go read the [Begin Code of Conduct](https://github.com/smallwins/policy/blob/main/begin-community-code-of-conduct.md)
32

4-
### Agreement to the Begin Community Code of Conduct
5-
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.
3+
## First: go read the [Architect Code of Conduct](.github/code_of_conduct.md)
4+
5+
### Agreement to the Architect Code of Conduct
6+
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).
7+
8+
Lack of familiarity with this Code of Conduct is not an excuse for not adhering to it.
9+
10+
## Development Setup
11+
12+
### Prerequisites
13+
- Node.js 20+ (required for native test runner)
14+
- npm
15+
16+
### Testing
17+
18+
This project uses Node.js native test runner for all testing. The test suite is organized into unit and integration tests.
19+
20+
**Running Tests:**
21+
```bash
22+
# Run the full test suite (includes linting, tests, and type checking)
23+
npm test
24+
25+
# Run tests without linting
26+
npm run test:nolint
27+
28+
# Run specific test types
29+
npm run test:unit # Unit tests only
30+
npm run test:integration # Integration tests only
31+
npm run test:types # TypeScript type tests
32+
33+
# Generate coverage reports
34+
npm run coverage # Unit test coverage with lcov output
35+
npm run coverage:text # Text-only coverage report
36+
npm run coverage:all # Coverage for all tests
37+
```
38+
39+
**Test Structure:**
40+
- `test/unit/` - Unit tests for individual modules
41+
- `test/integration/` - Integration tests that may require external services
42+
- Tests use Node.js built-in `node:test` module and `node:assert` for assertions
43+
- Coverage is generated using Node.js native coverage collection
44+
45+
**Writing Tests:**
46+
When contributing new features or fixing bugs, please include appropriate tests:
47+
- Unit tests for new functions or modules
48+
- Integration tests for features that interact with external services
49+
- Use Node.js native test patterns (see existing tests for examples)
50+
51+
**Test Migration:**
52+
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.

package.json

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@
1414
"lint": "eslint --fix .",
1515
"test": "npm run lint && npm run test:integration && npm run coverage && npm run test:types",
1616
"test:nolint": "npm run test:integration && npm run coverage && npm run test:types",
17-
"test:unit": "cross-env tape 'test/unit/**/*-test.js'",
18-
"test:integration": "cross-env tape 'test/integration/**/*-test.js'",
17+
"test:unit": "node --test 'test/unit/**/*-test.js'",
18+
"test:integration": "node --test --test-concurrency=1 'test/integration/**/*-test.js'",
1919
"test:types": "tsd --files types/*.test-d.ts",
20-
"coverage": "nyc --reporter=lcov --reporter=text npm run test:unit",
20+
"coverage": "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'",
21+
"coverage:text": "node --test --experimental-test-coverage --test-reporter=spec 'test/unit/**/*-test.js'",
22+
"coverage:lcov": "node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info 'test/unit/**/*-test.js'",
23+
"coverage:all": "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'",
2124
"rc": "npm version prerelease --preid RC"
2225
},
2326
"engines": {
@@ -51,14 +54,9 @@
5154
"@aws-lite/sqs-types": "^0.2.6",
5255
"@types/aws-lambda": "^8.10.147",
5356
"@types/node": "^24.5.2",
54-
"cross-env": "^10.0.0",
55-
"eslint": "^9.19.0",
56-
"nyc": "~17.1.0",
57-
"proxyquire": "~2.1.3",
58-
"sinon": "^21.0.0",
59-
"tape": "^5.9.0",
60-
"tiny-json-http": "^7.5.1",
61-
"tsd": "^0.33.0"
57+
"eslint": "9.19.0",
58+
"tiny-json-http": "7.5.1",
59+
"tsd": "0.33.0"
6260
},
6361
"files": [
6462
"types/*",

readme.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,34 @@
1212
Check out the full docs for [this library](https://arc.codes/docs/en/reference/runtime-helpers/node.js) and [Architect](https://arc.codes)
1313

1414

15+
## Development
16+
17+
### Testing
18+
19+
This project uses Node.js native test runner (Node.js 20+) for testing. The test suite includes both unit and integration tests.
20+
21+
**Run all tests:**
22+
```bash
23+
npm test
24+
```
25+
26+
**Run specific test types:**
27+
```bash
28+
npm run test:unit # Unit tests only
29+
npm run test:integration # Integration tests only
30+
npm run test:types # TypeScript type tests
31+
```
32+
33+
**Generate coverage reports:**
34+
```bash
35+
npm run coverage # Coverage with lcov output
36+
npm run coverage:text # Coverage with text output only
37+
npm run coverage:all # Coverage for all tests (unit + integration)
38+
```
39+
40+
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`).
41+
42+
1543
## Install
1644

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

0 commit comments

Comments
 (0)