Skip to content

Testing testing#523

Open
cubap wants to merge 5 commits into
mainfrom
testing-testing
Open

Testing testing#523
cubap wants to merge 5 commits into
mainfrom
testing-testing

Conversation

@cubap
Copy link
Copy Markdown
Member

@cubap cubap commented May 15, 2026

This pull request modernizes and clarifies the project's configuration and testing approach, updates documentation, improves CI/CD workflows, and removes legacy test files. The changes focus on adopting Node.js native features for environment management and testing, restructuring test directories, and enhancing automation for development and deployment.

Configuration and Documentation Updates:

  • Switched from using dotenv and custom loaders to Node.js native env-file flags for environment configuration, updating all related documentation (README.md, CONFIG.md, .github/copilot-instructions.md) to reflect the new approach. [1] [2] [3] [4] [5] [6]
  • Updated documentation to describe the new test runner (node:test with c8 for coverage), removed references to Jest, and clarified testing commands and directory structure in CONTRIBUTING.md and README.md. [1] [2] [3] [4] [5] [6]

Testing and Directory Structure:

  • Removed the legacy __tests__/full_end_to_end.test.js file and restructured test directories to use test/local and test/integration, aligning with the new testing strategy. [1] [2] [3]

CI/CD Workflow Improvements:

  • Refactored GitHub Actions workflows for CI/CD:
    • Split testing into local_seams and integration_seams jobs for both development and production (ci_dev.yaml, ci_prod.yaml), and updated test commands to use the new scripts. [1] [2] [3] [4]
    • Updated smoke test steps in deployment workflows to use npm run test:integration instead of direct script calls. [1] [2]

Automation and Artifact Sync:

  • Added a new workflow .github/workflows/sync_tpen_shared_openapi.yaml to automatically sync the shared OpenAPI artifact with an external repository, streamlining API documentation updates.

Test Script and Category Updates:

  • Revised npm scripts and test categories in documentation to match the new structure, removing obsolete or redundant test commands and adding coverage reporting. [1] [2] [3]

These changes collectively modernize the development workflow, improve maintainability, and ensure consistency across documentation, testing, and deployment processes.

Copilot AI and others added 5 commits May 9, 2026 01:54
Replace the legacy Jest-based test setup and dotenv loader with Node's built-in test runner and native env-file flags. GitHub Actions workflows were reworked: job 'test' renamed to 'local_seams', new 'integration_seams' (creates .env from secrets, sets up Node 24, caches npm, runs npm run test:integration) and coordinated bump_version job added; CD jobs now run npm run test:integration for smoke checks. Documentation and guides (.github/copilot-instructions.md, CONFIG.md, CONTRIBUTING.md, README.md) updated to reflect Node native env-file usage, updated test script names (test:local, test:integration, test:coverage) and testing guidance. Removed import of env-loader from bin/tpen3_services.js. Large set of legacy Jest tests under __tests__ and various class test folders were removed and replaced by new test suites under test/local and test/integration; package.json/package-lock were updated accordingly.
@cubap cubap requested a review from thehabes as a code owner May 15, 2026 22:43
@cubap cubap requested a review from Copilot May 15, 2026 22:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes environment loading and test execution by moving from Jest/dotenv-based tooling to Node native env-file flags and node:test, while restructuring CI/CD and adding an OpenAPI artifact sync workflow.

Changes:

  • Replaces Jest scripts/configuration and many legacy __tests__ suites with smaller test/local and test/integration node:test suites.
  • Updates documentation and npm scripts for Node native env-file loading and c8 coverage.
  • Adjusts CI/CD workflows and adds automation to sync a shared OpenAPI component artifact.

Reviewed changes

Copilot reviewed 46 out of 49 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.github/copilot-instructions.md Updates repo guidance for env-file flags and new test commands.
.github/workflows/cd_dev.yaml Replaces deployed dev smoke script with integration test command.
.github/workflows/cd_prod.yaml Replaces deployed prod smoke script with integration test command.
.github/workflows/ci_dev.yaml Splits PR validation into local and integration seam jobs.
.github/workflows/ci_prod.yaml Splits PR validation into local and integration seam jobs.
.github/workflows/sync_tpen_shared_openapi.yaml Adds workflow to sync shared OpenAPI artifact to another repo.
CONFIG.md Documents new env-file loading approach.
CONTRIBUTING.md Documents node:test/c8 workflow and test directory layout.
README.md Updates setup/testing documentation.
__tests__/full_end_to_end.test.js Removes legacy Jest end-to-end tests.
__tests__/mount.test.js Removes legacy route/static-file existence suite.
__tests__/smoke.test.js Removes deployed-service smoke test script.
auth/__tests__/auth_unit_test.js Removes legacy auth middleware tests.
bin/tpen3_services.js Removes direct env-loader import from server entrypoint.
classes/Group/__tests__/Group.test.js Removes legacy Group class tests.
classes/Layer/__tests__/exists.test.js Removes legacy Layer class existence tests.
classes/Line/__tests__/Line.test.js Removes legacy Line class tests.
classes/Page/__tests__/exists.test.js Removes legacy Page class existence tests.
classes/Project/__tests__/Project.test.js Removes legacy Project class tests.
classes/Project/__tests__/exists_unit.test.js Removes Project/ProjectFactory existence tests.
classes/User/__tests__/exists.test.js Removes User class existence tests.
classes/User/__tests__/unit.test.js Removes legacy private profile/User tests.
config.env Updates comments for env-file loading order.
database/__tests__/unit.test.js Removes legacy database driver tests.
database/maria/__tests__/unit.test.js Removes MariaDB stub test.
database/mongo/__tests__/unit.test.js Removes MongoDB controller tests.
database/tiny/__tests__/unit.test.js Removes TinyPEN controller tests.
env-loader.js Removes custom dotenv loader.
jest.config.js Removes Jest configuration.
layer/__tests__/layer_routes.test.js Removes legacy layer route tests.
line/__tests__/lineRouter.test.js Removes legacy line router tests.
openapi/components/tpen-services-shared-components.openapi.yaml Adds shared OpenAPI components artifact.
package.json Replaces Jest/dotenv scripts and dependencies with node:test/c8 scripts.
page/__tests__/end_to_end_unit.test.js Removes legacy page route tests.
project/__tests__/customMetadataRouter.test.js Removes custom metadata router tests.
project/__tests__/end_to_end_unit.test.js Removes legacy project route tests.
project/__tests__/exists_unit.test.js Removes project route existence stub.
test/integration/api.seams.integration.test.js Adds source/static-file integration seam checks.
test/local/api.seams.static.test.js Adds static route/middleware seam checks.
test/local/openapi.artifacts.test.js Adds OpenAPI artifact and sync workflow checks.
test/local/utility.validation.test.js Adds minimal validation utility tests.
userProfile/__tests__/end_to_end_unit.test.js Removes legacy user profile route tests.
userProfile/__tests__/exists_unit.test.js Removes user profile route existence tests.
userProfile/__tests__/functionality_unit.test.js Removes validateID helper tests.
utilities/__tests__/isDefaultRole.test.js Removes legacy default-role tests.
utilities/__tests__/isSuspicious.test.js Removes suspicious input detection tests.
utilities/__tests__/shared.test.js Removes shared utility tests.
utilities/__tests__/validatePayload.test.js Removes comprehensive project payload validation tests.
Comments suppressed due to low confidence (7)

utilities/tests/isSuspicious.test.js:1

  • Removing this test file without a node:test replacement drops all automated coverage for the suspicious-input detector, including script/command patterns and safe JSON regressions. That utility protects request bodies on write routes, so the new test suite should preserve these security checks rather than only static route seams.
    utilities/tests/shared.test.js:1
  • Removing this test file without a node:test replacement drops coverage for hasAnnotationChanges, including the property-order and RERUM-metadata cases that prevent false positives/negatives when deciding whether annotation content changed.
    userProfile/tests/functionality_unit.test.js:1
  • The replacement test suite no longer checks validateID, so invalid/valid user ID handling for /user/:id lost its only direct regression coverage. Please port these assertions to the new node:test structure instead of deleting them outright.
    auth/tests/auth_unit_test.js:1
  • Removing these active auth middleware tests leaves the new suite with only static checks that auth0Middleware() appears in route source. It no longer verifies the runtime 401 behavior for missing or invalid bearer tokens, which is a security-sensitive contract and should be ported to node:test/supertest.
    utilities/tests/validatePayload.test.js:1
  • Removing this comprehensive validation suite leaves the new replacement with only three project-payload assertions and one role-scrubbing assertion. Edge cases previously covered here—invalid metadata shapes, malformed layers/pages, manifest URI validation, creator/group validation, and tool URL/custom validation—should be ported so regressions in project creation validation are still caught.
    classes/User/tests/unit.test.js:1
  • Removing this test file drops the active unauthenticated/invalid-token coverage for /my/profile and /my/projects. The new static seam tests only assert middleware wiring, so they would not catch a regression that accidentally allows unauthenticated profile access.
    tests/mount.test.js:1
  • Deleting this route-mount suite removes coverage for most registered API routes (user, project management, custom roles/metadata, tools, copy, layer/page/line, proxy, feedback, and required static files). The replacement static seam test only checks a handful of app/page/line patterns, so many accidental route removals would no longer be caught by CI.

run: |
cd /srv/node/tpen-services/
SMOKE_TEST_URL=https://api.t-pen.org node __tests__/smoke.test.js
npm run test:integration
run: |
cd /srv/node/tpen-services/
SMOKE_TEST_URL=https://dev.api.t-pen.org node __tests__/smoke.test.js
npm run test:integration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants