Skip to content

Commit

Permalink
Fixup unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Mar 1, 2023
1 parent 5ad82aa commit 4b47954
Showing 1 changed file with 43 additions and 46 deletions.
89 changes: 43 additions & 46 deletions packages/core/core/test/SymbolPropagation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ function changeAsset(
n => n.type === 'asset' && n.value.filePath === asset,
),
);
node.usedSymbolsUpDirty = true;
node.usedSymbolsDownDirty = true;
cb(nullthrows(node.value.symbols));
return [[node.id, node.value]];
Expand Down Expand Up @@ -508,52 +509,48 @@ describe('SymbolPropagation', () => {
]);
});

// it('basic tree - asset symbol change export and error', async () => {
// // prettier-ignore
// let graph = await testPropagation(
// [
// ['/index.js', [], true, []],
// ['/lib.js', [['f', {local: 'f'}]], true, ['f']],
// ],
// [
// ['/index.js', '/lib.js', [['f', {local: 'f', isWeak: false}]], [['f']]],
// ],
// );

// let changedAssets = [
// ...changeAsset(graph, 'lib.js', symbols => {
// symbols.delete('f');
// symbols.set('f2', {
// local: 'f2',
// loc: undefined,
// });
// }),
// ];

// console.log('----');

// await dumpGraphToGraphViz(graph, '2');
// let errors = propagateSymbols({
// options: DEFAULT_OPTIONS,
// assetGraph: graph,
// changedAssetsPropagation: new Set(new Map(changedAssets).keys()),
// assetGroupsWithRemovedParents: new Set(),
// });
// await dumpGraphToGraphViz(graph, '3');

// assertPropagationErrors(graph, errors, [
// [
// 'lib.js',
// [
// {
// message: "lib.js does not export 'f2'",
// origin: '@parcel/core',
// codeFrames: undefined,
// },
// ],
// ],
// ]);
// });
it('basic tree - asset symbol change export and error', async () => {
// prettier-ignore
let graph = await testPropagation(
[
['/index.js', [], true, []],
['/lib.js', [['f', {local: 'f'}]], true, ['f']],
],
[
['/index.js', '/lib.js', [['f', {local: 'f', isWeak: false}]], [['f']]],
],
);

let changedAssets = [
...changeAsset(graph, 'lib.js', symbols => {
symbols.delete('f');
symbols.set('f2', {
local: 'f2',
loc: undefined,
});
}),
];

let errors = propagateSymbols({
options: DEFAULT_OPTIONS,
assetGraph: graph,
changedAssetsPropagation: new Set(new Map(changedAssets).keys()),
assetGroupsWithRemovedParents: new Set(),
});

assertPropagationErrors(graph, errors, [
[
'lib.js',
[
{
message: "lib.js does not export 'f'",
origin: '@parcel/core',
codeFrames: undefined,
},
],
],
]);
});

it('basic tree - dependency symbol change reexport', async () => {
// prettier-ignore
Expand Down

0 comments on commit 4b47954

Please sign in to comment.