Skip to content

Commit

Permalink
test(static-module-record): add failing test for transform bug witnes…
Browse files Browse the repository at this point in the history
…sed in browserfs
  • Loading branch information
kumavis committed Oct 5, 2023
1 parent 7505a04 commit efabcda
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/static-module-record/test/fixtures/browserfs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

// src/ApiError.ts
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
ErrorCode2[ErrorCode2["EPERM"] = 1] = "EPERM";
ErrorCode2[ErrorCode2["ENOENT"] = 2] = "ENOENT";
ErrorCode2[ErrorCode2["EIO"] = 5] = "EIO";
ErrorCode2[ErrorCode2["EBADF"] = 9] = "EBADF";
ErrorCode2[ErrorCode2["EACCES"] = 13] = "EACCES";
ErrorCode2[ErrorCode2["EBUSY"] = 16] = "EBUSY";
ErrorCode2[ErrorCode2["EEXIST"] = 17] = "EEXIST";
ErrorCode2[ErrorCode2["ENOTDIR"] = 20] = "ENOTDIR";
ErrorCode2[ErrorCode2["EISDIR"] = 21] = "EISDIR";
ErrorCode2[ErrorCode2["EINVAL"] = 22] = "EINVAL";
ErrorCode2[ErrorCode2["EFBIG"] = 27] = "EFBIG";
ErrorCode2[ErrorCode2["ENOSPC"] = 28] = "ENOSPC";
ErrorCode2[ErrorCode2["EROFS"] = 30] = "EROFS";
ErrorCode2[ErrorCode2["ENOTEMPTY"] = 39] = "ENOTEMPTY";
ErrorCode2[ErrorCode2["ENOTSUP"] = 95] = "ENOTSUP";
return ErrorCode2;
})(ErrorCode || {});

ErrorCode[1];

export {
ErrorCode
}
16 changes: 16 additions & 0 deletions packages/static-module-record/test/test-static-module-record.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,3 +792,19 @@ test('should handle package "immer" source', t => {
setUseProxies: ['vn', true],
});
});

// Regression test for https://github.com/jvilk/BrowserFS
test.failing('should handle package "browserfs" source', t => {
const { __syncModuleProgram__ } = new StaticModuleRecord(
readFixture('fixtures/browserfs.js'),
);
t.notThrows(() => {
// This is throwing a ReferenceError for "ErrorCode"
eval(__syncModuleProgram__)({
'imports': () => {},
'liveVar': {
ErrorCode: () => {},
}
});
});
});

0 comments on commit efabcda

Please sign in to comment.