Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-plugin/src/executors/cli/utils.int.test.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-plugin/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-lighthouse/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<project-root>/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 `<project-root>/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`
<img width="1202" alt="chrome-blank-screen" src="./docs/images/chrome-blank-screen.png">

2. If you do this the first time you should already see content under `<project-root>/mock/chromium-user-data`
2. If you do this the first time you should already see content under `<project-root>/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
<img width="1202" alt="chrome-blank-screen-pre-configured" src="./docs/images/chrome-blank-screen-pre-configure.png">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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',
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions testing/test-setup-config/src/lib/vitest-setup-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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,
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion testing/test-setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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