From ac1081c917a98fd000e22a6c5b6b075c580df8d4 Mon Sep 17 00:00:00 2001 From: Enguerrand de Ribaucourt Date: Fri, 15 Dec 2023 10:27:16 +0100 Subject: [PATCH] Test: Devtool workspace scanning --- .../unit-tests/driver/scanner.test.ts | 32 ++++++++++++++++++- .../src/tests/bitbake-commands.test.ts | 2 +- .../src/tests/bitbake-parse.test.ts | 2 +- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/client/src/__tests__/unit-tests/driver/scanner.test.ts b/client/src/__tests__/unit-tests/driver/scanner.test.ts index c6385190..1028c60c 100644 --- a/client/src/__tests__/unit-tests/driver/scanner.test.ts +++ b/client/src/__tests__/unit-tests/driver/scanner.test.ts @@ -31,7 +31,23 @@ describe('BitBakeProjectScanner', () => { bitBakeProjectScanner.onChange.on(('scanReady'), () => { DoneCallback() }) - void bitBakeProjectScanner.rescanProject() + bitBakeProjectScanner.bitbakeDriver.spawnBitbakeProcess('devtool modify busybox').then((child) => { + child.on('close', () => { + void bitBakeProjectScanner.rescanProject() + }) + }, (error) => { + throw error + }) + }, 300000) + + afterAll((done) => { + bitBakeProjectScanner.bitbakeDriver.spawnBitbakeProcess('devtool reset busybox').then((child) => { + child.on('close', () => { + done() + }) + }, (error) => { + throw error + }) }, 300000) it('can get a list of layers', async () => { @@ -86,4 +102,18 @@ describe('BitBakeProjectScanner', () => { ]) ) }) + + it('can get a list of devtool workspaces', async () => { + const devtoolWorkspaces = bitBakeProjectScanner.scanResult._workspaces + expect(devtoolWorkspaces.length).toBeGreaterThan(0) + expect(devtoolWorkspaces).toEqual( + expect.arrayContaining([ + expect.objectContaining( + { + name: 'busybox' + } + ) + ]) + ) + }) }) diff --git a/integration-tests/src/tests/bitbake-commands.test.ts b/integration-tests/src/tests/bitbake-commands.test.ts index 6fe2085b..4e09b990 100644 --- a/integration-tests/src/tests/bitbake-commands.test.ts +++ b/integration-tests/src/tests/bitbake-commands.test.ts @@ -76,5 +76,5 @@ suite('Bitbake Commands Test Suite', () => { const files = await vscode.workspace.findFiles('build/workspace/sources/busybox/README') return files.length === 1 }) - }) + }).timeout(300000) }) diff --git a/integration-tests/src/tests/bitbake-parse.test.ts b/integration-tests/src/tests/bitbake-parse.test.ts index 1a2d225c..c291489b 100644 --- a/integration-tests/src/tests/bitbake-parse.test.ts +++ b/integration-tests/src/tests/bitbake-parse.test.ts @@ -17,7 +17,7 @@ suite('Bitbake Parsing Test Suite', () => { let buildFolder: vscode.Uri suiteSetup(async function (this: Mocha.Context) { - this.timeout(100000) + this.timeout(300000) await assertWorkspaceWillBeOpen() workspaceURI = (vscode.workspace.workspaceFolders as vscode.WorkspaceFolder[])[0].uri buildFolder = vscode.Uri.joinPath(workspaceURI, 'build')