Skip to content

Commit be107d2

Browse files
committed
wip
1 parent 194d112 commit be107d2

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

.github/workflows/node.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,12 @@ jobs:
7272
fail-fast: false
7373
matrix:
7474
node-version:
75+
- '25'
76+
- '22'
7577
- '18'
7678
- '4'
7779
react:
80+
- '17'
7881
- '16.14'
7982
- '16.13'
8083
- '16.12'

packages/enzyme-test-suite/test/shared/lifecycles/componentDidCatch.jsx

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React from 'react';
22
import sinon from 'sinon-sandbox';
33
import { expect } from 'chai';
44

5+
import path from 'path';
6+
57
import { is } from '../../_helpers/version';
68
import {
79
describeIf,
@@ -251,23 +253,32 @@ export default function describeCDC({
251253
if (is('>= 17')) {
252254
expect(info).to.have.property('componentStack');
253255
expect(info.componentStack).to.match(/at Thrower (.+)\n/);
254-
}
255-
// else {
256-
var FILE_PATH = __filename.replace(/^.*?(\/build)/, '$1');
257-
var inStr = is('>= 17') ? 'at' : 'in';
258-
info.componentStack = info.componentStack.replace(/^.*?(\/build)/, '$1');
259-
info.componentStack = info.componentStack.replace(/at/g, inStr);
256+
}
257+
const FILE_PATH = __filename;
258+
const MOUNT_WRAPPER_PATH = path.join(
259+
FILE_PATH,
260+
'../../../../../enzyme-adapter-utils/build/createMountWrapper.js',
261+
);
262+
info.componentStack = info.componentStack
263+
.replace(/^.*?(\/build)/, '$1')
264+
.replace(/([^(]+\/[^:]+):\d+:\d+/gm, '$1:$LINE:$COL');
260265
expect(info).to.deep.equal({
261-
componentStack: `
262-
${inStr} Thrower (${FILE_PATH})
263-
${inStr} span (${FILE_PATH})${hasFragments ? '' : `
264-
in main (${FILE_PATH})`}
265-
${inStr} div (${FILE_PATH})
266-
${inStr} ErrorBoundary (created by ErrorSFC)
267-
${inStr} ErrorSFC (created by WrapperComponent)
268-
${inStr} WrapperComponent`,
266+
componentStack: is('>= 17')
267+
? `
268+
at Thrower (${__filename}:$LINE:$COL)
269+
at span
270+
at div
271+
at ErrorBoundary (${FILE_PATH}:$LINE:$COL)
272+
at ErrorSFC
273+
at WrapperComponent (${MOUNT_WRAPPER_PATH}:$LINE:$COL)`
274+
: `
275+
in Thrower (${__filename}:$LINE:$COL
276+
in span (created by ErrorBoundary)
277+
in div (created by ErrorBoundary)
278+
in ErrorBoundary (created by ErrorSFC)
279+
in ErrorSFC (created by WrapperComponent)
280+
in WrapperComponent:$LINE:$COL`,
269281
});
270-
// }
271282
});
272283
});
273284
});

0 commit comments

Comments
 (0)