adding in test folder and updating azure pipeline
This commit is contained in:
Родитель
5cccf86bb6
Коммит
3f9b52f3bc
|
@ -0,0 +1,26 @@
|
|||
steps:
|
||||
- script: |
|
||||
sudo cp .azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
|
||||
sudo chmod +x /etc/init.d/xvfb
|
||||
sudo update-rc.d xvfb defaults
|
||||
sudo service xvfb start
|
||||
displayName: 'Start X Virtual Frame Buffer'
|
||||
condition: eq(variables['Agent.OS'], 'Linux')
|
||||
|
||||
- task: Npm@1
|
||||
displayName: 'Test'
|
||||
inputs:
|
||||
command: custom
|
||||
customCommand: test
|
||||
env:
|
||||
# SERVICE_PRINCIPAL_CLIENT_ID: $(SERVICE_PRINCIPAL_CLIENT_ID)
|
||||
# SERVICE_PRINCIPAL_SECRET: $(SERVICE_PRINCIPAL_SECRET)
|
||||
# SERVICE_PRINCIPAL_DOMAIN: $(SERVICE_PRINCIPAL_DOMAIN)
|
||||
DISPLAY: :10 # Only necessary for linux tests
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: 'Publish Test Results'
|
||||
inputs:
|
||||
testResultsFiles: '*-results.xml'
|
||||
testRunTitle: '$(Agent.OS)'
|
||||
condition: succeededOrFailed()
|
|
@ -4,6 +4,7 @@ jobs:
|
|||
vmImage: windows-latest
|
||||
steps:
|
||||
- template: common/build.yml
|
||||
- template: common/test.yml
|
||||
|
||||
- job: Linux
|
||||
pool:
|
||||
|
@ -11,12 +12,14 @@ jobs:
|
|||
steps:
|
||||
- template: common/build.yml
|
||||
- template: common/publish-vsix.yml # Only publish vsix from linux build since we use this to release and want to stay consistent
|
||||
- template: common/test.yml
|
||||
|
||||
- job: macOS
|
||||
pool:
|
||||
vmImage: macOS-latest
|
||||
steps:
|
||||
- template: common/build.yml
|
||||
- template: common/test.yml
|
||||
|
||||
trigger:
|
||||
branches:
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -413,10 +413,9 @@
|
|||
"@types/mocha": "^7.0.2",
|
||||
"@types/node": "^13.11.0",
|
||||
"@types/vscode": "^1.45.0",
|
||||
"@types/webpack": "^4.32.1",
|
||||
"@typescript-eslint/eslint-plugin": "^2.30.0",
|
||||
"@typescript-eslint/parser": "^2.30.0",
|
||||
"copy-webpack-plugin": "^5.0.3",
|
||||
"copy-webpack-plugin": "^5.1.1",
|
||||
"eslint": "^6.8.0",
|
||||
"file-loader": "^4.1.0",
|
||||
"glob": "^7.1.6",
|
||||
|
@ -426,9 +425,9 @@
|
|||
"ts-loader": "^6.0.4",
|
||||
"ts-node": "^8.3.0",
|
||||
"typescript": "^3.8.3",
|
||||
"vscode-azureextensiondev": "0.4.0",
|
||||
"vscode-azureextensiondev": "^0.4.0",
|
||||
"vscode-test": "^1.3.0",
|
||||
"webpack": "^4.37.0",
|
||||
"webpack": "^4.42.0",
|
||||
"webpack-cli": "^3.3.6"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -440,4 +439,4 @@
|
|||
"vscode-azureextensionui": "^0.33.1",
|
||||
"vscode-extension-telemetry": "^0.1.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
import * as path from 'path';
|
||||
|
||||
import { runTests } from 'vscode-test';
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
// The folder containing the Extension Manifest package.json
|
||||
// Passed to `--extensionDevelopmentPath`
|
||||
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
|
||||
|
||||
// The path to test runner
|
||||
// Passed to --extensionTestsPath
|
||||
const extensionTestsPath = path.resolve(__dirname, './suite/index');
|
||||
|
||||
// Download VS Code, unzip it and run the integration test
|
||||
await runTests({ extensionDevelopmentPath, extensionTestsPath });
|
||||
} catch (err) {
|
||||
console.error('Failed to run tests');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,15 @@
|
|||
import * as assert from 'assert';
|
||||
|
||||
// You can import and use all API from the 'vscode' module
|
||||
// as well as import your extension to test it
|
||||
import * as vscode from 'vscode';
|
||||
// import * as myExtension from '../../extension';
|
||||
|
||||
suite('Extension Test Suite', () => {
|
||||
vscode.window.showInformationMessage('Start all tests.');
|
||||
|
||||
test('Sample test', () => {
|
||||
assert.equal(-1, [1, 2, 3].indexOf(5));
|
||||
assert.equal(-1, [1, 2, 3].indexOf(0));
|
||||
});
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { TestOutputChannel, TestUserInput } from 'vscode-azureextensiondev';
|
||||
import { ext } from '../../extension.bundle';
|
||||
|
||||
// tslint:disable-next-line:strict-boolean-expressions export-name
|
||||
export let longRunningTestsEnabled: boolean = !/^(false|0)?$/i.test(process.env.ENABLE_LONG_RUNNING_TESTS || '');
|
||||
export const testUserInput: TestUserInput = new TestUserInput(vscode);
|
||||
|
||||
// Runs before all tests
|
||||
suiteSetup(async function (this: Mocha.Context): Promise<void> {
|
||||
this.timeout(2 * 60 * 1000);
|
||||
await vscode.commands.executeCommand('azureCognitiveSearch.refresh'); // activate the extension before tests begin
|
||||
ext.outputChannel = new TestOutputChannel();
|
||||
ext.ui = testUserInput;
|
||||
});
|
|
@ -0,0 +1,38 @@
|
|||
import * as path from 'path';
|
||||
import * as Mocha from 'mocha';
|
||||
import * as glob from 'glob';
|
||||
|
||||
export function run(): Promise<void> {
|
||||
// Create the mocha test
|
||||
const mocha = new Mocha({
|
||||
ui: 'tdd',
|
||||
color: true
|
||||
});
|
||||
|
||||
const testsRoot = path.resolve(__dirname, '..');
|
||||
|
||||
return new Promise((c, e) => {
|
||||
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
|
||||
if (err) {
|
||||
return e(err);
|
||||
}
|
||||
|
||||
// Add files to the test suite
|
||||
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
|
||||
|
||||
try {
|
||||
// Run the mocha test
|
||||
mocha.run(failures => {
|
||||
if (failures > 0) {
|
||||
e(new Error(`${failures} tests failed.`));
|
||||
} else {
|
||||
c();
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
e(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
|
@ -20,8 +20,11 @@ let config = dev.getDefaultWebpackConfig({
|
|||
verbosity: DEBUG_WEBPACK ? 'debug' : 'normal',
|
||||
externals: { './getCoreNodeModule': 'commonjs getCoreNodeModule' },
|
||||
plugins: [
|
||||
// @ts-ignore
|
||||
// ignoring because syntax is correct but it is throwing an error
|
||||
// https://github.com/webpack-contrib/copy-webpack-plugin/issues/455
|
||||
new CopyWebpackPlugin([
|
||||
{ from: './out/src/utils/getCoreNodeModule.js', to: 'node_modules' }
|
||||
{ from: './out/src/utils/getCoreNodeModule.js', to: 'node_modules' }
|
||||
])
|
||||
]
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче