fix: integration tests, local FaaS, workdir, test harness, and type safety#188
Draft
miantalha45 wants to merge 1 commit intometacall:masterfrom
Draft
fix: integration tests, local FaaS, workdir, test harness, and type safety#188miantalha45 wants to merge 1 commit intometacall:masterfrom
miantalha45 wants to merge 1 commit intometacall:masterfrom
Conversation
Member
|
I am reviewing slowly the PR. I am not sure everything is correct, the first part I have done in relation to your PR is solving a known issue about execution paths: It broke the tests because I also changed the repositoryName function, the correct naming is like that. I am updating the tests: https://github.com/metacall/faas/actions/runs/21610629884/job/62278314670 I am putting this PR into draft meanwhile. We can talk about how to proceed but it would be better if we can focus on atomic parts and solve them as I did right now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes failing deploy integration tests so all 22 tests pass when run with
TEST_DEPLOY_LOCAL=trueagainst a local FaaS.Changes
CLI behavior
--workdir(src/cli/args.ts): Removed defaultworkdir = process.cwd(). DefaultprojectNameis set only whenworkdiris provided. Avoids accidentally deploying the current directory (e.g. the deploy repo).src/index.ts): API base URL usesconfig.devURLwhenprocess.env.TEST_DEPLOY_LOCAL === 'true'or--devis set, so the CLI talks to local FaaS in tests.src/startup.ts): In dev mode, the'local'token is saved to config once so the CLI and test helpers (e.g.deployed(),deleted()) share the same auth.Type safety / lint
apiError(src/cli/messages.ts): Typederr.responseand safe handling of status/data so ESLint/TypeScript are satisfied and missing or non-string response data is handled safely.Test harness (
src/test/cli.ts)runWithInputaccepts anenvargument;runCLIpassesTEST_DEPLOY_LOCAL: 'true'when running locally so the spawned CLI uses local FaaS.isRealError()so Node deprecation warnings on stderr do not fail tests; only CLI-style (X,!,Error:) or HTTP-style errors are treated as failures.deployed()anddeleted()useconfig.devURLwhenTEST_DEPLOY_LOCAL === 'true'.Integration spec (
src/test/cli.integration.spec.ts)stripAnsi(result)so tests pass with chalk output.examplesfor.../metacall/examples) to match how FaaS names deployments.'i Deploy Delete Succeed\n'(aligned with FaaS response).Other
Testing
TEST_DEPLOY_LOCAL=true npm test— all 22 deploy integration tests pass (6 login tests are skipped when running locally).