diff --git a/examples/plugins/src/lighthouse/mock/fixtures/lhr.ts b/examples/plugins/src/lighthouse/mocks/fixtures/lhr.ts similarity index 100% rename from examples/plugins/src/lighthouse/mock/fixtures/lhr.ts rename to examples/plugins/src/lighthouse/mocks/fixtures/lhr.ts diff --git a/nx.json b/nx.json index 0f563f044..448511112 100644 --- a/nx.json +++ b/nx.json @@ -14,9 +14,8 @@ "!{workspaceRoot}/**/.code-pushup/**/*", "!{projectRoot}/code-pushup.config.?(m)[jt]s", "!{projectRoot}/code-pushup.config.bundled_*.mjs", - "!{projectRoot}/@(test|mocks|mock)/**/*", + "!{projectRoot}/@(test|mocks)/**/*", "!{projectRoot}/**/?(*.)test.[jt]s?(x)?(.snap)", - "!{projectRoot}/**/?(*.)mocks.[jt]s?(x)", "!{projectRoot}/**/?(*.)mock.[jt]s?(x)", "!{projectRoot}/vitest.@(unit|int|e2e).config.[jt]s", "!{projectRoot}/dist/**/*", diff --git a/packages/nx-plugin/mock/fixtures/env.ts b/packages/nx-plugin/mocks/fixtures/env.ts similarity index 100% rename from packages/nx-plugin/mock/fixtures/env.ts rename to packages/nx-plugin/mocks/fixtures/env.ts diff --git a/packages/nx-plugin/mock/utils/executor.ts b/packages/nx-plugin/mocks/utils/executor.ts similarity index 100% rename from packages/nx-plugin/mock/utils/executor.ts rename to packages/nx-plugin/mocks/utils/executor.ts diff --git a/packages/nx-plugin/src/executors/cli/utils.int.test.ts b/packages/nx-plugin/src/executors/cli/utils.int.test.ts index cecff0afc..6a15be36b 100644 --- a/packages/nx-plugin/src/executors/cli/utils.int.test.ts +++ b/packages/nx-plugin/src/executors/cli/utils.int.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest'; import type { UploadConfig } from '@code-pushup/models'; -import { normalizedExecutorContext } from '../../../mock/utils/executor.js'; +import { normalizedExecutorContext } from '../../../mocks/utils/executor.js'; import * as config from '../internal/config.js'; import { parseCliExecutorOptions } from './utils.js'; diff --git a/packages/nx-plugin/src/executors/internal/config.int.test.ts b/packages/nx-plugin/src/executors/internal/config.int.test.ts index 54b2e32dc..79a27da14 100644 --- a/packages/nx-plugin/src/executors/internal/config.int.test.ts +++ b/packages/nx-plugin/src/executors/internal/config.int.test.ts @@ -1,5 +1,5 @@ import { describe, expect } from 'vitest'; -import { ENV } from '../../../mock/fixtures/env.js'; +import { ENV } from '../../../mocks/fixtures/env.js'; import { uploadConfig } from './config.js'; import * as env from './env.js'; diff --git a/packages/nx-plugin/src/executors/internal/config.unit.test.ts b/packages/nx-plugin/src/executors/internal/config.unit.test.ts index c9d948bdd..a44590c70 100644 --- a/packages/nx-plugin/src/executors/internal/config.unit.test.ts +++ b/packages/nx-plugin/src/executors/internal/config.unit.test.ts @@ -1,6 +1,6 @@ import { type MockInstance, describe, expect } from 'vitest'; import { osAgnosticPath } from '@code-pushup/test-utils'; -import { ENV } from '../../../mock/fixtures/env.js'; +import { ENV } from '../../../mocks/fixtures/env.js'; import { globalConfig, persistConfig, uploadConfig } from './config.js'; describe('globalConfig', () => { diff --git a/packages/nx-plugin/tsconfig.test.json b/packages/nx-plugin/tsconfig.test.json index 7bbd41b93..54cacd82f 100644 --- a/packages/nx-plugin/tsconfig.test.json +++ b/packages/nx-plugin/tsconfig.test.json @@ -7,7 +7,7 @@ "include": [ "vitest.unit.config.ts", "vitest.int.config.ts", - "mock/**/*.ts", + "mocks/**/*.ts", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.test.js", diff --git a/packages/plugin-lighthouse/CONTRIBUTING.md b/packages/plugin-lighthouse/CONTRIBUTING.md index 6ab94e123..b0a5ce113 100644 --- a/packages/plugin-lighthouse/CONTRIBUTING.md +++ b/packages/plugin-lighthouse/CONTRIBUTING.md @@ -66,15 +66,15 @@ For a full list of available flags check out [this document](https://peter.sh/ex ### Chrome User Data -To bootstrap Chrome with a predefined for setting we have to provide a couple of config files that we located under `/mock/chromium-user-data`. +To bootstrap Chrome with a predefined for setting we have to provide a couple of config files that we located under `/mocks/chromium-user-data`. When executing Lighthouse we provide the path to this folder over the `Flag` object. To generate initialise or edit the file structure under `chromium-user-data` do the following steps: -1. Spin up Chrome by running `npx chrome-debug --user-data-dir=./packages/plugin-lighthouse/mock/chromium-user-data` +1. Spin up Chrome by running `npx chrome-debug --user-data-dir=./packages/plugin-lighthouse/mocks/chromium-user-data` chrome-blank-screen -2. If you do this the first time you should already see content under `/mock/chromium-user-data` +2. If you do this the first time you should already see content under `/mocks/chromium-user-data` 3. Edit the configuration over the Chrome UI. E.g. adding a profile 4. Close chromium and open it again, and you should see chromium bootstraps as the configured user chrome-blank-screen-pre-configured diff --git a/testing/test-setup-config/src/lib/vitest-config-factory.unit.test.ts b/testing/test-setup-config/src/lib/vitest-config-factory.unit.test.ts index 3afa4b1fa..e908bcf42 100644 --- a/testing/test-setup-config/src/lib/vitest-config-factory.unit.test.ts +++ b/testing/test-setup-config/src/lib/vitest-config-factory.unit.test.ts @@ -32,7 +32,7 @@ describe('createVitestConfig', () => { ], globalSetup: ['../../global-setup.ts'], setupFiles: expect.arrayContaining([ - '../../testing/test-setup/src/lib/reset.mocks.ts', + '../../testing/test-setup/src/lib/reset.mock.ts', '../../testing/test-setup/src/lib/fs.mock.ts', ]), coverage: expect.objectContaining({ @@ -50,7 +50,7 @@ describe('createVitestConfig', () => { const setupFiles = config.test!.setupFiles; expect(setupFiles).toContain( - '../../testing/test-setup/src/lib/reset.mocks.ts', + '../../testing/test-setup/src/lib/reset.mock.ts', ); expect(setupFiles).toContain( '../../testing/test-setup/src/lib/fs.mock.ts', @@ -166,7 +166,7 @@ describe('createVitestConfig', () => { const setupFiles = config.test!.setupFiles; // Should only include reset mocks expect(setupFiles).toContain( - '../../testing/test-setup/src/lib/reset.mocks.ts', + '../../testing/test-setup/src/lib/reset.mock.ts', ); // Should NOT include fs, git, etc. expect(setupFiles).not.toContain( diff --git a/testing/test-setup-config/src/lib/vitest-setup-files.ts b/testing/test-setup-config/src/lib/vitest-setup-files.ts index 1d735b2a9..de1eeeb99 100644 --- a/testing/test-setup-config/src/lib/vitest-setup-files.ts +++ b/testing/test-setup-config/src/lib/vitest-setup-files.ts @@ -20,7 +20,7 @@ const CUSTOM_MATCHERS = [ * which is why they use `../../` to navigate to the workspace root first. */ const UNIT_TEST_SETUP_FILES = [ - '../../testing/test-setup/src/lib/reset.mocks.ts', + '../../testing/test-setup/src/lib/reset.mock.ts', '../../testing/test-setup/src/lib/fs.mock.ts', '../../testing/test-setup/src/lib/logger.mock.ts', '../../testing/test-setup/src/lib/git.mock.ts', @@ -36,7 +36,7 @@ const UNIT_TEST_SETUP_FILES = [ */ const INT_TEST_SETUP_FILES = [ - '../../testing/test-setup/src/lib/reset.mocks.ts', + '../../testing/test-setup/src/lib/reset.mock.ts', '../../testing/test-setup/src/lib/logger.mock.ts', '../../testing/test-setup/src/lib/chrome-path.mock.ts', ...CUSTOM_MATCHERS, @@ -49,7 +49,7 @@ const INT_TEST_SETUP_FILES = [ * which is why they use `../../` to navigate to the workspace root first. */ const E2E_TEST_SETUP_FILES = [ - '../../testing/test-setup/src/lib/reset.mocks.ts', + '../../testing/test-setup/src/lib/reset.mock.ts', ...CUSTOM_MATCHERS, ] as const; diff --git a/testing/test-setup/README.md b/testing/test-setup/README.md index c3b1e60e0..08d68d65c 100644 --- a/testing/test-setup/README.md +++ b/testing/test-setup/README.md @@ -20,4 +20,4 @@ In this library you can find all files that can be used in `setupFiles` property Additionally, you may find helper functions for: - setting up and tearing down a [testing folder](./src/lib/test-folder.setup.ts) -- [resetting](./src/lib/reset.mocks.ts) mocks +- [resetting](./src/lib/reset.mock.ts) mocks diff --git a/testing/test-setup/src/lib/reset.mocks.ts b/testing/test-setup/src/lib/reset.mock.ts similarity index 100% rename from testing/test-setup/src/lib/reset.mocks.ts rename to testing/test-setup/src/lib/reset.mock.ts