Skip to content

Commit

Permalink
add async test
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Mar 14, 2021
1 parent d052f81 commit 809380d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/babel-jest/src/__tests__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jest.mock('../loadBabelConfig', () => {

return {
loadPartialConfig: jest.fn((...args) => actual.loadPartialConfig(...args)),
loadPartialConfigAsync: jest.fn((...args) =>
actual.loadPartialConfigAsync(...args),
),
};
});

Expand Down Expand Up @@ -49,6 +52,25 @@ test('Returns source string with inline maps when no transformOptions is passed'
expect(JSON.stringify(result.map!.sourcesContent)).toMatch('customMultiply');
});

test('Returns source string with inline maps when no transformOptions is passed async', async () => {
const result: any = await babelJest.processAsync!(
sourceString,
'dummy_path.js',
{
config: makeProjectConfig(),
configString: JSON.stringify(makeProjectConfig()),
instrument: false,
},
);
expect(typeof result).toBe('object');
expect(result.code).toBeDefined();
expect(result.map).toBeDefined();
expect(result.code).toMatch('//# sourceMappingURL');
expect(result.code).toMatch('customMultiply');
expect(result.map!.sources).toEqual(['dummy_path.js']);
expect(JSON.stringify(result.map!.sourcesContent)).toMatch('customMultiply');
});

describe('caller option correctly merges from defaults and options', () => {
test.each([
[
Expand Down

0 comments on commit 809380d

Please sign in to comment.