chore(es/minifier): Fix script for extracting test cases from next.js app (#8092)

This commit is contained in:
Donny/강동윤 2023-10-10 23:18:39 +09:00 committed by GitHub
parent 7e4b2490e8
commit a2d077958f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,12 +8,11 @@ const rl = readline.createInterface({
terminal: false,
});
function looseJsonParse(obj) {
return Function('"use strict";return (' + obj + ")")();
}
rl.on("line", async (data) => {
try {
const { name, source } = looseJsonParse(`(${data})`);
data = data.replace('{ breakLength: Infinity, maxStringLength: Infinity }', '')
const { name, source } = JSON.parse(data);
const targetPath = path.join(
__dirname,
"..",