mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(core): update error message links to versioned docs (#66374)
Error message links now point to the archived documentation site (v*.angular.dev) so that referenced content matches the framework version in use. See angular#44650 PR Close #66374
This commit is contained in:
committed by
Jessica Janiuk
parent
29f074a93f
commit
03e2b36826
@@ -119,7 +119,7 @@ describe('ngFor', () => {
|
||||
|
||||
getComponent().items = <any>'whaaa';
|
||||
expect(() => fixture.detectChanges()).toThrowError(
|
||||
`NG02200: Cannot find a differ supporting object 'whaaa' of type 'string'. NgFor only supports binding to Iterables, such as Arrays. Find more at https://angular.dev/errors/NG02200`,
|
||||
/NG02200: Cannot find a differ supporting object 'whaaa' of type 'string'\. NgFor only supports binding to Iterables, such as Arrays\. Find more at https:\/\/(?:next\.)?angular\.dev\/errors\/NG02200/,
|
||||
);
|
||||
}));
|
||||
|
||||
@@ -128,7 +128,7 @@ describe('ngFor', () => {
|
||||
|
||||
getComponent().items = <any>{'stuff': 'whaaa'};
|
||||
expect(() => fixture.detectChanges()).toThrowError(
|
||||
`NG02200: Cannot find a differ supporting object '\[object Object\]' of type 'object'. NgFor only supports binding to Iterables, such as Arrays. Did you mean to use the keyvalue pipe? Find more at https://angular.dev/errors/NG02200`,
|
||||
/NG02200: Cannot find a differ supporting object '\[object Object\]' of type 'object'\. NgFor only supports binding to Iterables, such as Arrays\. Did you mean to use the keyvalue pipe\? Find more at https:\/\/(?:next\.)?angular\.dev\/errors\/NG02200/,
|
||||
);
|
||||
}));
|
||||
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
|
||||
import {VERSION} from './version';
|
||||
|
||||
export const DOC_PAGE_BASE_URL: string = (() => {
|
||||
const full = VERSION.full;
|
||||
const isPreRelease =
|
||||
full.includes('-next') ||
|
||||
full.includes('-rc') ||
|
||||
// Avoid direct literal to prevent build stamping replacement
|
||||
full === '0.0.0' + '-PLACEHOLDER';
|
||||
const prefix = isPreRelease ? 'next' : `v${VERSION.major}`;
|
||||
return `https://${prefix}.angular.dev`;
|
||||
})();
|
||||
|
||||
/**
|
||||
* Base URL for the error details page.
|
||||
*
|
||||
@@ -16,10 +27,8 @@ import {VERSION} from './version';
|
||||
* - packages/core/src/error_details_base_url.ts
|
||||
*/
|
||||
export const ERROR_DETAILS_PAGE_BASE_URL: string = (() => {
|
||||
const versionSubDomain = VERSION.major !== '0' ? `v${VERSION.major}.` : '';
|
||||
return `https://${versionSubDomain}angular.dev/errors`;
|
||||
return `${DOC_PAGE_BASE_URL}/errors`;
|
||||
})();
|
||||
|
||||
/**
|
||||
* URL for the XSS security documentation.
|
||||
*/
|
||||
|
||||
@@ -56,6 +56,7 @@ import {DEHYDRATED_BLOCK_REGISTRY, DehydratedBlockRegistry} from '../defer/regis
|
||||
import {gatherDeferBlocksCommentNodes} from './node_lookup_utils';
|
||||
import {processAndInitTriggers} from '../defer/triggering';
|
||||
import {DOCUMENT} from '../document';
|
||||
import {DOC_PAGE_BASE_URL} from '../error_details_base_url';
|
||||
|
||||
/**
|
||||
* Indicates whether the hydration-related code was added,
|
||||
@@ -148,7 +149,7 @@ function printHydrationStats(injector: Injector) {
|
||||
(isIncrementalHydrationEnabled(injector)
|
||||
? `${ngDevMode!.deferBlocksWithIncrementalHydration} defer block(s) were configured to use incremental hydration. `
|
||||
: '') +
|
||||
`Learn more at https://angular.dev/guide/hydration.`;
|
||||
`Learn more at ${DOC_PAGE_BASE_URL}/guide/hydration.`;
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import {inject} from './di/injector_compatibility';
|
||||
import {formatRuntimeError, RuntimeErrorCode} from './errors';
|
||||
import {OnDestroy} from './change_detection/lifecycle_hooks';
|
||||
import {getDocument} from './render3/interfaces/document';
|
||||
import {ERROR_DETAILS_PAGE_BASE_URL} from './error_details_base_url';
|
||||
|
||||
// A delay in milliseconds before the scan is run after onLoad, to avoid any
|
||||
// potential race conditions with other LCP-related functions. This delay
|
||||
@@ -213,7 +214,7 @@ function logLazyLCPWarning(src: string) {
|
||||
`changing the loading value of the LCP image to "eager", or by using the ` +
|
||||
`NgOptimizedImage directive's prioritization utilities. For more ` +
|
||||
`information about addressing or disabling this warning, see ` +
|
||||
`https://angular.dev/errors/NG0913`,
|
||||
`${ERROR_DETAILS_PAGE_BASE_URL}/NG0913`,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -225,7 +226,7 @@ function logOversizedImageWarning(src: string) {
|
||||
`An image with src ${src} has intrinsic file dimensions much larger than its ` +
|
||||
`rendered size. This can negatively impact application loading performance. ` +
|
||||
`For more information about addressing or disabling this warning, see ` +
|
||||
`https://angular.dev/errors/NG0913`,
|
||||
`${ERROR_DETAILS_PAGE_BASE_URL}/NG0913`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
import {Component, Directive, forwardRef, Host, Inject, ViewChild} from '@angular/core';
|
||||
import {TestBed} from '../../testing';
|
||||
import {ERROR_DETAILS_PAGE_BASE_URL} from '../../src/error_details_base_url';
|
||||
|
||||
// **NOTE**: More details on why tests relying on `forwardRef` are put into this
|
||||
// file can be found in the `BUILD.bazel` file declaring the forward ref test target.
|
||||
@@ -41,7 +42,7 @@ describe('di with forwardRef', () => {
|
||||
expect(() => TestBed.createComponent(MyComp)).toThrowError(
|
||||
'NG0200: Circular dependency detected for `DirectiveA`. ' +
|
||||
'Path: DirectiveA -> DirectiveB -> DirectiveA. ' +
|
||||
'Find more at https://angular.dev/errors/NG0200',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0200`,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ import {
|
||||
DestroyRef,
|
||||
provideZoneChangeDetection,
|
||||
} from '../../src/core';
|
||||
import {ERROR_DETAILS_PAGE_BASE_URL} from '../../src/error_details_base_url';
|
||||
import {RuntimeError, RuntimeErrorCode} from '../../src/errors';
|
||||
import {ViewRef as ViewRefInternal} from '../../src/render3/view_ref';
|
||||
import {TestBed} from '../../testing';
|
||||
@@ -1263,7 +1264,7 @@ describe('di', () => {
|
||||
expect(() => TestBed.createComponent(MyComp)).toThrowError(
|
||||
'NG0200: Circular dependency detected for `DirectiveA`. ' +
|
||||
'Path: DirectiveA -> DirectiveA. ' +
|
||||
'Find more at https://angular.dev/errors/NG0200',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0200`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2553,7 +2554,7 @@ describe('di', () => {
|
||||
|
||||
TestBed.configureTestingModule({declarations: [DirectiveString, MyComp, MyApp]});
|
||||
expect(() => TestBed.createComponent(MyApp)).toThrowError(
|
||||
'NG0201: No provider for String found in NodeInjector. Find more at https://angular.dev/errors/NG0201',
|
||||
`NG0201: No provider for String found in NodeInjector. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2651,7 +2652,7 @@ describe('di', () => {
|
||||
|
||||
TestBed.configureTestingModule({declarations: [DirectiveComp, MyComp, MyApp]});
|
||||
expect(() => TestBed.createComponent(MyApp)).toThrowError(
|
||||
'NG0201: No provider for MyApp found in NodeInjector. Find more at https://angular.dev/errors/NG0201',
|
||||
`NG0201: No provider for MyApp found in NodeInjector. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -6640,7 +6641,7 @@ describe('di', () => {
|
||||
'NG0200: Circular dependency detected for `InjectionToken A`. ' +
|
||||
'Source: DynamicTestModule. ' +
|
||||
'Path: InjectionToken A -> InjectionToken B -> InjectionToken A. ' +
|
||||
'Find more at https://angular.dev/errors/NG0200',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0200`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -6676,7 +6677,7 @@ describe('di', () => {
|
||||
'NG0200: Circular dependency detected for `InjectionToken A`. ' +
|
||||
'Source: DynamicTestModule. ' +
|
||||
'Path: InjectionToken A -> InjectionToken B -> InjectionToken A. ' +
|
||||
'Find more at https://angular.dev/errors/NG0200',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0200`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -6719,7 +6720,7 @@ describe('di', () => {
|
||||
'NG0200: Circular dependency detected for `InjectionToken A`. ' +
|
||||
'Source: DynamicTestModule. ' +
|
||||
'Path: InjectionToken A -> InjectionToken B -> InjectionToken A. ' +
|
||||
'Find more at https://angular.dev/errors/NG0200',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0200`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -6737,7 +6738,7 @@ describe('di', () => {
|
||||
expect(() => createInjector(AModule)).toThrowError(
|
||||
'NG0200: Circular dependency detected for `AModule`. ' +
|
||||
'Path: AModule -> BModule -> AModule. ' +
|
||||
'Find more at https://angular.dev/errors/NG0200',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0200`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -6781,7 +6782,7 @@ describe('di', () => {
|
||||
'NG0200: Circular dependency detected for `InjectionToken A`. ' +
|
||||
'Source: DynamicTestModule. ' +
|
||||
'Path: InjectionToken A -> InjectionToken B -> InjectionToken A. ' +
|
||||
'Find more at https://angular.dev/errors/NG0200',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0200`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -6818,7 +6819,7 @@ describe('di', () => {
|
||||
expect(() => TestBed.createComponent(App)).toThrowError(
|
||||
'NG0200: Circular dependency detected for `InjectionToken A`. ' +
|
||||
"Path: App -> ('InjectionToken A':AService) -> ('InjectionToken B':BService) -> ('InjectionToken A':AService). " +
|
||||
'Find more at https://angular.dev/errors/NG0200',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0200`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
InjectionToken,
|
||||
provideAppInitializer,
|
||||
} from '../src/core';
|
||||
import {ERROR_DETAILS_PAGE_BASE_URL} from '../src/error_details_base_url';
|
||||
import {EMPTY, Observable, Subscriber} from 'rxjs';
|
||||
|
||||
import {TestBed} from '../testing';
|
||||
@@ -187,7 +188,7 @@ describe('ApplicationInitStatus', () => {
|
||||
'NG0209: Unexpected type of the `APP_INITIALIZER` token value ' +
|
||||
`(expected an array, but got string). ` +
|
||||
'Please check that the `APP_INITIALIZER` token is configured as a ' +
|
||||
'`multi: true` provider. Find more at https://angular.dev/errors/NG0209',
|
||||
`\`multi: true\` provider. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0209`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
ɵDomRendererFactory2 as DomRendererFactory2,
|
||||
} from '@angular/platform-browser';
|
||||
import type {ServerModule} from '@angular/platform-server';
|
||||
import {ERROR_DETAILS_PAGE_BASE_URL} from '../src/error_details_base_url';
|
||||
import {createTemplate, dispatchEvent, getContent, isNode} from '@angular/private/testing';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {
|
||||
@@ -586,7 +587,7 @@ describe('bootstrap', () => {
|
||||
`NG0403: The module MyModule was bootstrapped, ` +
|
||||
`but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
|
||||
`Please define one of these. ` +
|
||||
`Find more at https://angular.dev/errors/NG0403`;
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0403`;
|
||||
expect(e.message).toEqual(expectedErrMsg);
|
||||
expect(mockConsole.res[0].join('#')).toEqual('ERROR#Error: ' + expectedErrMsg);
|
||||
},
|
||||
|
||||
@@ -7,19 +7,20 @@
|
||||
*/
|
||||
|
||||
import {Injector} from '../../src/core';
|
||||
import {ERROR_DETAILS_PAGE_BASE_URL} from '../../src/error_details_base_url';
|
||||
|
||||
describe('Injector.NULL', () => {
|
||||
it('should throw if no arg is given', () => {
|
||||
expect(() => Injector.NULL.get('someToken')).toThrowError(
|
||||
'NG0201: No provider found for `someToken`. ' +
|
||||
'Find more at https://angular.dev/errors/NG0201',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
});
|
||||
|
||||
it('should throw if THROW_IF_NOT_FOUND is given', () => {
|
||||
expect(() => Injector.NULL.get('someToken', Injector.THROW_IF_NOT_FOUND)).toThrowError(
|
||||
'NG0201: No provider found for `someToken`. ' +
|
||||
'Find more at https://angular.dev/errors/NG0201',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
ɵɵdefineInjector,
|
||||
ɵɵinject,
|
||||
} from '../../src/core';
|
||||
import {ERROR_DETAILS_PAGE_BASE_URL} from '../../src/error_details_base_url';
|
||||
import {createInjector} from '../../src/di/create_injector';
|
||||
import {InternalInjectFlags} from '../../src/di/interface/injector';
|
||||
import {R3Injector} from '../../src/di/r3_injector';
|
||||
@@ -339,7 +340,7 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
expect(() => injector.get(ServiceTwo)).toThrowError(
|
||||
'NG0201: No provider found for `ServiceTwo`. ' +
|
||||
'Source: Module. ' +
|
||||
'Find more at https://angular.dev/errors/NG0201',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -347,7 +348,7 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
const injector = createInjector([ServiceTwo]);
|
||||
expect(() => injector.get(ServiceTwo)).toThrowError(
|
||||
'NG0201: No provider found for `ServiceTwo`. ' +
|
||||
'Find more at https://angular.dev/errors/NG0201',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -357,7 +358,7 @@ describe('InjectorDef-based createInjector()', () => {
|
||||
'NG0201: No provider found for `Service`. ' +
|
||||
'Source: ModuleWithMissingDep. ' +
|
||||
'Path: ServiceWithMissingDep -> Service. ' +
|
||||
'Find more at https://angular.dev/errors/NG0201',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import {forwardRef, Inject, Injector, Self, SkipSelf} from '../../src/core';
|
||||
import {ERROR_DETAILS_PAGE_BASE_URL} from '../../src/error_details_base_url';
|
||||
|
||||
import {stringify} from '../../src/util/stringify';
|
||||
|
||||
@@ -106,7 +107,7 @@ describe('dependency resolution', () => {
|
||||
expect(() => child.get(Car)).toThrowError(
|
||||
'NG0201: No provider found for `Engine`. ' +
|
||||
'Path: Car -> Engine. ' +
|
||||
'Find more at https://angular.dev/errors/NG0201',
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -131,7 +132,8 @@ describe('dependency resolution', () => {
|
||||
it('should throw error when not requested provider on self', () => {
|
||||
const injector = Injector.create({providers: []});
|
||||
expect(() => injector.get(Car, undefined, {self: true})).toThrowError(
|
||||
'NG0201: No provider found for `Car`. ' + 'Find more at https://angular.dev/errors/NG0201',
|
||||
'NG0201: No provider found for `Car`. ' +
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -39,6 +39,7 @@ import {
|
||||
setAllowDuplicateNgModuleIdsForTest,
|
||||
} from '../../src/linker/ng_module_registration';
|
||||
import {stringify} from '../../src/util/stringify';
|
||||
import {ERROR_DETAILS_PAGE_BASE_URL} from '../../src/error_details_base_url';
|
||||
|
||||
class Engine {}
|
||||
|
||||
@@ -625,7 +626,7 @@ describe('NgModule', () => {
|
||||
const errorMsg =
|
||||
'NG0201: No provider found for `SportsCar`. ' +
|
||||
'Source: SomeModule. Path: car -> SportsCar. ' +
|
||||
'Find more at https://angular.dev/errors/NG0201';
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`;
|
||||
expect(() => injector.get('car')).toThrowError(errorMsg);
|
||||
});
|
||||
|
||||
@@ -831,7 +832,7 @@ describe('NgModule', () => {
|
||||
const errorMsg =
|
||||
'NG0201: No provider found for `NonExisting`. ' +
|
||||
'Source: SomeModule. ' +
|
||||
'Find more at https://angular.dev/errors/NG0201';
|
||||
`Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`;
|
||||
expect(() => injector.get('NonExisting')).toThrowError(errorMsg);
|
||||
});
|
||||
|
||||
@@ -839,7 +840,7 @@ describe('NgModule', () => {
|
||||
expect(() =>
|
||||
createInjector([Car, {provide: Engine, useClass: CyclicEngine}]).get(Car),
|
||||
).toThrowError(
|
||||
'NG0200: Circular dependency detected for `Car`. Source: SomeModule. Path: Car -> Engine -> Car. Find more at https://angular.dev/errors/NG0200',
|
||||
`NG0200: Circular dependency detected for \`Car\`. Source: SomeModule. Path: Car -> Engine -> Car. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0200`,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import {
|
||||
} from '../../src/core';
|
||||
import {ComponentFixture, fakeAsync, TestBed} from '../../testing';
|
||||
import {expect} from '@angular/private/testing/matchers';
|
||||
import {ERROR_DETAILS_PAGE_BASE_URL} from '../../src/error_details_base_url';
|
||||
|
||||
@Directive({
|
||||
selector: '[simpleDirective]',
|
||||
@@ -769,7 +770,7 @@ describe('View injector', () => {
|
||||
it('should not instantiate a directive with cyclic dependencies', () => {
|
||||
TestBed.configureTestingModule({declarations: [CycleDirective]});
|
||||
expect(() => createComponent('<div cycleDirective></div>')).toThrowError(
|
||||
'NG0200: Circular dependency detected for `CycleDirective`. Path: CycleDirective -> CycleDirective. Find more at https://angular.dev/errors/NG0200',
|
||||
`NG0200: Circular dependency detected for \`CycleDirective\`. Path: CycleDirective -> CycleDirective. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0200`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -786,7 +787,7 @@ describe('View injector', () => {
|
||||
});
|
||||
|
||||
expect(() => createComponent('<div simpleComponent></div>')).toThrowError(
|
||||
'NG0201: No provider for service found in NodeInjector. Find more at https://angular.dev/errors/NG0201',
|
||||
`NG0201: No provider for service found in NodeInjector. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -808,7 +809,7 @@ describe('View injector', () => {
|
||||
expect(() =>
|
||||
createComponent('<div simpleComponent someOtherDirective></div>'),
|
||||
).toThrowError(
|
||||
'NG0201: No provider for service found in NodeInjector. Find more at https://angular.dev/errors/NG0201',
|
||||
`NG0201: No provider for service found in NodeInjector. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -818,7 +819,7 @@ describe('View injector', () => {
|
||||
expect(() =>
|
||||
createComponent('<div simpleDirective><div needsDirectiveFromSelf></div></div>'),
|
||||
).toThrowError(
|
||||
'NG0201: No provider for SimpleDirective found in NodeInjector. Find more at https://angular.dev/errors/NG0201',
|
||||
`NG0201: No provider for SimpleDirective found in NodeInjector. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -864,7 +865,7 @@ describe('View injector', () => {
|
||||
set: {template: '<div needsDirectiveFromHost></div>'},
|
||||
});
|
||||
expect(() => createComponent('<div simpleComponent simpleDirective></div>')).toThrowError(
|
||||
'NG0201: No provider for SimpleDirective found in NodeInjector. Find more at https://angular.dev/errors/NG0201',
|
||||
`NG0201: No provider for SimpleDirective found in NodeInjector. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import {Component, Directive, Self} from '../../src/core';
|
||||
import {NodeInjectorOffset} from '../../src/render3/interfaces/injector';
|
||||
import {TestBed} from '../../testing';
|
||||
import {ERROR_DETAILS_PAGE_BASE_URL} from '../../src/error_details_base_url';
|
||||
|
||||
import {
|
||||
bloomAdd,
|
||||
@@ -46,7 +47,7 @@ describe('di', () => {
|
||||
expect(() => {
|
||||
TestBed.createComponent(App).detectChanges();
|
||||
}).toThrowError(
|
||||
'NG0201: No provider for DirNotOnSelf found in NodeInjector. Find more at https://angular.dev/errors/NG0201',
|
||||
`NG0201: No provider for DirNotOnSelf found in NodeInjector. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0201`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,11 +7,14 @@
|
||||
*/
|
||||
|
||||
import {RuntimeError, RuntimeErrorCode} from '../src/errors';
|
||||
import {ERROR_DETAILS_PAGE_BASE_URL} from '../src/error_details_base_url';
|
||||
|
||||
describe('RuntimeError utils', () => {
|
||||
it('should correctly format an error without an error message', () => {
|
||||
const error = new RuntimeError<RuntimeErrorCode>(RuntimeErrorCode.EXPORT_NOT_FOUND, '');
|
||||
expect(error.toString()).toBe('Error: NG0301. Find more at https://angular.dev/errors/NG0301');
|
||||
expect(error.toString()).toBe(
|
||||
`Error: NG0301. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0301`,
|
||||
);
|
||||
});
|
||||
|
||||
it('should correctly format an error without an error message not adev guide', () => {
|
||||
@@ -27,7 +30,7 @@ describe('RuntimeError utils', () => {
|
||||
it('should correctly format an error with both an error message and an adev guide', () => {
|
||||
const error = new RuntimeError(RuntimeErrorCode.EXPORT_NOT_FOUND, 'Some error message');
|
||||
expect(error.toString()).toBe(
|
||||
'Error: NG0301: Some error message. Find more at https://angular.dev/errors/NG0301',
|
||||
`Error: NG0301: Some error message. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0301`,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -39,7 +42,7 @@ describe('RuntimeError utils', () => {
|
||||
errorMessage,
|
||||
);
|
||||
expect(error.toString()).toBe(
|
||||
`Error: NG0302: Pipe not found${character} Find more at https://angular.dev/errors/NG0302`,
|
||||
`Error: NG0302: Pipe not found${character} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/NG0302`,
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -229,9 +229,7 @@ describe('Form Directives', () => {
|
||||
dir.name = 'login';
|
||||
|
||||
expect(() => form.addControl(dir)).toThrowError(
|
||||
new RegExp(
|
||||
`NG01203: No value accessor for form control name: 'login'. Find more at https://angular.dev/errors/NG01203`,
|
||||
),
|
||||
/NG01203: No value accessor for form control name: 'login'\. Find more at https:\/\/(?:next\.)?angular\.dev\/errors\/NG01203/,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -242,9 +240,7 @@ describe('Form Directives', () => {
|
||||
dir.name = 'password';
|
||||
|
||||
expect(() => form.addControl(dir)).toThrowError(
|
||||
new RegExp(
|
||||
`NG01203: No value accessor for form control path: 'passwords -> password'. Find more at https://angular.dev/errors/NG01203`,
|
||||
),
|
||||
/NG01203: No value accessor for form control path: 'passwords -> password'\. Find more at https:\/\/(?:next\.)?angular\.dev\/errors\/NG01203/,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -668,9 +664,7 @@ describe('Form Directives', () => {
|
||||
namedDir.name = 'one';
|
||||
|
||||
expect(() => namedDir.ngOnChanges({})).toThrowError(
|
||||
new RegExp(
|
||||
`NG01203: No value accessor for form control name: 'one'. Find more at https://angular.dev/errors/NG01203`,
|
||||
),
|
||||
/NG01203: No value accessor for form control name: 'one'\. Find more at https:\/\/(?:next\.)?angular\.dev\/errors\/NG01203/,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -678,9 +672,7 @@ describe('Form Directives', () => {
|
||||
const unnamedDir = new NgModel(null!, null!, null!, null!);
|
||||
|
||||
expect(() => unnamedDir.ngOnChanges({})).toThrowError(
|
||||
new RegExp(
|
||||
`NG01203: No value accessor for form control unspecified name attribute. Find more at https://angular.dev/errors/NG01203`,
|
||||
),
|
||||
/NG01203: No value accessor for form control unspecified name attribute\. Find more at https:\/\/(?:next\.)?angular\.dev\/errors\/NG01203/,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1538,9 +1538,7 @@ import {asyncValidator, asyncValidatorReturningObservable} from './util';
|
||||
// but
|
||||
// not a meaningful one
|
||||
expect(fn).toThrowError(
|
||||
'NG01101: Expected async validator to return Promise or Observable. ' +
|
||||
'Are you using a synchronous validator where an async validator is expected? ' +
|
||||
'Find more at https://angular.dev/errors/NG01101',
|
||||
/NG01101: Expected async validator to return Promise or Observable\. Are you using a synchronous validator where an async validator is expected\? Find more at https:\/\/(?:next\.)?angular\.dev\/errors\/NG01101/,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -6042,7 +6042,7 @@ describe('reactive forms integration tests', () => {
|
||||
expect(() => {
|
||||
fixture.detectChanges();
|
||||
}).toThrowError(
|
||||
`NG01203: No value accessor for form control name: 'control'. Find more at https://angular.dev/errors/NG01203`,
|
||||
/NG01203: No value accessor for form control name: 'control'\. Find more at https:\/\/(?:next\.)?angular\.dev\/errors\/NG01203/,
|
||||
);
|
||||
|
||||
// Making sure that cleanup between tests doesn't cause any issues
|
||||
|
||||
@@ -130,11 +130,8 @@ describe('bootstrapApplication for standalone components', () => {
|
||||
fail('Expected to throw');
|
||||
} catch (e: unknown) {
|
||||
expect(e).toBeInstanceOf(Error);
|
||||
expect((e as Error).message).toContain(
|
||||
'NG0201: No provider found for `InjectionToken ambient token`. ' +
|
||||
'Source: Standalone[StandaloneCmp]. ' +
|
||||
'Path: NeedsAmbientProvider -> InjectionToken ambient token. ' +
|
||||
'Find more at https://angular.dev/errors/NG0201',
|
||||
expect((e as Error).message).toMatch(
|
||||
/NG0201: No provider found for `InjectionToken ambient token`\. Source: Standalone\[StandaloneCmp\]\. Path: NeedsAmbientProvider -> InjectionToken ambient token\. Find more at https:\/\/(?:next\.)?angular\.dev\/errors\/NG0201/,
|
||||
);
|
||||
}
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user