diff --git a/.eslintrc.js b/.eslintrc.js index 79bc5dd..e5f563c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -16,6 +16,12 @@ module.exports = { rules: { "@typescript-eslint/no-var-requires": 0, "@typescript-eslint/explicit-module-boundary-types": 0, + "prettier/prettier": [ + "error", + { + endOfLine: "auto", + }, + ], }, ignorePatterns: ["lib", "coverage"], }; diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index bf0d164..59b288d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -9,12 +9,23 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + node_version: + - 20 + architecture: + - x64 + name: tests on ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: ${{ matrix.node_version }} + architecture: ${{ matrix.architecture }} - run: yarn - run: chmod +x ./bin/run - run: yarn test:ci diff --git a/src/core/validateGeneratedTypes.ts b/src/core/validateGeneratedTypes.ts index 8d79b76..a1ba66a 100644 --- a/src/core/validateGeneratedTypes.ts +++ b/src/core/validateGeneratedTypes.ts @@ -4,7 +4,7 @@ import { createVirtualTypeScriptEnvironment, } from "@typescript/vfs"; import ts from "typescript"; -import { join } from "path"; +import { join, sep, posix } from "path"; import { resolveDefaultProperties } from "../utils/resolveDefaultProperties"; import { fixOptionalAny } from "../utils/fixOptionalAny"; interface File { @@ -37,7 +37,7 @@ export function validateGeneratedTypes({ const fsMap = createDefaultMapFromNodeModules({ target: compilerOptions.target, }); - const projectRoot = process.cwd(); + const projectRoot = makePosixPath(process.cwd()); const src = fixOptionalAny( skipParseJSDoc ? sourceTypes.sourceText @@ -116,5 +116,9 @@ function getDetails(file: ts.SourceFile, line: number) { } function getPath(file: File) { - return join(process.cwd(), file.relativePath); + return makePosixPath(join(process.cwd(), file.relativePath)); +} + +function makePosixPath(str: string) { + return str.split(sep).join(posix.sep); }