-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(babel-plugin-export-metadata): just define pro non-primitive types
- Loading branch information
1 parent
37b73c6
commit ed78a13
Showing
3 changed files
with
133 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
other-packages/babel-plugin-export-metadata/tests/__snapshots__/index.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`works 1`] = ` | ||
"const foo = () => 'foo'; | ||
export const bar = () => 'bar'; | ||
if (bar === Object(bar)) { | ||
Object.defineProperty(bar, '__filemeta', { | ||
writable: false, | ||
value: { | ||
name: \\"bar\\", | ||
filename: \\"/Volumes/Projects/dev/docz/docz/other-packages/babel-plugin-export-metadata/tests/fixtures/example.js\\" | ||
} | ||
}); | ||
} | ||
if (bar === Object(bar)) { | ||
Object.defineProperty(bar, '__filemeta', { | ||
writable: false, | ||
value: { | ||
name: \\"bar\\", | ||
filename: \\"/Volumes/Projects/dev/docz/docz/other-packages/babel-plugin-export-metadata/tests/fixtures/example.js\\" | ||
} | ||
}); | ||
} | ||
const obj = { | ||
foo: () => 'foo' | ||
/** | ||
* Some description | ||
*/ | ||
}; | ||
function get(object, path) { | ||
return object[path]; | ||
} | ||
export function getOther(object, path) { | ||
return object[path]; | ||
} | ||
if (getOther === Object(getOther)) { | ||
Object.defineProperty(getOther, '__filemeta', { | ||
writable: false, | ||
value: { | ||
name: \\"getOther\\", | ||
filename: \\"/Volumes/Projects/dev/docz/docz/other-packages/babel-plugin-export-metadata/tests/fixtures/example.js\\" | ||
} | ||
}); | ||
} | ||
const obj2 = { | ||
get: () => null | ||
/** | ||
* Some description | ||
*/ | ||
}; | ||
class Abc { | ||
/** | ||
* Some description | ||
*/ | ||
method() { | ||
return null; | ||
} | ||
} | ||
export const component = styled.div\` | ||
background: red; | ||
\`; | ||
if (component === Object(component)) { | ||
Object.defineProperty(component, '__filemeta', { | ||
writable: false, | ||
value: { | ||
name: \\"component\\", | ||
filename: \\"/Volumes/Projects/dev/docz/docz/other-packages/babel-plugin-export-metadata/tests/fixtures/example.js\\" | ||
} | ||
}); | ||
} | ||
export class Abcd { | ||
/** | ||
* Some description | ||
*/ | ||
method() { | ||
return null; | ||
} | ||
} | ||
if (Abcd === Object(Abcd)) { | ||
Object.defineProperty(Abcd, '__filemeta', { | ||
writable: false, | ||
value: { | ||
name: \\"Abcd\\", | ||
filename: \\"/Volumes/Projects/dev/docz/docz/other-packages/babel-plugin-export-metadata/tests/fixtures/example.js\\" | ||
} | ||
}); | ||
} | ||
const obj3 = { | ||
method: class Abcd { | ||
method() { | ||
return null; | ||
} | ||
} | ||
}; | ||
const log = fn => fn(1); | ||
log(id => console.log(id)); | ||
export default (() => 'other');" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters