Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`convert-esmodule can convert + + 1`] = `
"\\"use strict\\";
c = (10, + +15);
"
`;

exports[`convert-esmodule can convert class default exports 1`] = `
"\\"use strict\\";
Object.defineProperty(exports, \\"__esModule\\", {
Expand Down Expand Up @@ -298,7 +292,7 @@ exports[`convert-esmodule doesn't set var definitions 1`] = `
Object.defineProperty(exports, \\"__esModule\\", {
value: true
});
var global = typeof window !== \\"undefined\\" ? window : {};
var global = typeof window !== \\"undefined\\" ? window : {};
exports.global = global;
"
`;
Expand Down Expand Up @@ -635,6 +629,12 @@ var WS_CHARS = \\"u2000- 

   \\";
"
`;

exports[`convert-esmodule printer issues can convert + + 1`] = `
"\\"use strict\\";
c = (10, + + 15);
"
`;

exports[`convert-esmodule renames exports that are already defined, even in block scope 1`] = `
"\\"use strict\\";
var __$csb_exports = \\"testtest\\";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ export const customGenerator = {
) {
if (node.prefix) {
state.write(node.operator);
if (
node.operator.length > 1 ||
node.argument.type === 'UnaryExpression'
) {
if (node.operator.length > 1) {
state.write(' ');
}
if (
Expand All @@ -83,6 +80,7 @@ export const customGenerator = {
this[node.argument.type](node.argument, state);
state.write(')');
} else {
state.write(' ');
this[node.argument.type](node.argument, state);
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,18 @@ describe('convert-esmodule', () => {
expect(convertEsModule(code)).toMatchSnapshot();
});

it('can convert + +', () => {
const code = `
c = (10.0, + +(15))
`;

expect(convertEsModule(code)).toMatchSnapshot();
describe('printer issues', () => {
it('can convert + +', () => {
const code = `
c = (10.0, + +(15))
`;

expect(convertEsModule(code)).toMatchSnapshot();
});

it('can convert -(--i)', () => {
const code = `a = -(--i)`;
expect(convertEsModule(code)).toBe('"use strict";\na = - --i;\n');
});
});
});