Skip to content

Commit

Permalink
sourcemap can be a string
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Feb 12, 2019
1 parent 38bb80f commit b427780
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
6 changes: 4 additions & 2 deletions packages/babel-jest/src/__tests__/index.ts
Expand Up @@ -36,6 +36,8 @@ test(`Returns source string with inline maps when no transformOptions is passed`
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');
// @ts-ignore: it's fine if we get wrong types, the tests will fail then
expect(result.map.sources).toEqual(['dummy_path.js']);
// @ts-ignore: it's fine if we get wrong types, the tests will fail then
expect(JSON.stringify(result.map.sourcesContent)).toMatch('customMultiply');
});
22 changes: 12 additions & 10 deletions packages/jest-types/src/Transform.ts
Expand Up @@ -10,16 +10,18 @@ import {Path, ProjectConfig} from './Config';

export type TransformedSource = {
code: string;
map?: // copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/363cdf403a74e0372e87bbcd15eb1668f4c5230b/types/babel__core/index.d.ts#L371-L379
{
version: number;
sources: string[];
names: string[];
sourceRoot?: string;
sourcesContent?: string[];
mappings: string;
file: string;
} | null;
map?: // copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/363cdf403a74e0372e87bbcd15eb1668f4c5230b/types/babel__core/index.d.ts#L371-L379
| {
version: number;
sources: string[];
names: string[];
sourceRoot?: string;
sourcesContent?: string[];
mappings: string;
file: string;
}
| string
| null;
};

export type TransformResult = {
Expand Down

0 comments on commit b427780

Please sign in to comment.