Skip to content

Commit

Permalink
chore: add ut for local module (#8586)
Browse files Browse the repository at this point in the history
  • Loading branch information
beyondkmp authored Oct 11, 2024
1 parent 104a580 commit 2642dee
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/snapshots/globTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9792,6 +9792,12 @@ Object {
}
`;

exports[`local node module with file protocol 1`] = `
Object {
"linux": Array [],
}
`;

exports[`outside link 1`] = `
Object {
"linux": Array [],
Expand Down
28 changes: 28 additions & 0 deletions test/src/globTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,34 @@ test.ifNotWindows(
)
)

test.ifDevOrLinuxCi("local node module with file protocol", () => {
return assertPack(
"test-app-one",
{
targets: Platform.LINUX.createTarget(DIR_TARGET),
config: {
asarUnpack: ["**/node_modules/foo/**/*"],
},
},
{
isInstallDepsBefore: true,
projectDirCreated: async (projectDir, tmpDir) => {
const tempDir = await tmpDir.getTempDir()
let localPath = path.join(tempDir, "foo")
await outputFile(path.join(localPath, "package.json"), `{"name":"foo","version":"9.0.0","main":"index.js","license":"MIT","dependencies":{"ms":"2.0.0"}}`)
await modifyPackageJson(projectDir, data => {
data.dependencies = {
foo: `file:${localPath}`,
}
})
},
packed: async context => {
assertThat(path.join(path.join(context.getResources(Platform.LINUX), "app.asar.unpacked", "node_modules", "foo", "package.json"))).isFile()
},
}
)
})

// cannot be enabled
// https://github.com/electron-userland/electron-builder/issues/611
test.ifDevOrLinuxCi("failed peer dep", () => {
Expand Down

0 comments on commit 2642dee

Please sign in to comment.