ignore href in integration test to avoid fail when code changed

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent c30cc04548
commit 3cfe0c56b8
4 changed files with 23 additions and 2333 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

16
test/html/t.html Normal file
View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
<script id="_code">
const s = document.querySelector('#_code');
eval(`window.d = 123`);
document.body.removeChild(s);
</script>
</body>
</html>

View File

@@ -6,11 +6,7 @@ import * as rollup from 'rollup';
import typescript = require('rollup-plugin-typescript');
import resolve = require('rollup-plugin-node-resolve');
import { SnapshotState, toMatchSnapshot } from 'jest-snapshot';
import {
incrementalSnapshotEvent,
EventType,
IncrementalSource,
} from '../src/types';
import { EventType, IncrementalSource, eventWithTime } from '../src/types';
import { NodeType } from 'rrweb-snapshot';
function matchSnapshot(actual: string, testFile: string, testTitle: string) {
@@ -32,7 +28,7 @@ function matchSnapshot(actual: string, testFile: string, testTitle: string) {
* So we only do snapshot test with filtered events.
* @param snapshots incrementalSnapshotEvent[]
*/
function stringifySnapshots(snapshots: incrementalSnapshotEvent[]): string {
function stringifySnapshots(snapshots: eventWithTime[]): string {
return JSON.stringify(
snapshots
.filter(s => {
@@ -44,8 +40,11 @@ function stringifySnapshots(snapshots: incrementalSnapshotEvent[]): string {
}
return true;
})
// FIXME: travis coordinates seems different with my laptop
.map(s => {
if (s.type === EventType.Meta) {
s.data.href = 'about:blank';
}
// FIXME: travis coordinates seems different with my laptop
const coordinatesReg = /(bottom|top|left|right)/;
if (
s.type === EventType.IncrementalSnapshot &&