• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nestjs / nest / e1a120dc-6519-4c6a-a074-de38a9ffd346

14 Feb 2025 09:25PM UTC coverage: 27.513% (-61.8%) from 89.294%
e1a120dc-6519-4c6a-a074-de38a9ffd346

Pull #14640

circleci

luddwichr
fix(platform-express) respect existing parser middlewares when using Express 5

Express 5 made the router public API again and renamed the field from app._router to app.router.
This broke the detection mechanism whether a middleware named "jsonParser" or "urlencodedParser"
is already registered or not.
Unfortunately, https://github.com/nestjs/nest/pull/14574/ only fixed the issue partially.
This commit now uses app.router everywhere.
To avoid future regressions a test was added to verify the expected behavior.
Pull Request #14640: fix(platform-express) respect custom parser middlewares in Express 5

250 of 3354 branches covered (7.45%)

2201 of 8000 relevant lines covered (27.51%)

0.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/packages/common/utils/shared.utils.ts
1
export const isUndefined = (obj: any): obj is undefined =>
1✔
2
  typeof obj === 'undefined';
102✔
3

4
export const isObject = (fn: any): fn is object =>
1✔
5
  !isNil(fn) && typeof fn === 'object';
21✔
6

7
export const isPlainObject = (fn: any): fn is object => {
1✔
8
  if (!isObject(fn)) {
×
9
    return false;
×
10
  }
11
  const proto = Object.getPrototypeOf(fn);
×
12
  if (proto === null) {
×
13
    return true;
×
14
  }
15
  const ctor =
16
    Object.prototype.hasOwnProperty.call(proto, 'constructor') &&
×
17
    proto.constructor;
18
  return (
×
19
    typeof ctor === 'function' &&
×
20
    ctor instanceof ctor &&
21
    Function.prototype.toString.call(ctor) ===
22
      Function.prototype.toString.call(Object)
23
  );
24
};
25

26
export const addLeadingSlash = (path?: string): string =>
1✔
27
  path && typeof path === 'string'
2✔
28
    ? path.charAt(0) !== '/' && path.substring(0, 2) !== '{/'
4!
29
      ? '/' + path
2!
30
      : path
31
    : '';
32

33
export const normalizePath = (path?: string): string =>
1✔
34
  path
×
35
    ? path.startsWith('/')
×
36
      ? ('/' + path.replace(/\/+$/, '')).replace(/\/+/g, '/')
×
37
      : '/' + path.replace(/\/+$/, '')
38
    : '/';
39

40
export const stripEndSlash = (path: string) =>
1✔
41
  path[path.length - 1] === '/' ? path.slice(0, path.length - 1) : path;
×
42

43
export const isFunction = (val: any): val is Function =>
1✔
44
  typeof val === 'function';
62✔
45
export const isString = (val: any): val is string => typeof val === 'string';
52✔
46
export const isNumber = (val: any): val is number => typeof val === 'number';
28✔
47
export const isConstructor = (val: any): boolean => val === 'constructor';
1✔
48
export const isNil = (val: any): val is null | undefined =>
1✔
49
  isUndefined(val) || val === null;
50✔
50
export const isEmpty = (array: any): boolean => !(array && array.length > 0);
1!
51
export const isSymbol = (val: any): val is symbol => typeof val === 'symbol';
13✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc