mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 01:25:36 -05:00
* download Microsoft.Build.Sql sdk and extract * cleanup extracted folder and nuget * add constants * cleanup * remove package-lock.json * making outputChannel required and some cleanup * only download if the files aren't already there * Add todo * add try catches * addressing comments
53 lines
2.4 KiB
TypeScript
53 lines
2.4 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import * as should from 'should';
|
|
import * as os from 'os';
|
|
import * as vscode from 'vscode';
|
|
import * as path from 'path';
|
|
import { BuildHelper } from '../tools/buildHelper';
|
|
import { TestContext, createContext } from './testContext';
|
|
|
|
describe('BuildHelper: Build Helper tests', function (): void {
|
|
|
|
it('Should get correct build arguments', function (): void {
|
|
// update settings and validate
|
|
const buildHelper = new BuildHelper();
|
|
const resultArg = buildHelper.constructBuildArguments('dummy\\project path\\more space in path', 'dummy\\dll path', false);
|
|
|
|
if (os.platform() === 'win32') {
|
|
should(resultArg).equal(' build "dummy\\\\project path\\\\more space in path" /p:NetCoreBuild=true /p:NETCoreTargetsPath="dummy\\\\dll path"');
|
|
}
|
|
else {
|
|
should(resultArg).equal(' build "dummy/project path/more space in path" /p:NetCoreBuild=true /p:NETCoreTargetsPath="dummy/dll path"');
|
|
}
|
|
});
|
|
|
|
it('Should get correct build arguments for sdk style projects', function (): void {
|
|
// update settings and validate
|
|
const buildHelper = new BuildHelper();
|
|
const resultArg = buildHelper.constructBuildArguments('dummy\\project path\\more space in path', 'dummy\\dll path', true);
|
|
|
|
if (os.platform() === 'win32') {
|
|
should(resultArg).equal(' build "dummy\\\\project path\\\\more space in path" /p:NetCoreBuild=true /p:SystemDacpacsLocation="dummy\\\\dll path"');
|
|
}
|
|
else {
|
|
should(resultArg).equal(' build "dummy/project path/more space in path" /p:NetCoreBuild=true /p:SystemDacpacsLocation="dummy/dll path"');
|
|
}
|
|
});
|
|
|
|
it('Should get correct build folder', async function (): Promise<void> {
|
|
const testContext: TestContext = createContext();
|
|
const buildHelper = new BuildHelper();
|
|
await buildHelper.createBuildDirFolder(testContext.outputChannel);
|
|
|
|
// get expected path for build
|
|
let expectedPath = vscode.extensions.getExtension('Microsoft.sql-database-projects')?.extensionPath ?? 'EmptyPath';
|
|
expectedPath = path.join(expectedPath, 'BuildDirectory');
|
|
should(buildHelper.extensionBuildDirPath).equal(expectedPath);
|
|
});
|
|
});
|
|
|