test: fix paths for Windows

Merged
NI
5mo ago
+34-32

Tested on Windows 10

Before:

Test Suites: 2 failed, 4 passed, 6 total
Tests:       17 failed, 206 passed, 223 total
Snapshots:   0 total
Time:        3.331 s, estimated 15 s
Ran all test suites.

After:

$ yarn test
yarn run v1.22.22
$ nx test generator-cli

> nx run generator-cli:test  [existing outputs match the cache, left as is]

 PASS   generator-cli  apps/generator-cli/src/app/services/config.service.spec.ts (14.132 s)
 PASS   generator-cli  apps/generator-cli/src/app/app.module.spec.ts (14.273 s)
 PASS   generator-cli  apps/generator-cli/src/app/services/version-manager.service.spec.ts (14.29 s)
 PASS   generator-cli  apps/generator-cli/src/app/services/generator.service.spec.ts (14.305 s)
 PASS   generator-cli  apps/generator-cli/src/app/controllers/version-manager.controller.spec.ts (14.33 s)
 PASS   generator-cli  apps/generator-cli/src/app/services/pass-through.service.spec.ts (14.369 s)

Test Suites: 6 passed, 6 total
Tests:       223 passed, 223 total
Snapshots:   0 total
Time:        16.982 s
Ran all test suites.

Summary by cubic

Make tests cross-platform so they pass on Windows by normalizing paths and classpath handling. All 223 tests now pass on Windows 10.

  • Bug Fixes
    • Replaced hardcoded POSIX paths with path.resolve, path.join, and path.normalize.
    • Used path.delimiter for Java classpath construction.
    • Updated test expectations in generator and version manager specs to compare resolved paths and storage locations.