@open-mercato/channel-gmail 0.7.1-develop.7173.1.a901520d0f → 0.7.1-develop.7175.1.d49ab48ee2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/jest.config.cjs CHANGED
@@ -6,6 +6,7 @@ module.exports = {
6
6
  testEnvironment: 'node',
7
7
  watchman: false,
8
8
  rootDir: '.',
9
+ setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
9
10
  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
10
11
  moduleNameMapper: {
11
12
  '^@open-mercato/channel-gmail/(.*)$': '<rootDir>/src/$1',
package/jest.setup.ts ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Warm the lazy `mailparser` import before any test body runs (#6040).
3
+ *
4
+ * `normalizeInboundGmailMessage` resolves `mailparser` lazily, inside the
5
+ * function, so the whole cold module-graph load is charged to whichever test
6
+ * first reaches it — against jest's default 5000 ms per-test budget. On a
7
+ * contended CI runner that load alone approaches the timeout, which made the
8
+ * first MIME-parsing test in a file fail intermittently while every sibling
9
+ * passed.
10
+ *
11
+ * Paying the load in a root `beforeAll` with an explicit, generous hook budget
12
+ * removes it from every test's budget without raising `testTimeout`, so a
13
+ * genuinely slow adapter regression still trips the 5000 ms default.
14
+ *
15
+ * Wired package-wide rather than per test file because it measures free — full
16
+ * suite 1.04 s → 1.01 s, i.e. noise, since suites run on two workers and the
17
+ * loads overlap — and it covers every future test file without anyone having
18
+ * to remember the hook.
19
+ */
20
+ beforeAll(async () => {
21
+ await import('mailparser')
22
+ }, 60_000)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/channel-gmail",
3
- "version": "0.7.1-develop.7173.1.a901520d0f",
3
+ "version": "0.7.1-develop.7175.1.d49ab48ee2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -62,19 +62,19 @@
62
62
  }
63
63
  },
64
64
  "dependencies": {
65
- "@open-mercato/core": "0.7.1-develop.7173.1.a901520d0f",
66
- "@open-mercato/ui": "0.7.1-develop.7173.1.a901520d0f",
65
+ "@open-mercato/core": "0.7.1-develop.7175.1.d49ab48ee2",
66
+ "@open-mercato/ui": "0.7.1-develop.7175.1.d49ab48ee2",
67
67
  "@types/mailparser": "^3.4.5",
68
68
  "mailparser": "^3.9.17"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@mikro-orm/postgresql": "^7.0.14",
72
- "@open-mercato/shared": "0.7.1-develop.7173.1.a901520d0f",
72
+ "@open-mercato/shared": "0.7.1-develop.7175.1.d49ab48ee2",
73
73
  "react": "^19.0.0",
74
74
  "react-dom": "^19.0.0"
75
75
  },
76
76
  "devDependencies": {
77
- "@open-mercato/shared": "0.7.1-develop.7173.1.a901520d0f",
77
+ "@open-mercato/shared": "0.7.1-develop.7175.1.d49ab48ee2",
78
78
  "@types/jest": "^30.0.0",
79
79
  "@types/react": "^19.2.18",
80
80
  "@types/react-dom": "^19.2.5",
@@ -0,0 +1,25 @@
1
+ /**
2
+ * mailparser warm-up guard (#6040).
3
+ *
4
+ * `normalizeInboundGmailMessage` resolves `mailparser` lazily, inside the
5
+ * function. Without the root warm-up in `jest.setup.ts` the cold module-graph
6
+ * load therefore lands inside whichever test first parses a MIME message, and
7
+ * competes with jest's default 5000 ms per-test budget — which is what made
8
+ * three tests fail intermittently on CI while every sibling passed.
9
+ *
10
+ * Jest gives every test file its own module registry, and `require.cache`
11
+ * reflects that registry. This file imports nothing, so an entry for
12
+ * `mailparser` can only have been put there by the warm-up — making it a direct
13
+ * observation of the property the flaky tests depend on, rather than a timing
14
+ * assertion that would itself be flaky.
15
+ *
16
+ * Note this reads the CommonJS registry, which is what ts-jest's transform
17
+ * produces today. Should that ever emit native ESM dynamic imports, the
18
+ * warm-up would still work but this assertion would need rewriting — it fails
19
+ * closed, so the breakage is loud rather than silent.
20
+ */
21
+ describe('mailparser warm-up', () => {
22
+ it('resolves mailparser before any test body runs', () => {
23
+ expect(require.cache[require.resolve('mailparser')]).toBeDefined()
24
+ })
25
+ })