Skip to content

Commit

Permalink
add test for disabline JSON wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Jun 23, 2021
1 parent a42d64a commit 57230a9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/metro-transform-worker/src/__tests__/index-test.js
Expand Up @@ -379,6 +379,24 @@ it('minifies a JSON file', async () => {
);
});

it('does not wrap a JSON file when disableModuleWrapping is enabled', async () => {
expect(
(
await Transformer.transform(
baseConfig,
'/root',
'local/file.json',
'arbitrary(code);',
{
dev: true,
unstable_disableModuleWrapping: true,
type: 'module',
},
)
).output[0].data.code,
).toBe('module.exports = arbitrary(code);;');
});

it('transforms a script to JS source and bytecode', async () => {
const result = await Transformer.transform(
baseConfig,
Expand Down

0 comments on commit 57230a9

Please sign in to comment.