diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 018c0f4c..43395361 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,6 +5,9 @@ updates: directory: / schedule: interval: weekly + day: sunday + time: '00:00' + timezone: America/Sao_Paulo commit-message: prefix: chore target-branch: canary @@ -38,6 +41,9 @@ updates: directory: / schedule: interval: weekly + day: sunday + time: '00:00' + timezone: America/Sao_Paulo commit-message: prefix: chore target-branch: canary diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e977a0cf..04d939c3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -75,7 +75,7 @@ jobs: node-version: - 18 - 20 - - 22 + - '22.2' env: NODE_VERSION: ${{ matrix.node-version }} @@ -104,6 +104,18 @@ jobs: --continue \ --concurrency 1 \ ${{ steps.zimic-setup.outputs.install-filters }} + env: + PLAYWRIGHT_WORKERS: 100% + + - name: Upload test reports + uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: test-reports-node-${{ matrix.node-version }} + path: | + ./examples/*/tests/reports + ./examples/*/tests/outputs + retention-days: 7 ci-typescript: name: CI TypeScript diff --git a/apps/zimic-test-client/turbo.json b/apps/zimic-test-client/turbo.json index 50282948..6fb4ddb0 100644 --- a/apps/zimic-test-client/turbo.json +++ b/apps/zimic-test-client/turbo.json @@ -8,7 +8,7 @@ }, "lint:turbo": { - "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json", ".eslintrc.js", "../../.prettierrc.json"] + "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json", ".eslintrc.js"] }, "types:check": { diff --git a/examples/turbo.json b/examples/turbo.json index bbd23f14..94228b76 100644 --- a/examples/turbo.json +++ b/examples/turbo.json @@ -8,8 +8,7 @@ "with-*/{src,tests}/**/*.{ts,json}", "with-*/{package,tsconfig}.json", "{package,tsconfig}.json", - ".eslintrc.js", - "../.prettierrc.json" + ".eslintrc.js" ] } } diff --git a/examples/with-jest-jsdom/turbo.json b/examples/with-jest-jsdom/turbo.json index d641de57..35ffaa82 100644 --- a/examples/with-jest-jsdom/turbo.json +++ b/examples/with-jest-jsdom/turbo.json @@ -8,7 +8,8 @@ }, "types:check": { - "dependsOn": ["^build", "zimic#build"] + "dependsOn": ["^build", "zimic#build"], + "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json"] } } } diff --git a/examples/with-jest-node/turbo.json b/examples/with-jest-node/turbo.json index d641de57..35ffaa82 100644 --- a/examples/with-jest-node/turbo.json +++ b/examples/with-jest-node/turbo.json @@ -8,7 +8,8 @@ }, "types:check": { - "dependsOn": ["^build", "zimic#build"] + "dependsOn": ["^build", "zimic#build"], + "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json"] } } } diff --git a/examples/with-next-js-app/playwright.config.ts b/examples/with-next-js-app/playwright.config.ts index 4d1022bc..08fe8ba4 100644 --- a/examples/with-next-js-app/playwright.config.ts +++ b/examples/with-next-js-app/playwright.config.ts @@ -5,8 +5,10 @@ export default defineConfig({ testMatch: '**/__tests__/**/*.e2e.test.ts', fullyParallel: true, retries: 1, + workers: process.env.PLAYWRIGHT_WORKERS, reporter: [['html', { outputFolder: './tests/reports' }]], outputDir: './tests/outputs', + timeout: 60 * 1000, expect: { timeout: 10 * 1000, @@ -16,7 +18,6 @@ export default defineConfig({ baseURL: 'http://localhost:3004', trace: 'on-first-retry', screenshot: 'only-on-failure', - video: 'on-first-retry', actionTimeout: 10 * 1000, navigationTimeout: 30 * 1000, }, diff --git a/examples/with-next-js-app/turbo.json b/examples/with-next-js-app/turbo.json index 80ae7d9d..a521bd19 100644 --- a/examples/with-next-js-app/turbo.json +++ b/examples/with-next-js-app/turbo.json @@ -4,6 +4,7 @@ "tasks": { "test:turbo": { "dependsOn": ["^build", "zimic#build"], + "passThroughEnv": ["PLAYWRIGHT_WORKERS"], "inputs": [ "{src,tests}/**/*.{ts,tsx,json}", "{package,tsconfig}.json", @@ -12,7 +13,8 @@ }, "types:check": { - "dependsOn": ["^build", "zimic#build"] + "dependsOn": ["^build", "zimic#build"], + "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json"] } } } diff --git a/examples/with-next-js-pages/playwright.config.ts b/examples/with-next-js-pages/playwright.config.ts index 5cd5e8b4..cf509443 100644 --- a/examples/with-next-js-pages/playwright.config.ts +++ b/examples/with-next-js-pages/playwright.config.ts @@ -5,8 +5,10 @@ export default defineConfig({ testMatch: '**/__tests__/**/*.e2e.test.ts', fullyParallel: true, retries: 1, + workers: process.env.PLAYWRIGHT_WORKERS, reporter: [['html', { outputFolder: './tests/reports' }]], outputDir: './tests/outputs', + timeout: 60 * 1000, expect: { timeout: 10 * 1000, @@ -16,7 +18,6 @@ export default defineConfig({ baseURL: 'http://localhost:3006', trace: 'on-first-retry', screenshot: 'only-on-failure', - video: 'on-first-retry', actionTimeout: 10 * 1000, navigationTimeout: 30 * 1000, }, diff --git a/examples/with-next-js-pages/turbo.json b/examples/with-next-js-pages/turbo.json index 80ae7d9d..a521bd19 100644 --- a/examples/with-next-js-pages/turbo.json +++ b/examples/with-next-js-pages/turbo.json @@ -4,6 +4,7 @@ "tasks": { "test:turbo": { "dependsOn": ["^build", "zimic#build"], + "passThroughEnv": ["PLAYWRIGHT_WORKERS"], "inputs": [ "{src,tests}/**/*.{ts,tsx,json}", "{package,tsconfig}.json", @@ -12,7 +13,8 @@ }, "types:check": { - "dependsOn": ["^build", "zimic#build"] + "dependsOn": ["^build", "zimic#build"], + "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json"] } } } diff --git a/examples/with-playwright/playwright.config.ts b/examples/with-playwright/playwright.config.ts index 43814990..4b50e818 100644 --- a/examples/with-playwright/playwright.config.ts +++ b/examples/with-playwright/playwright.config.ts @@ -5,6 +5,7 @@ export default defineConfig({ testMatch: '**/__tests__/**/*.e2e.test.ts', fullyParallel: true, retries: 1, + workers: process.env.PLAYWRIGHT_WORKERS, reporter: [['html', { outputFolder: './tests/reports' }]], outputDir: './tests/outputs', timeout: 60 * 1000, @@ -17,7 +18,6 @@ export default defineConfig({ baseURL: 'http://localhost:3002', trace: 'on-first-retry', screenshot: 'only-on-failure', - video: 'on-first-retry', actionTimeout: 10 * 1000, navigationTimeout: 30 * 1000, }, diff --git a/examples/with-playwright/turbo.json b/examples/with-playwright/turbo.json index 80ae7d9d..a521bd19 100644 --- a/examples/with-playwright/turbo.json +++ b/examples/with-playwright/turbo.json @@ -4,6 +4,7 @@ "tasks": { "test:turbo": { "dependsOn": ["^build", "zimic#build"], + "passThroughEnv": ["PLAYWRIGHT_WORKERS"], "inputs": [ "{src,tests}/**/*.{ts,tsx,json}", "{package,tsconfig}.json", @@ -12,7 +13,8 @@ }, "types:check": { - "dependsOn": ["^build", "zimic#build"] + "dependsOn": ["^build", "zimic#build"], + "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json"] } } } diff --git a/examples/with-vitest-browser/turbo.json b/examples/with-vitest-browser/turbo.json index 9234375b..b2b8b3a6 100644 --- a/examples/with-vitest-browser/turbo.json +++ b/examples/with-vitest-browser/turbo.json @@ -8,7 +8,8 @@ }, "types:check": { - "dependsOn": ["^build", "zimic#build"] + "dependsOn": ["^build", "zimic#build"], + "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json"] } } } diff --git a/examples/with-vitest-jsdom/turbo.json b/examples/with-vitest-jsdom/turbo.json index 9234375b..b2b8b3a6 100644 --- a/examples/with-vitest-jsdom/turbo.json +++ b/examples/with-vitest-jsdom/turbo.json @@ -8,7 +8,8 @@ }, "types:check": { - "dependsOn": ["^build", "zimic#build"] + "dependsOn": ["^build", "zimic#build"], + "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json"] } } } diff --git a/examples/with-vitest-node/turbo.json b/examples/with-vitest-node/turbo.json index 9234375b..b2b8b3a6 100644 --- a/examples/with-vitest-node/turbo.json +++ b/examples/with-vitest-node/turbo.json @@ -8,7 +8,8 @@ }, "types:check": { - "dependsOn": ["^build", "zimic#build"] + "dependsOn": ["^build", "zimic#build"], + "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json"] } } } diff --git a/packages/release/cli.d.ts b/packages/release/cli.d.ts deleted file mode 100644 index c63ad94a..00000000 --- a/packages/release/cli.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/cli'; diff --git a/packages/release/index.d.ts b/packages/release/index.d.ts deleted file mode 100644 index e4ddc902..00000000 --- a/packages/release/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/index'; diff --git a/packages/release/package.json b/packages/release/package.json index 54b70965..5e862abe 100644 --- a/packages/release/package.json +++ b/packages/release/package.json @@ -7,15 +7,12 @@ "index.d.ts", "cli.d.ts" ], - "exports": { - ".": "./dist/index.js" - }, "bin": { "release": "./dist/cli.js" }, "scripts": { "dev": "pnpm build --watch", - "dev:cli": "tsx src/cli/index.ts", + "cli": "node ./dist/cli.js", "build": "tsup", "lint": "eslint --ext 'ts,tsx' --cache --no-error-on-unmatched-pattern --fix", "lint:turbo": "pnpm lint . --max-warnings 0", @@ -40,7 +37,6 @@ "@zimic/tsconfig": "workspace:*", "dotenv-cli": "^7.4.2", "tsup": "^8.1.0", - "tsx": "^4.15.6", "typescript": "^5.4.5", "vitest": "1.6.0" } diff --git a/packages/release/src/index.ts b/packages/release/src/index.ts deleted file mode 100644 index b674844c..00000000 --- a/packages/release/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './config/release-config'; -export * from './cli/actions/prepare-release'; -export * from './cli/actions/upgrade-version'; diff --git a/packages/release/tsup.config.ts b/packages/release/tsup.config.ts index d7a6b99c..7e3079f3 100644 --- a/packages/release/tsup.config.ts +++ b/packages/release/tsup.config.ts @@ -1,7 +1,6 @@ import { Options, defineConfig } from 'tsup'; const sharedConfig: Options = { - format: ['cjs', 'esm'], dts: true, bundle: true, sourcemap: true, @@ -10,23 +9,15 @@ const sharedConfig: Options = { clean: true, }; -export default defineConfig([ - { - ...sharedConfig, - name: 'node', - platform: 'node', - entry: { - index: 'src/index.ts', - }, +const cliConfig = (['cjs'] as const).map((format) => ({ + ...sharedConfig, + name: 'cli', + platform: 'node', + format: [format], + dts: false, + entry: { + cli: 'src/cli/entry.ts', }, - { - ...sharedConfig, - name: 'cli', - platform: 'node', - format: ['cjs'], - dts: false, - entry: { - cli: 'src/cli/entry.ts', - }, - }, -]); +})); + +export default defineConfig([...cliConfig]); diff --git a/packages/release/turbo.json b/packages/release/turbo.json index 30e6a253..1fc18cdf 100644 --- a/packages/release/turbo.json +++ b/packages/release/turbo.json @@ -19,7 +19,7 @@ }, "lint:turbo": { - "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json", ".eslintrc.js", "../../.prettierrc.json"] + "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json", ".eslintrc.js"] }, "types:check": { diff --git a/packages/zimic/src/index.ts b/packages/zimic/src/index.ts index 95af6888..07a26592 100644 --- a/packages/zimic/src/index.ts +++ b/packages/zimic/src/index.ts @@ -1,8 +1,8 @@ -import InvalidFormDataError from './http/errors/InvalidFormDataError'; -import InvalidJSONError from './http/errors/InvalidJSONError'; -import HttpFormData from './http/formData/HttpFormData'; -import HttpHeaders from './http/headers/HttpHeaders'; -import HttpSearchParams from './http/searchParams/HttpSearchParams'; +export { default as InvalidFormDataError } from './http/errors/InvalidFormDataError'; +export { default as InvalidJSONError } from './http/errors/InvalidJSONError'; +export { default as HttpFormData } from './http/formData/HttpFormData'; +export { default as HttpHeaders } from './http/headers/HttpHeaders'; +export { default as HttpSearchParams } from './http/searchParams/HttpSearchParams'; export type { JSONValue, JSONSerialized } from '@/types/json'; @@ -41,5 +41,3 @@ export type { HttpServiceSchemaPath, PathParamsSchemaFromPath, } from './http/types/schema'; - -export { HttpSearchParams, HttpHeaders, HttpFormData, InvalidJSONError, InvalidFormDataError }; diff --git a/packages/zimic/src/interceptor/index.ts b/packages/zimic/src/interceptor/index.ts index 60684c03..006245d1 100644 --- a/packages/zimic/src/interceptor/index.ts +++ b/packages/zimic/src/interceptor/index.ts @@ -1,17 +1,11 @@ -import NotStartedHttpInterceptorError from './http/interceptor/errors/NotStartedHttpInterceptorError'; -import UnknownHttpInterceptorPlatformError from './http/interceptor/errors/UnknownHttpInterceptorPlatformError'; -import UnknownHttpInterceptorTypeError from './http/interceptor/errors/UnknownHttpInterceptorTypeError'; -import UnregisteredBrowserServiceWorkerError from './http/interceptorWorker/errors/UnregisteredBrowserServiceWorkerError'; import HttpInterceptorNamespace from './http/namespace/HttpInterceptorNamespace'; -import DisabledRequestSavingError from './http/requestHandler/errors/DisabledRequestSavingError'; -export { - UnknownHttpInterceptorPlatformError, - UnknownHttpInterceptorTypeError, - NotStartedHttpInterceptorError, - UnregisteredBrowserServiceWorkerError, - DisabledRequestSavingError, -}; +export { default as NotStartedHttpInterceptorError } from './http/interceptor/errors/NotStartedHttpInterceptorError'; +export { default as UnknownHttpInterceptorPlatformError } from './http/interceptor/errors/UnknownHttpInterceptorPlatformError'; +export { default as UnknownHttpInterceptorTypeError } from './http/interceptor/errors/UnknownHttpInterceptorTypeError'; +export { default as UnregisteredBrowserServiceWorkerError } from './http/interceptorWorker/errors/UnregisteredBrowserServiceWorkerError'; +export { default as HttpInterceptorNamespace } from './http/namespace/HttpInterceptorNamespace'; +export { default as DisabledRequestSavingError } from './http/requestHandler/errors/DisabledRequestSavingError'; export type { HttpRequestHandlerResponseDeclaration, @@ -48,7 +42,6 @@ export type { ExtractHttpInterceptorSchema } from './http/interceptor/types/sche export type { LocalHttpInterceptor, RemoteHttpInterceptor, HttpInterceptor } from './http/interceptor/types/public'; export type { HttpInterceptorNamespaceDefault } from './http/namespace/HttpInterceptorNamespace'; -export type { HttpInterceptorNamespace }; /** * A set of interceptor resources for mocking HTTP requests. diff --git a/packages/zimic/tests/utils/console.ts b/packages/zimic/tests/utils/console.ts index febfd9f1..c6d45eb3 100644 --- a/packages/zimic/tests/utils/console.ts +++ b/packages/zimic/tests/utils/console.ts @@ -8,11 +8,13 @@ export async function usingIgnoredConsole( ignoredMethods: Method[], callback: (spyByMethod: SpyByConsoleMethod) => PossiblePromise, ) { - const spyByMethod = ignoredMethods.reduce>((groupedSpies, method) => { + const initialSpyByMethod = {} as SpyByConsoleMethod; + + const spyByMethod = ignoredMethods.reduce((groupedSpies, method) => { const spy = vi.spyOn(console, method).mockImplementation(vi.fn()); groupedSpies[method] = spy; return groupedSpies; - }, {} as SpyByConsoleMethod); // eslint-disable-line @typescript-eslint/prefer-reduce-type-parameter + }, initialSpyByMethod); try { await callback(spyByMethod); diff --git a/packages/zimic/tsup.config.ts b/packages/zimic/tsup.config.ts index 025a659f..ad2756e8 100644 --- a/packages/zimic/tsup.config.ts +++ b/packages/zimic/tsup.config.ts @@ -1,8 +1,6 @@ import { Options, defineConfig } from 'tsup'; const sharedConfig: Options = { - format: ['cjs', 'esm'], - dts: true, bundle: true, sourcemap: true, treeshake: true, @@ -13,34 +11,40 @@ const sharedConfig: Options = { }, }; -export default defineConfig([ - { - ...sharedConfig, - name: 'neutral', - platform: 'neutral', - entry: { - index: 'src/index.ts', - interceptor: 'src/interceptor/index.ts', - }, - external: ['util', 'buffer', 'crypto'], +const neutralConfig = (['cjs', 'esm'] as const).map((format) => ({ + ...sharedConfig, + name: `neutral-${format}`, + platform: 'neutral', + format: [format], + dts: format === 'cjs', + entry: { + index: 'src/index.ts', + interceptor: 'src/interceptor/index.ts', }, - { - ...sharedConfig, - name: 'node', - platform: 'node', - entry: { - server: 'src/interceptor/server/index.ts', - }, + external: ['util', 'buffer', 'crypto'], +})); + +const nodeConfig = (['cjs', 'esm'] as const).map((format) => ({ + ...sharedConfig, + name: `node-${format}`, + platform: 'node', + format: [format], + dts: format === 'cjs', + entry: { + server: 'src/interceptor/server/index.ts', }, - { - ...sharedConfig, - name: 'cli', - platform: 'node', - format: ['cjs'], - dts: false, - entry: { - cli: 'src/cli/index.ts', - 'scripts/postinstall': 'scripts/postinstall.ts', - }, +})); + +const cliConfig = (['cjs'] as const).map((format) => ({ + ...sharedConfig, + name: 'cli', + platform: 'node', + format: [format], + dts: false, + entry: { + cli: 'src/cli/index.ts', + 'scripts/postinstall': 'scripts/postinstall.ts', }, -]); +})); + +export default defineConfig([...neutralConfig, ...nodeConfig, ...cliConfig]); diff --git a/packages/zimic/turbo.json b/packages/zimic/turbo.json index 0b48d256..d2375427 100644 --- a/packages/zimic/turbo.json +++ b/packages/zimic/turbo.json @@ -25,7 +25,7 @@ }, "lint:turbo": { - "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json", ".eslintrc.js", "../../.prettierrc.json"] + "inputs": ["{src,tests}/**/*.{ts,json}", "{package,tsconfig}.json", ".eslintrc.js"] }, "types:check": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c9092a41..8146e989 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -460,9 +460,6 @@ importers: tsup: specifier: ^8.1.0 version: 8.1.0(@swc/core@1.6.1)(postcss@8.4.38)(typescript@5.4.5) - tsx: - specifier: ^4.15.6 - version: 4.15.6 typescript: specifier: ^5.4.5 version: 5.4.5