cline/test-setup.js
Tomás Barreiro 1700c0e4f8
Run tests against Windows and Ubuntu (#3246)
* add a matrix strategy for testing

* Handle EOL on Windows

* use bash as shell on every os and run the test-ci script

* fix tsconfig path resolution using the __dirnname

* print test results regardless of status

* Limit artifact upload to Linux

* update the test-cli

* Add windows-specific dependencies as optional dependencies

lightningcss-win32-x64-msvc
rollup-win32-x64-msvc

* Do not collect coverage on Windows

* Use UTF-8 on the Python Scripts

* force the ubuntu-latest name to be `test`
2025-05-19 13:32:35 -07:00

26 lines
825 B
JavaScript

const tsConfigPaths = require("tsconfig-paths")
const fs = require("fs")
const path = require("path")
const baseUrl = path.resolve(__dirname)
const tsConfig = JSON.parse(fs.readFileSync(path.join(baseUrl, "tsconfig.json"), "utf-8"))
/**
* The aliases point towards the `src` directory.
* However, `tsc` doesn't compile paths by itself
* (https://www.typescriptlang.org/docs/handbook/modules/reference.html#paths-does-not-affect-emit)
* So we need to use tsconfig-paths to resolve the aliases when running tests,
* but pointing to `out` instead.
*/
const outPaths = {}
Object.keys(tsConfig.compilerOptions.paths).forEach((key) => {
const value = tsConfig.compilerOptions.paths[key]
outPaths[key] = value.map((path) => path.replace("src", "out"))
})
tsConfigPaths.register({
baseUrl: baseUrl,
paths: outPaths,
})