Compare commits
2 Commits
a9505ca5b2
...
7f960b026b
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f960b026b | |||
| 992d2b83b3 |
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import { test } from 'node:test';
|
import { test } from 'node:test';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import { EventStatus, MatrixEvent, RelationType } from 'matrix-js-sdk';
|
import { EventStatus, MatrixEvent, RelationType } from 'matrix-js-sdk';
|
||||||
import { getThreadSummary, isPendingThreadReply } from './threadSummary';
|
import { getThreadSummary, isPendingThreadReply } from './threadSummaryData';
|
||||||
|
|
||||||
// getThreadSummary reads either the live Thread (preferred) or the
|
// getThreadSummary reads either the live Thread (preferred) or the
|
||||||
// server-aggregated `m.thread` bundle. We stub only the members it touches and
|
// server-aggregated `m.thread` bundle. We stub only the members it touches and
|
||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
ThreadEvent,
|
ThreadEvent,
|
||||||
} from 'matrix-js-sdk';
|
} from 'matrix-js-sdk';
|
||||||
import { getLinkedTimelines } from '../RoomTimeline';
|
import { getLinkedTimelines } from '../RoomTimeline';
|
||||||
import { isPendingThreadReply } from './threadSummary';
|
import { isPendingThreadReply } from './threadSummaryData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve (or bootstrap) the live {@link Thread} for a root event.
|
* Resolve (or bootstrap) the live {@link Thread} for a root event.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
RoomEventHandlerMap,
|
RoomEventHandlerMap,
|
||||||
ThreadEvent,
|
ThreadEvent,
|
||||||
} from 'matrix-js-sdk';
|
} from 'matrix-js-sdk';
|
||||||
import { getThreadSummary, ThreadSummaryData } from '../features/room/thread/threadSummary';
|
import { getThreadSummary, ThreadSummaryData } from '../features/room/thread/threadSummaryData';
|
||||||
import { threadNotificationsAtom } from '../state/threadNotifications';
|
import { threadNotificationsAtom } from '../state/threadNotifications';
|
||||||
import { getThreadNotificationMode, ThreadNotificationMode } from '../utils/threadNotifications';
|
import { getThreadNotificationMode, ThreadNotificationMode } from '../utils/threadNotifications';
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import { strict as assert } from 'node:assert';
|
||||||
|
import { test } from 'node:test';
|
||||||
|
import { readdirSync } from 'node:fs';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Guard against same-directory filenames that differ only by case (e.g.
|
||||||
|
* `threadSummary.ts` vs `ThreadSummary.tsx`). On case-insensitive filesystems
|
||||||
|
* (the Windows release runner) an extensionless import of one can resolve to
|
||||||
|
* the OTHER file — rolldown tries `.ts` before `.tsx` — producing
|
||||||
|
* MISSING_EXPORT failures that never reproduce on the Linux/macOS machines the
|
||||||
|
* project is developed and web-deployed on. This broke the desktop release
|
||||||
|
* build twice before being diagnosed; this test makes the collision a local,
|
||||||
|
* immediate failure instead.
|
||||||
|
*/
|
||||||
|
const findCaseCollisions = (dir: string, collisions: string[]): void => {
|
||||||
|
const entries = readdirSync(dir, { withFileTypes: true });
|
||||||
|
const seen = new Map<string, string>();
|
||||||
|
entries.forEach((entry) => {
|
||||||
|
// Compare basenames without extension: `Foo.tsx` collides with `foo.ts`
|
||||||
|
// because module resolution is extensionless.
|
||||||
|
const stem = entry.isDirectory() ? entry.name : entry.name.replace(/\.[^.]+$/, '');
|
||||||
|
const key = stem.toLowerCase();
|
||||||
|
const existing = seen.get(key);
|
||||||
|
if (existing !== undefined && existing !== stem) {
|
||||||
|
collisions.push(`${dir}: "${existing}" vs "${stem}"`);
|
||||||
|
}
|
||||||
|
if (existing === undefined) seen.set(key, stem);
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
findCaseCollisions(join(dir, entry.name), collisions);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
test('no same-directory filenames differing only by case under src/', () => {
|
||||||
|
const collisions: string[] = [];
|
||||||
|
findCaseCollisions('src', collisions);
|
||||||
|
assert.deepEqual(
|
||||||
|
collisions,
|
||||||
|
[],
|
||||||
|
`Case-colliding names break Windows builds:\n${collisions.join('\n')}`,
|
||||||
|
);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user