Unverified Commit 61deecb7 authored by James Henstridge's avatar James Henstridge Committed by GitHub
Browse files

Merge pull request #21 from jhenstridge/update-deps

package.json: Upgrade dependencies
parents d854a8ff e62d5a44
Pipeline #4473 failed with stages
in 1 minute
......@@ -44,11 +44,13 @@ test('SnapcraftBuilder.build runs a snap build', async () => {
const ensureSnapcraft = jest
.spyOn(tools, 'ensureSnapcraft')
.mockImplementation(async (channel): Promise<void> => {})
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
process.env['GITHUB_REPOSITORY'] = 'user/repo'
process.env['GITHUB_RUN_ID'] = '42'
......@@ -88,11 +90,13 @@ test('SnapcraftBuilder.build can disable build info', async () => {
const ensureSnapcraft = jest
.spyOn(tools, 'ensureSnapcraft')
.mockImplementation(async (channel): Promise<void> => {})
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const builder = new build.SnapcraftBuilder({
projectRoot: '.',
......@@ -124,11 +128,13 @@ test('SnapcraftBuilder.build can set the Snapcraft channel', async () => {
const ensureSnapcraft = jest
.spyOn(tools, 'ensureSnapcraft')
.mockImplementation(async (channel): Promise<void> => {})
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const builder = new build.SnapcraftBuilder({
projectRoot: '.',
......@@ -154,11 +160,13 @@ test('SnapcraftBuilder.build can pass additional arguments', async () => {
const ensureSnapcraft = jest
.spyOn(tools, 'ensureSnapcraft')
.mockImplementation(async (channel): Promise<void> => {})
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const builder = new build.SnapcraftBuilder({
projectRoot: '.',
......@@ -188,11 +196,13 @@ test('SnapcraftBuilder.build can pass UA token', async () => {
const ensureSnapcraft = jest
.spyOn(tools, 'ensureSnapcraft')
.mockImplementation(async (channel): Promise<void> => {})
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const builder = new build.SnapcraftBuilder({
projectRoot: '.',
......
......@@ -13,24 +13,31 @@ afterEach(() => {
test('ensureSnapd installs snapd if needed', async () => {
expect.assertions(4)
const accessMock = jest.spyOn(fs.promises, 'access').mockImplementation(
async (filename: fs.PathLike, mode?: number | undefined): Promise<void> => {
throw new Error('not found')
}
)
const statMock = jest.spyOn(fs.promises, 'stat').mockImplementation(
async (filename: fs.PathLike): Promise<fs.Stats> => {
const accessMock = jest
.spyOn(fs.promises, 'access')
.mockImplementation(
async (
filename: fs.PathLike,
mode?: number | undefined
): Promise<void> => {
throw new Error('not found')
}
)
const statMock = jest
.spyOn(fs.promises, 'stat')
.mockImplementation(async (filename: fs.PathLike): Promise<fs.Stats> => {
const s = new fs.Stats()
s.uid = 0
s.gid = 0
return s
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
})
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureSnapd()
......@@ -60,19 +67,21 @@ test('ensureSnapd is a no-op if snapd is installed', async () => {
mode?: number | undefined
): Promise<void> => {}
)
const statMock = jest.spyOn(fs.promises, 'stat').mockImplementation(
async (filename: fs.PathLike): Promise<fs.Stats> => {
const statMock = jest
.spyOn(fs.promises, 'stat')
.mockImplementation(async (filename: fs.PathLike): Promise<fs.Stats> => {
const s = new fs.Stats()
s.uid = 0
s.gid = 0
return s
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
})
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureSnapd()
......@@ -92,19 +101,21 @@ test('ensureSnapd fixes permissions on the root directory', async () => {
mode?: number | undefined
): Promise<void> => {}
)
const statMock = jest.spyOn(fs.promises, 'stat').mockImplementation(
async (filename: fs.PathLike): Promise<fs.Stats> => {
const statMock = jest
.spyOn(fs.promises, 'stat')
.mockImplementation(async (filename: fs.PathLike): Promise<fs.Stats> => {
const s = new fs.Stats()
s.uid = 500
s.gid = 0
return s
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
})
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureSnapd()
......@@ -116,16 +127,23 @@ test('ensureSnapd fixes permissions on the root directory', async () => {
test('ensureLXD installs the snap version of LXD if needed', async () => {
expect.assertions(5)
const accessMock = jest.spyOn(fs.promises, 'access').mockImplementation(
async (filename: fs.PathLike, mode?: number | undefined): Promise<void> => {
throw new Error('not found')
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const accessMock = jest
.spyOn(fs.promises, 'access')
.mockImplementation(
async (
filename: fs.PathLike,
mode?: number | undefined
): Promise<void> => {
throw new Error('not found')
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureLXD()
......@@ -154,16 +172,23 @@ test('ensureLXD installs the snap version of LXD if needed', async () => {
test('ensureLXD removes the apt version of LXD', async () => {
expect.assertions(2)
const accessMock = jest.spyOn(fs.promises, 'access').mockImplementation(
async (filename: fs.PathLike, mode?: number | undefined): Promise<void> => {
return
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const accessMock = jest
.spyOn(fs.promises, 'access')
.mockImplementation(
async (
filename: fs.PathLike,
mode?: number | undefined
): Promise<void> => {
return
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureLXD()
......@@ -180,19 +205,26 @@ test('ensureLXD removes the apt version of LXD', async () => {
test('ensureLXD still calls "lxd init" if LXD is installed', async () => {
expect.assertions(5)
const accessMock = jest.spyOn(fs.promises, 'access').mockImplementation(
async (filename: fs.PathLike, mode?: number | undefined): Promise<void> => {
if (filename === '/snap/bin/lxd') {
return
const accessMock = jest
.spyOn(fs.promises, 'access')
.mockImplementation(
async (
filename: fs.PathLike,
mode?: number | undefined
): Promise<void> => {
if (filename === '/snap/bin/lxd') {
return
}
throw new Error('not found')
}
throw new Error('not found')
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureLXD()
......@@ -221,16 +253,23 @@ test('ensureLXD still calls "lxd init" if LXD is installed', async () => {
test('ensureSnapcraft installs Snapcraft if needed', async () => {
expect.assertions(2)
const accessMock = jest.spyOn(fs.promises, 'access').mockImplementation(
async (filename: fs.PathLike, mode?: number | undefined): Promise<void> => {
throw new Error('not found')
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const accessMock = jest
.spyOn(fs.promises, 'access')
.mockImplementation(
async (
filename: fs.PathLike,
mode?: number | undefined
): Promise<void> => {
throw new Error('not found')
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureSnapcraft('edge')
......@@ -248,16 +287,23 @@ test('ensureSnapcraft installs Snapcraft if needed', async () => {
test('ensureSnapcraft refreshes if Snapcraft is installed', async () => {
expect.assertions(2)
const accessMock = jest.spyOn(fs.promises, 'access').mockImplementation(
async (filename: fs.PathLike, mode?: number | undefined): Promise<void> => {
return
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const accessMock = jest
.spyOn(fs.promises, 'access')
.mockImplementation(
async (
filename: fs.PathLike,
mode?: number | undefined
): Promise<void> => {
return
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureSnapcraft('edge')
......
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment