Skip to content

Commit

Permalink
Add es5 build of pretty-format
Browse files Browse the repository at this point in the history
  • Loading branch information
skovhus committed Jul 19, 2017
1 parent 45ceff8 commit 876ddd6
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 17 deletions.
5 changes: 5 additions & 0 deletions integration_tests/browser-support/browser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* eslint-disable */
var expect = require('../../packages/jest-matchers/build-es5/index.js');
var mock = require('../../packages/jest-mock/build-es5/index.js');
var prettyFormat = require('../../packages/pretty-format/build-es5/index.js');

describe('es5 builds in browser', function() {
it('runs assertions', function() {
Expand All @@ -21,4 +22,8 @@ describe('es5 builds in browser', function() {
someMockFunction();
expect(someMockFunction).toHaveBeenCalledTimes(1);
});

it('pretty formats a string', function() {
expect(prettyFormat('obj')).toBe('"obj"');
});
});
1 change: 1 addition & 0 deletions packages/pretty-format/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"license": "BSD-3-Clause",
"description": "Stringify any JavaScript value.",
"main": "build/index.js",
"browser": "build-es5/index.js",
"author": "James Kyle <me@thejameskyle.com>",
"dependencies": {
"ansi-regex": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/asymmetric_matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ const print = (

const test = (object: any) => object && object.$$typeof === asymmetricMatcher;

module.exports = ({print, test}: Plugin);
export default ({print, test}: Plugin);
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/convert_ansi.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ const print = (
colors: Colors,
) => print(toHumanReadableAnsi(val));

module.exports = ({print, test}: Plugin);
export default ({print, test}: Plugin);
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/html_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,4 @@ const print = (
return result;
};

module.exports = ({print, test}: Plugin);
export default ({print, test}: Plugin);
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/immutable_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ const print = (
colors: Colors,
) => printImmutable(val, print, indent, opts, colors, 'List', false);

module.exports = ({print, test}: Plugin);
export default ({print, test}: Plugin);
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/immutable_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ const print = (
colors: Colors,
) => printImmutable(val, print, indent, opts, colors, 'Map', true);

module.exports = ({print, test}: Plugin);
export default ({print, test}: Plugin);
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ const print = (
colors: Colors,
) => printImmutable(val, print, indent, opts, colors, 'OrderedMap', true);

module.exports = ({print, test}: Plugin);
export default ({print, test}: Plugin);
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ const print = (
colors: Colors,
) => printImmutable(val, print, indent, opts, colors, 'OrderedSet', false);

module.exports = ({print, test}: Plugin);
export default ({print, test}: Plugin);
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/immutable_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import ImmutableOrderedSet from './immutable_ordered_set';
import ImmutableOrderedMap from './immutable_ordered_map';
import ImmutableRecord from './immutable_record';

module.exports = [
export default [
ImmutableList,
ImmutableSet,
ImmutableMap,
Expand Down
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/immutable_record.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ const print = (
colors: Colors,
) => printImmutable(val, print, indent, opts, colors, 'Record', true);

module.exports = ({print, test}: Plugin);
export default ({print, test}: Plugin);
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/immutable_set.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ const print = (
colors: Colors,
) => printImmutable(val, print, indent, opts, colors, 'Set', false);

module.exports = ({print, test}: Plugin);
export default ({print, test}: Plugin);
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/immutable_stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ const print = (
colors: Colors,
) => printImmutable(val, print, indent, opts, colors, 'Stack', false);

module.exports = ({print, test}: Plugin);
export default ({print, test}: Plugin);
4 changes: 1 addition & 3 deletions packages/pretty-format/src/plugins/lib/escape_html.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @flow
*/

function escapeHTML(str: string): string {
export default function escapeHTML(str: string): string {
return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
}

module.exports = escapeHTML;
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/lib/print_immutable.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ const printImmutable = (
);
};

module.exports = printImmutable;
export default printImmutable;
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/react_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ const print = (
const test = (object: any) => object && object.$$typeof === reactElement;
/* eslint-enable flowtype/no-weak-types */

module.exports = ({print, test}: Plugin);
export default ({print, test}: Plugin);
2 changes: 1 addition & 1 deletion packages/pretty-format/src/plugins/react_test_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ const print = (
const test = (object: Object) =>
object && object.$$typeof === reactTestInstance;

module.exports = ({print, test}: Plugin);
export default ({print, test}: Plugin);

0 comments on commit 876ddd6

Please sign in to comment.