// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a real example 1`] = ` Object { "env": Object { "__CF__x__": "12", "__CF__y__": "78", }, "js": "var __commonJS = (callback, module2) => () => { if (!module2) { module2 = {exports: {}}; callback(module2.exports, module2); } return module2.exports; }; // cfruntime.js var require_cfruntime = __commonJS((exports2, module2) => { function wrap(output2) { return async function(...args) { if (typeof output2 === \\"function\\") { output2 = output2(...args); } if (isPromise(output2)) { output2 = await output2; } return output2; }; } function isPromise(x2) { return typeof x2 === \\"object\\" && \\"then\\" in x2 && \\"catch\\" in x2; } module2.exports = {wrap}; }); // entrypoint.js var x = process.env[\\"__CF__x__\\"]; if (x === void 0) { throw new Error(\\"missing required environment variable '__CF__x__'\\"); } var y = process.env[\\"__CF__y__\\"]; if (y === void 0) { throw new Error(\\"missing required environment variable '__CF__y__'\\"); } var output = x + y; module.exports = require_cfruntime().wrap(output); ", } `; exports[`array objects 1`] = ` Object { "env": Object { "__CF__hello__": "[1,2,\\"hello\\",true,{ \\"world\\": 1}]", }, "js": "var __commonJS = (callback, module2) => () => { if (!module2) { module2 = {exports: {}}; callback(module2.exports, module2); } return module2.exports; }; // cfruntime.js var require_cfruntime = __commonJS((exports2, module2) => { function wrap(output2) { return async function(...args) { if (typeof output2 === \\"function\\") { output2 = output2(...args); } if (isPromise(output2)) { output2 = await output2; } return output2; }; } function isPromise(x) { return typeof x === \\"object\\" && \\"then\\" in x && \\"catch\\" in x; } module2.exports = {wrap}; }); // entrypoint.js var hello = process.env[\\"__CF__hello__\\"]; if (hello === void 0) { throw new Error(\\"missing required environment variable '__CF__hello__'\\"); } var output = true; module.exports = require_cfruntime().wrap(output); ", } `; exports[`async function 1`] = ` Object { "no": 100, "yes": "async", } `; exports[`async literal 1`] = `"value from a function"`; exports[`capture another cfunction 1`] = ` Object { "env": Object {}, "js": "var __commonJS = (callback, module2) => () => { if (!module2) { module2 = {exports: {}}; callback(module2.exports, module2); } return module2.exports; }; // a7db9f5b39aff35858c21324987f4635dae174e5.js var require_a7db9f5b39aff35858c21324987f4635dae174e5 = __commonJS((exports2, module2) => { var __commonJS2 = (callback, module22) => () => { if (!module22) { module22 = {exports: {}}; callback(module22.exports, module22); } return module22.exports; }; var require_cfruntime2 = __commonJS2((exports22, module22) => { function wrap(output22) { return async function(...args) { if (typeof output22 === \\"function\\") { output22 = output22(...args); } if (isPromise(output22)) { output22 = await output22; } return output22; }; } function isPromise(x) { return typeof x === \\"object\\" && \\"then\\" in x && \\"catch\\" in x; } module22.exports = {wrap}; }); var output2 = () => 42; module2.exports = require_cfruntime2().wrap(output2); }); // 8c53027a78125d55c36a1d2e8a01c52e2fcb772b.js var require_c53027a78125d55c36a1d2e8a01c52e2fcb772b = __commonJS((exports2, module2) => { var __commonJS2 = (callback, module22) => () => { if (!module22) { module22 = {exports: {}}; callback(module22.exports, module22); } return module22.exports; }; var require_cfruntime2 = __commonJS2((exports22, module22) => { function wrap(output22) { return async function(...args) { if (typeof output22 === \\"function\\") { output22 = output22(...args); } if (isPromise(output22)) { output22 = await output22; } return output22; }; } function isPromise(x) { return typeof x === \\"object\\" && \\"then\\" in x && \\"catch\\" in x; } module22.exports = {wrap}; }); var output2 = async function(x) { return 3 * x; }; module2.exports = require_cfruntime2().wrap(output2); }); // cfruntime.js var require_cfruntime = __commonJS((exports2, module2) => { function wrap(output2) { return async function(...args) { if (typeof output2 === \\"function\\") { output2 = output2(...args); } if (isPromise(output2)) { output2 = await output2; } return output2; }; } function isPromise(x) { return typeof x === \\"object\\" && \\"then\\" in x && \\"catch\\" in x; } module2.exports = {wrap}; }); // entrypoint.js var f1 = require_a7db9f5b39aff35858c21324987f4635dae174e5(); var boom = require_c53027a78125d55c36a1d2e8a01c52e2fcb772b(); var output = async () => await f1() + 2 + await boom(77); module.exports = require_cfruntime().wrap(output); ", } `; exports[`function 1`] = `42`; exports[`function literal 1`] = `"value from a function"`; exports[`multiple captures 1`] = ` Object { "env": Object { "__CF__data__": "{ \\"field1\\": [\\"a\\",\\"b\\"],\\"field2\\": true}", "__CF__hello__": "\\"yes\\"", }, "js": "var __commonJS = (callback, module2) => () => { if (!module2) { module2 = {exports: {}}; callback(module2.exports, module2); } return module2.exports; }; // cfruntime.js var require_cfruntime = __commonJS((exports2, module2) => { function wrap(output2) { return async function(...args) { if (typeof output2 === \\"function\\") { output2 = output2(...args); } if (isPromise(output2)) { output2 = await output2; } return output2; }; } function isPromise(x) { return typeof x === \\"object\\" && \\"then\\" in x && \\"catch\\" in x; } module2.exports = {wrap}; }); // entrypoint.js var hello = process.env[\\"__CF__hello__\\"]; if (hello === void 0) { throw new Error(\\"missing required environment variable '__CF__hello__'\\"); } var data = process.env[\\"__CF__data__\\"]; if (data === void 0) { throw new Error(\\"missing required environment variable '__CF__data__'\\"); } var output = true; module.exports = require_cfruntime().wrap(output); ", } `; exports[`no capture 1`] = ` Object { "env": Object {}, "js": "var __commonJS = (callback, module2) => () => { if (!module2) { module2 = {exports: {}}; callback(module2.exports, module2); } return module2.exports; }; // cfruntime.js var require_cfruntime = __commonJS((exports2, module2) => { function wrap(output2) { return async function(...args) { if (typeof output2 === \\"function\\") { output2 = output2(...args); } if (isPromise(output2)) { output2 = await output2; } return output2; }; } function isPromise(x) { return typeof x === \\"object\\" && \\"then\\" in x && \\"catch\\" in x; } module2.exports = {wrap}; }); // entrypoint.js var output = true; module.exports = require_cfruntime().wrap(output); ", } `; exports[`output is executable 1`] = `300`; exports[`primitive 1`] = ` Object { "env": Object { "__CF__hello__": "22", }, "js": "var __commonJS = (callback, module2) => () => { if (!module2) { module2 = {exports: {}}; callback(module2.exports, module2); } return module2.exports; }; // cfruntime.js var require_cfruntime = __commonJS((exports2, module2) => { function wrap(output2) { return async function(...args) { if (typeof output2 === \\"function\\") { output2 = output2(...args); } if (isPromise(output2)) { output2 = await output2; } return output2; }; } function isPromise(x) { return typeof x === \\"object\\" && \\"then\\" in x && \\"catch\\" in x; } module2.exports = {wrap}; }); // entrypoint.js var hello = process.env[\\"__CF__hello__\\"]; if (hello === void 0) { throw new Error(\\"missing required environment variable '__CF__hello__'\\"); } var output = true; module.exports = require_cfruntime().wrap(output); ", } `; exports[`respects toJson() 1`] = ` Object { "env": Object { "__CF__hello__": "{ }", }, "js": "var __commonJS = (callback, module2) => () => { if (!module2) { module2 = {exports: {}}; callback(module2.exports, module2); } return module2.exports; }; // cfruntime.js var require_cfruntime = __commonJS((exports2, module2) => { function wrap(output2) { return async function(...args) { if (typeof output2 === \\"function\\") { output2 = output2(...args); } if (isPromise(output2)) { output2 = await output2; } return output2; }; } function isPromise(x) { return typeof x === \\"object\\" && \\"then\\" in x && \\"catch\\" in x; } module2.exports = {wrap}; }); // entrypoint.js var hello = process.env[\\"__CF__hello__\\"]; if (hello === void 0) { throw new Error(\\"missing required environment variable '__CF__hello__'\\"); } var output = true; module.exports = require_cfruntime().wrap(output); ", } `;