From de46eb624652f1ca2fcb4dc93dc7098bf079538a Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Sat, 30 Nov 2024 23:49:04 +0100 Subject: [PATCH] chore: improve setup & CI config * ignore snapshot files for linting * move CI-specific options --- .github/workflows/ci.yml | 5 +++++ biome.jsonc | 5 +++++ package.json | 5 +++-- tsconfig.json | 25 ++++++++++++++++++++++--- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a706d7..34c3955 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,10 @@ jobs: strategy: fail-fast: false matrix: + options: >- + --test-coverage-lines=0.8 + --test-reporter-destination=./coverage.lcov + --test-reporter=lcov node: - version: 23.x - version: 22.x @@ -46,6 +50,7 @@ jobs: uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # 4.1.0 with: node-version: ${{ matrix.node.version }} + env: NODE_OPTIONS=${{ matrix.node.options }} cache: 'npm' - run: npm ci - run: npm run test:unit diff --git a/biome.jsonc b/biome.jsonc index 5ebe181..7419507 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -1,5 +1,10 @@ { "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "files": { + "ignore": [ + "**/*.snap.cjs" + ] + }, "formatter": { "indentStyle": "tab", "lineWidth": 100 diff --git a/package.json b/package.json index e3a9658..9faeb50 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,11 @@ "format": "biome format ./", "lint:fix": "biome lint --fix ./", "lint": "biome lint ./", + "fix-commit": "node --run format:fix; node --run lint:fix", "pre-commit": "node --run lint:fix; node --run format:fix; node --run test:types; node --run test:unit; node --run test:e2e", - "test:e2e": "node --no-warnings --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=./coverage.lcov --test-reporter=spec --test-reporter-destination=stdout --import './build/snapshots.ts' --test --test-coverage-include='recipes/**/*' --test-coverage-exclude='**/*.e2e.{mjs,mts}' './packages/*/*.e2e.{mjs,mts}'", + "test:e2e": "NODE_OPTIONS='--no-warnings --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --import=\"./build/snapshots.mts\" --test-coverage-include=\"recipes/**/*\" --test-coverage-exclude=\"**/*.e2e.{mjs,mts}\"' npm run test:e2e --workspaces", "test:types": "tsc", - "test:unit": "node --no-warnings --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=./coverage.lcov --test-reporter=spec --test-reporter-destination=stdout --experimental-test-module-mocks --import './build/snapshots.ts' --test --test-coverage-include='recipes/**/*' --test-coverage-exclude='**/*.spec.{mjs,mts}' --test-coverage-lines=0.8 './packages/*/*.spec.{mjs,mts}'" + "test:unit": "NODE_OPTIONS='--no-warnings --experimental-test-snapshots --experimental-test-module-mocks --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --import=\"./build/snapshots.mts\" --test-coverage-include=\"recipes/**/*\" --test-coverage-exclude=\"**/*.e2e.{mjs,mts}\"' npm run test:e2e --workspaces" }, "repository": { "type": "git", diff --git a/tsconfig.json b/tsconfig.json index 3292d56..8913f37 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "rootDir": "./", "target": "ESNext", - // "moduleDetection": "force", + "lib": ["ESNext"], /* Modules */ "module": "NodeNext", @@ -24,7 +24,7 @@ /* Interop Constraints */ "verbatimModuleSyntax": true, - "allowSyntheticDefaultImports": false, + "allowSyntheticDefaultImports": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, @@ -40,5 +40,24 @@ "include": [ "./build/", "./recipes/" - ] + ], + "exclude": [ + "node_modules", + "**/build/**", + "**/fixtures/**", + "**/test/**", + "**/*.fixture.mjs", + "**/*.fixture.mts", + "**/*.fixture.js", + "**/*.fixture.ts", + "**/*.mock.mjs", + "**/*.e2e.mjs", + "**/*.e2e.mts", + "**/*.e2e.js", + "**/*.e2e.ts", + "**/*.spec.mjs", + "**/*.spec.mts", + "**/*.spec.js", + "**/*.spec.ts", + ], }