Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup(angular): remove unneeded stubbing for performance.mark in jest setup file #20120

Merged
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
9 changes: 0 additions & 9 deletions packages/angular/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,6 @@
"description": "Rename 'browserTarget' to 'buildTarget'.",
"factory": "./src/migrations/update-17-1-0/browser-target-to-build-target"
},
"stub-performance-mark-in-jest-test-setup": {
"cli": "nx",
"version": "17.1.0-beta.3",
"requires": {
"@angular/core": ">=17.0.0-rc.3"
},
"description": "Stubs out 'performance.mark' in the Jest test setup file.",
"factory": "./src/migrations/update-17-1-0/stub-performance-mark-in-jest-test-setup"
},
"replace-nguniversal-builders": {
"cli": "nx",
"version": "17.1.0-beta.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Tree, joinPathFragments } from '@nx/devkit';
import { configurationGenerator } from '@nx/jest';
import { UnitTestRunner } from '../../../utils/test-runners';
import { getInstalledAngularVersionInfo } from '../../utils/version-utils';
import type { NormalizedSchema } from './normalized-schema';

export async function addUnitTestRunner(host: Tree, options: NormalizedSchema) {
Expand All @@ -19,7 +18,6 @@ export async function addUnitTestRunner(host: Tree, options: NormalizedSchema) {
'src',
'test-setup.ts'
);
const { major: angularMajorVersion } = getInstalledAngularVersionInfo(host);
if (options.strict && host.exists(setupFile)) {
const contents = host.read(setupFile, 'utf-8');
host.write(
Expand All @@ -31,17 +29,7 @@ globalThis.ngJest = {
errorOnUnknownProperties: true,
},
};
${contents}${
angularMajorVersion >= 17
? `
/**
* Angular uses performance.mark() which is not supported by jsdom. Stub it out
* to avoid errors.
*/
global.performance.mark = jest.fn();
`
: ''
}`
${contents}`
);
}
}
Expand Down
14 changes: 1 addition & 13 deletions packages/angular/src/generators/library/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import addLintingGenerator from '../add-linting/add-linting';
import setupTailwindGenerator from '../setup-tailwind/setup-tailwind';
import {
addDependenciesToPackageJsonIfDontExist,
getInstalledAngularVersionInfo,
versions,
} from '../utils/version-utils';
import { addBuildableLibrariesPostCssDependencies } from '../utils/dependencies';
Expand Down Expand Up @@ -141,7 +140,6 @@ async function addUnitTestRunner(
'src',
'test-setup.ts'
);
const { major: angularMajorVersion } = getInstalledAngularVersionInfo(host);
if (options.strict && host.exists(setupFile)) {
const contents = host.read(setupFile, 'utf-8');
host.write(
Expand All @@ -153,17 +151,7 @@ globalThis.ngJest = {
errorOnUnknownProperties: true,
},
};
${contents}${
angularMajorVersion >= 17
? `
/**
* Angular uses performance.mark() which is not supported by jsdom. Stub it out
* to avoid errors.
*/
global.performance.mark = jest.fn();
`
: ''
}`
${contents}`
);
}
}
Expand Down

This file was deleted.

Loading