Skip to content

Commit 5b99d50

Browse files
author
Christoph Bühler
committed
test(snapshots): fix broken tests
1 parent 5ea04e4 commit 5b99d50

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

test/TypescriptParser.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,19 @@ describe('TypescriptParser', () => {
109109

110110
it('should parse export assignment', () => {
111111
expect(parsed.exports[2]).toBeInstanceOf(AssignedExport);
112+
113+
delete (parsed.exports[2] as any).resource.filePath;
114+
delete (parsed.exports[2] as any).resource.rootPath;
115+
112116
expect(parsed.exports[2]).toMatchSnapshot();
113117
});
114118

115119
it('should parse default export', () => {
116120
expect(parsed.declarations[0]).toBeInstanceOf(DefaultDeclaration);
121+
122+
delete (parsed.declarations[0] as any).resource.filePath;
123+
delete (parsed.declarations[0] as any).resource.rootPath;
124+
117125
expect(parsed.declarations[0]).toMatchSnapshot();
118126
});
119127

test/__snapshots__/TypescriptParser.spec.ts.snap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,8 @@ DefaultDeclaration {
643643
"start": 92,
644644
},
645645
],
646-
"filePath": "/Users/christoph/Documents/Development/node-typescript-parser/test/_workspace/typescript-parser/exportsOnly.ts",
647646
"imports": Array [],
648647
"resources": Array [],
649-
"rootPath": "/Users/christoph/Documents/Development/node-typescript-parser/test/_workspace",
650648
"start": 0,
651649
"usages": Array [
652650
"Foo",
@@ -702,10 +700,8 @@ AssignedExport {
702700
},
703701
[Circular],
704702
],
705-
"filePath": "/Users/christoph/Documents/Development/node-typescript-parser/test/_workspace/typescript-parser/exportsOnly.ts",
706703
"imports": Array [],
707704
"resources": Array [],
708-
"rootPath": "/Users/christoph/Documents/Development/node-typescript-parser/test/_workspace",
709705
"start": 0,
710706
"usages": Array [
711707
"Foo",

test/declaration-index/DeclarationIndex.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,12 @@ describe('DeclarationIndex', () => {
7474
it('should contain a declaration from a *.tsx file', () => {
7575
const idx: any = declarationIndex;
7676
const resources = Object.assign(Object.create(null), idx.parsedResources);
77-
78-
expect(resources['/myReactTemplate']).toMatchSnapshot();
77+
const resource = resources['/myReactTemplate'];
78+
79+
delete resource.filePath;
80+
delete resource.rootPath;
81+
82+
expect(resource).toMatchSnapshot();
7983
});
8084

8185
});

test/declaration-index/__snapshots__/DeclarationIndex.spec.ts.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ File {
1414
],
1515
"end": 125,
1616
"exports": Array [],
17-
"filePath": "/Users/christoph/Documents/Development/node-typescript-parser/test/_workspace/declaration-index/myReactTemplate.tsx",
1817
"imports": Array [
1918
NamespaceImport {
2019
"alias": "React",
@@ -24,7 +23,6 @@ File {
2423
},
2524
],
2625
"resources": Array [],
27-
"rootPath": "/Users/christoph/Documents/Development/node-typescript-parser/test/_workspace/declaration-index",
2826
"start": 0,
2927
"usages": Array [
3028
"myComponent",

0 commit comments

Comments
 (0)