Skip to content

Commit

Permalink
test: re-enable unpack samples
Browse files Browse the repository at this point in the history
  • Loading branch information
j4k0xb committed Jan 15, 2024
1 parent 0c9a328 commit b74ee88
Show file tree
Hide file tree
Showing 16 changed files with 270 additions and 132 deletions.
2 changes: 1 addition & 1 deletion packages/webcrack/src/unpack/test/samples.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { webcrack } from '../..';

const SAMPLES_DIR = join(__dirname, 'samples');

describe.skip('samples', async () => {
describe('samples', async () => {
const fileNames = (await readdir(SAMPLES_DIR)).filter((name) =>
name.endsWith('.js'),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ BrowserifyBundle {
"path": "lib.js",
},
"2" => BrowserifyModule {
"ast": const vscode = require('vscode');
const lib = require('./lib');
"ast": const vscode = require("vscode");
const lib = require("./lib");
console.log(lib);,
"dependencies": {
"1": "./lib",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,86 @@ BrowserifyBundle {
"modules": Map {
"1" => BrowserifyModule {
"ast": module.exports = 1;
!function (e) {
(function (e) {
var a = {};
function n(t) {
if (a[t]) return a[t].exports;
if (a[t]) {
return a[t].exports;
}
var r = a[t] = {
i: t,
l: !1,
l: false,
exports: {}
};
return e[t].call(r.exports, r, r.exports, n), r.l = !0, r.exports;
e[t].call(r.exports, r, r.exports, n);
r.l = true;
return r.exports;
}
n.m = e, n.c = a, n.d = function (e, t, i) {
n.o(e, t) || Object.defineProperty(e, t, {
enumerable: !0,
get: i
n.m = e;
n.c = a;
n.d = function (e, t, i) {
if (!n.o(e, t)) {
Object.defineProperty(e, t, {
enumerable: true,
get: i
});
}
};
n.r = function (e) {
if (typeof Symbol != "undefined" && Symbol.toStringTag) {
Object.defineProperty(e, Symbol.toStringTag, {
value: "Module"
});
}
Object.defineProperty(e, "__esModule", {
value: true
});
}, n.r = function (e) {
'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
value: 'Module'
}), Object.defineProperty(e, '__esModule', {
value: !0
});
}, n.t = function (e, t) {
if (1 & t && (e = n(e)), 8 & t) return e;
if (4 & t && 'object' == typeof e && e && e.__esModule) return e;
};
n.t = function (e, t) {
if (t & 1) {
e = n(e);
}
if (t & 8) {
return e;
}
if (t & 4 && typeof e == "object" && e && e.__esModule) {
return e;
}
var i = Object.create(null);
if (n.r(i), Object.defineProperty(i, 'default', {
enumerable: !0,
n.r(i);
Object.defineProperty(i, "default", {
enumerable: true,
value: e
}), 2 & t && 'string' != typeof e) for (var a in e) n.d(i, a, function (t) {
return e[t];
}.bind(null, a));
});
if (t & 2 && typeof e != "string") {
for (var a in e) {
n.d(i, a, function (t) {
return e[t];
}.bind(null, a));
}
}
return i;
}, n.n = function (e) {
};
n.n = function (e) {
var t = e && e.__esModule ? function () {
return e.default;
} : function () {
return e;
};
return n.d(t, 'a', t), t;
}, n.o = function (e, t) {
n.d(t, "a", t);
return t;
};
n.o = function (e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}, n.p = '', n(n.s = 2);
}([, function (e, t, i) {
};
n.p = "";
n(n.s = 2);
})([, function (e, t, i) {
const a = i(3);
}, function (e, t, i) {
const a = i(1);
const module = 1;
e.exports.color = '#FBC02D';
e.exports.color = "#FBC02D";
{
const module = 2;
console.log(module);
Expand All @@ -67,8 +98,8 @@ BrowserifyBundle {
"path": "lib.js",
},
"2" => BrowserifyModule {
"ast": const vscode = require('vscode');
const lib = require('./lib');
"ast": const vscode = require("vscode");
const lib = require("./lib");
console.log(lib);,
"dependencies": {
"1": "./lib",
Expand Down
8 changes: 4 additions & 4 deletions packages/webcrack/src/unpack/test/samples/browserify.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ module.exports = add;,
"path": "add.js",
},
"2" => BrowserifyModule {
"ast": var sum = require('./sum');
"ast": var sum = require("./sum");
var numbers = [1, 2, 3];
var result = sum(numbers);
var outputElement = document.getElementById('output');
var outputElement = document.getElementById("output");
outputElement.innerHTML = result;,
"dependencies": {
"4": "./sum",
Expand All @@ -38,8 +38,8 @@ module.exports = reduce;,
"path": "reduce.js",
},
"4" => BrowserifyModule {
"ast": var reduce = require('./reduce');
var add = require('./add');
"ast": var reduce = require("./reduce");
var add = require("./add");
function sum(list) {
return reduce(list, add, 0);
}
Expand Down
Loading

0 comments on commit b74ee88

Please sign in to comment.