|
| 1 | +const fs = __non_webpack_require__('fs'); |
| 2 | +const path = __non_webpack_require__('path'); |
| 3 | + |
| 4 | +const statsPath = path.join(__dirname, 'mf-stats.json'); |
| 5 | +const manifestPath = path.join(__dirname, 'mf-manifest.json'); |
| 6 | + |
| 7 | +const stats = JSON.parse(fs.readFileSync(statsPath, 'utf-8')); |
| 8 | +const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8')); |
| 9 | + |
| 10 | +it('should still emit the remote entry', () => { |
| 11 | + const remoteEntryFile = stats.metaData.remoteEntry.name; |
| 12 | + const remoteEntryPath = path.join(__dirname, remoteEntryFile); |
| 13 | + expect(fs.existsSync(remoteEntryPath)).toBe(true); |
| 14 | +}); |
| 15 | + |
| 16 | +it('should omit asset details from stats when disableAssetsAnalyze is true', () => { |
| 17 | + expect(stats.shared).toHaveLength(1); |
| 18 | + expect(stats.shared[0].assets.js.sync).toEqual([]); |
| 19 | + expect(stats.shared[0].assets.js.async).toEqual([]); |
| 20 | + expect(stats.exposes).toHaveLength(1); |
| 21 | + expect(stats.exposes[0].assets.js.sync).toEqual([]); |
| 22 | + expect(stats.exposes[0].assets.js.async).toEqual([]); |
| 23 | +}); |
| 24 | + |
| 25 | +it('should omit asset details from manifest when disableAssetsAnalyze is true', () => { |
| 26 | + expect(manifest.shared).toHaveLength(1); |
| 27 | + expect(manifest.shared[0].assets.js.sync).toEqual([]); |
| 28 | + expect(manifest.shared[0].assets.js.async).toEqual([]); |
| 29 | + expect(manifest.exposes).toHaveLength(1); |
| 30 | + expect(manifest.exposes[0].assets.js.sync).toEqual([]); |
| 31 | + expect(manifest.exposes[0].assets.js.async).toEqual([]); |
| 32 | +}); |
| 33 | + |
| 34 | +it('should mark remote usage locations as UNKNOWN', () => { |
| 35 | + expect(stats.remotes).toEqual( |
| 36 | + expect.arrayContaining([ |
| 37 | + expect.objectContaining({ |
| 38 | + usedIn: ['UNKNOWN'], |
| 39 | + }), |
| 40 | + ]), |
| 41 | + ); |
| 42 | +}); |
0 commit comments