Issue 1416#1451
Merged
Merged
Conversation
… compile sasjsconfig.json's testConfig.testSetUp/testTearDown are conventionally forward-slash paths, but compileTestFile's destination logic split only on path.sep. On Windows (path.sep === '\'), a forward-slash-only config value was left untouched by the split, producing a nested sasjsbuild/tests/sasjs/tests/testsetup.sas instead of the expected flat sasjsbuild/tests/testsetup.sas. Extracts the destination-path computation into getTestFileDestinationFragment, which splits on both '/' and '\' regardless of host OS, and adds unit tests covering the flattening/reduce logic against both separator styles plus the exact real-world config from issue 1416.
…ering Doxygen matches USE_MDFILE_AS_MAINPAGE against the file's path exactly as it appears in INPUT. The Doxyfile hardcoded a bare "README.md" while INPUT carried an absolute path, so newer Doxygen versions (see doxygen/doxygen#10110) silently failed to match them and dropped the README content instead of using it as the generated docs' main page. Introduces a DOXY_MAINPAGE env var set to the same absolute path used in DOXY_INPUT, keeping the two in sync regardless of Doxygen version. Adds a regression test covering the missing-mainpage scenario, plus a mermaid reference diagram of the current 'sasjs doc' command flow for context injection.
…/glob bugs
Three related test-infrastructure bugs, found while chasing a hanging
`npm run test:mocked` run:
- jobCommand.spec.ts's deprecation-warning test lived outside the describe
block that mocks findTargetInConfiguration/process.exit. It only "passed"
by leaking process.logger state from a prior test; the real
findTargetInConfiguration still ran and hit an unmocked process.exit(2) in
TargetCommand.getTargetInfo(), killing the Jest worker mid-suite. Moved the
test into the correctly-mocked describe block.
- create.spec.ts/init.spec.ts's afterEach called deleteFolder() with a glob
string ('test-app-create-*'), but deleteFolder() takes a literal path and
silently no-ops on the non-existent literal folder, leaving every test's
real timestamped folder on disk. Deletes process.projectDir (the actual
folder each test creates) instead.
- downloadFile()'s wget/curl calls ignored the requested `filename` on
Linux/macOS (using bare `wget`/`curl -O`, which save under the remote URL's
basename instead). createTemplateApp's repo-existence probe therefore wrote
a stray file at the repo root named after the template (e.g. `template_jobs`)
instead of the intended, discarded `response.txt`. Passes filename through
explicitly (`wget -O`/`curl -o`) and deletes the probe file after use.
Also adds unit tests for several previously-uncovered utils.ts functions
(prefixAppLoc, isSASjsProject, getNodeModulePath, getUniqServicesObj,
convertToSASStatements, terminateProcess, isSasJsServerInServerMode, and an
empty-.gitignore edge case) to restore branch coverage lost when the
jobCommand.spec.ts fix removed a test that was accidentally exercising
TargetCommand's error paths.
Coverage reportTotal coverage
Report generated by 🧪jest coverage report action from cd60b30 |
allanbowe
approved these changes
Jul 3, 2026
tmoody
approved these changes
Jul 3, 2026
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.
Issue
Closes #1416
sasjs cproducing an incorrectsasjsbuild/testsfolder structure on Windows. Also covers two related test-infrastructure bugs (a hangingnpm run test:mockedrun and leftover test-fixture artifacts) surfaced while investigating and verifying the fix.Intent
sasjs compilewritingtestSetUp/testTearDownto a nested, incorrect path on Windows instead of flattening them intosasjsbuild/tests/.sasjs docsilently dropping the README content from generated docs on newer Doxygen versions.npm run test:mockedhanging instead of completing, and stop several spec files from leaving real folders/files behind after each run.Implementation
Windows path flattening (
compileTestFile.ts)testSetUp/testTearDownvalues insasjsconfig.jsonare forward-slash paths by convention, but the destination-flattening logic split only onpath.sep(\on Windows). A forward-slash string was left untouched by that split, producingsasjsbuild/tests/sasjs/tests/testsetup.sasinstead of the expected flatsasjsbuild/tests/testsetup.sas. Extracted the logic intogetTestFileDestinationFragment, which splits on both/and\regardless of host OS.Doxygen mainpage matching (
generateDocs.ts,Doxyfile)Doxygen matches
USE_MDFILE_AS_MAINPAGEagainst the file's path exactly as it appears inINPUT. The Doxyfile hardcoded a bareREADME.mdwhileINPUTcarried an absolute path, so newer Doxygen versions no longer matched them and silently dropped the README content. Introduced aDOXY_MAINPAGEenv var set to the same absolute path used inDOXY_INPUT, keeping the two in sync.Test suite hang and leftover artifacts
jobCommand.spec.ts's deprecation-warning test lived outside its protectivedescribe/beforeEachblock, so it hit a real, unmockedprocess.exit(2)inTargetCommand.getTargetInfo()— killing the Jest worker mid-suite. Moved it into the correctly-mocked block.create.spec.ts/init.spec.tscalleddeleteFolder()with a glob string, which the function doesn't support (it takes a literal path) — every test's real folder was silently left on disk. Now deletes the actual folder each test creates.downloadFile()'swget/curlcalls ignored the requested filename on Linux/macOS, socreateTemplateApp's repo-existence probe wrote a stray file at the repo root (e.g.template_jobs) instead of a discardedresponse.txt. Filename is now passed through explicitly and the probe file is deleted after use.Other
utils.tsfunctions to restore branch coverage lost when thejobCommand.spec.tsfix removed a test that was accidentally exercisingTargetCommand's error paths.docs/diagrams/sasjs-compile.mdanddocs/diagrams/sasjs-doc.md— mermaid reference diagrams of the currentsasjs compile/sasjs doccommand logic, for use as context in future AI-assisted work.Checks
npm run lint:fix).npm test).Reviewer checks