зеркало из https://github.com/Azure/ms-rest-js.git
Merge branch 'master' into daschult/URL
This commit is contained in:
Коммит
e4630454db
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
13
package.json
13
package.json
|
@ -29,6 +29,7 @@
|
|||
"types": "./typings/lib/msRest.d.ts",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/express": "^4.11.1",
|
||||
"@types/form-data": "^2.2.1",
|
||||
"@types/is-stream": "^1.1.0",
|
||||
"@types/node": "^9.4.6",
|
||||
|
@ -49,6 +50,8 @@
|
|||
"@types/should": "^8.1.30",
|
||||
"@types/url-parse": "^1.1.0",
|
||||
"@types/webpack": "^4.1.3",
|
||||
"@types/webpack-dev-middleware": "^2.0.1",
|
||||
"express": "^4.16.3",
|
||||
"glob": "^7.1.2",
|
||||
"mocha": "^5.1.1",
|
||||
"mocha-chrome": "^1.1.0",
|
||||
|
@ -56,12 +59,12 @@
|
|||
"should": "5.2.0",
|
||||
"ts-loader": "^4.2.0",
|
||||
"ts-node": "^5.0.1",
|
||||
"tslint": "^5.7.0",
|
||||
"tslint": "^5.10.0",
|
||||
"typescript": "^2.7.2",
|
||||
"uglify-es": "^3.1.0",
|
||||
"webpack": "^4.6.0",
|
||||
"webpack-cli": "^2.0.14",
|
||||
"webpack-dev-server": "^3.1.3"
|
||||
"webpack-dev-middleware": "^3.1.2"
|
||||
},
|
||||
"homepage": "https://github.com/Azure/ms-rest-js",
|
||||
"repository": {
|
||||
|
@ -78,9 +81,11 @@
|
|||
"watch:node": "tsc -w",
|
||||
"watch:browser": "webpack -w",
|
||||
"test": "run-p test:tslint test:nodejs-unit",
|
||||
"test:server": "ts-node testserver",
|
||||
"test:tslint": "tslint -p . -c tslint.json --exclude \"./test/**/*.ts\"",
|
||||
"test:nodejs-unit": "mocha",
|
||||
"test:tslint": "tslint -p . -c tslint.json --exclude test/**/*.ts",
|
||||
"test:chrome-unit": "webpack --config webpack.testconfig.ts && mocha-chrome index.html",
|
||||
"test:mocha-chrome": "sleep 0.5 && mocha-chrome http://localhost:3001",
|
||||
"test:chrome-unit": "run-p -r test:server test:mocha-chrome",
|
||||
"prepare": "npm run build"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
describe("browser tests", function() {
|
||||
it("works in the browser");
|
||||
});
|
|
@ -2,4 +2,5 @@
|
|||
--timeout 50000
|
||||
--reporter list
|
||||
--colors
|
||||
test/**/*.ts
|
||||
test/node/**/*.ts
|
||||
test/shared/**/*.ts
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
import * as childProcess from "child_process";
|
||||
import * as path from "path";
|
||||
|
||||
let serverProcess: childProcess.ChildProcess;
|
||||
|
||||
// TODO: figure out why this hangs on Windows
|
||||
const flag = false;
|
||||
if (flag) {
|
||||
before(function(done) {
|
||||
serverProcess = childProcess.spawn(path.join(__dirname, "../../node_modules/.bin/ts-node"), ["testserver", "--no-webpack"], { shell: true });
|
||||
const dataListener = function(data: Buffer) {
|
||||
console.log(data.toString("utf-8"));
|
||||
serverProcess.stdout.removeListener("data", dataListener);
|
||||
done();
|
||||
};
|
||||
|
||||
serverProcess.stdout.on("data", dataListener);
|
||||
serverProcess.stderr.on("data", dataListener);
|
||||
serverProcess.on("error", function(err) { done(err); });
|
||||
});
|
||||
|
||||
after(function() {
|
||||
serverProcess.kill();
|
||||
});
|
||||
}
|
|
@ -2,12 +2,11 @@
|
|||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
import * as assert from "assert";
|
||||
import { WebResource } from "../lib/webResource";
|
||||
import { MsRestUserAgentPolicy } from "../lib/policies/msRestUserAgentPolicy";
|
||||
import { Constants } from "../lib/util/constants";
|
||||
import { RequestPolicy, RequestPolicyOptions } from "../lib/policies/requestPolicy";
|
||||
import { HttpOperationResponse } from "../lib/httpOperationResponse";
|
||||
import { isNode } from "../lib/util/utils";
|
||||
import { WebResource } from "../../lib/webResource";
|
||||
import { MsRestUserAgentPolicy } from "../../lib/policies/msRestUserAgentPolicy";
|
||||
import { Constants } from "../../lib/util/constants";
|
||||
import { RequestPolicy, RequestPolicyOptions } from "../../lib/policies/requestPolicy";
|
||||
import { HttpOperationResponse } from "../../lib/httpOperationResponse";
|
||||
|
||||
const should = require("should");
|
||||
const userAgentHeader = Constants.HeaderConstants.USER_AGENT;
|
||||
|
@ -21,10 +20,6 @@ const emptyRequestPolicy: RequestPolicy = {
|
|||
|
||||
describe("ms-rest user agent filter (nodejs only)", () => {
|
||||
it("should construct user agent header when supplied empty array", function (done) {
|
||||
if (!isNode) {
|
||||
this.skip();
|
||||
}
|
||||
|
||||
const userAgentArray: Array<string> = [];
|
||||
const userAgentFilter = new MsRestUserAgentPolicy(emptyRequestPolicy, new RequestPolicyOptions(), userAgentArray);
|
||||
const resource = new WebResource();
|
||||
|
@ -37,10 +32,6 @@ describe("ms-rest user agent filter (nodejs only)", () => {
|
|||
});
|
||||
|
||||
it("should not modify user agent header if already present", function (done) {
|
||||
if (!isNode) {
|
||||
this.skip();
|
||||
}
|
||||
|
||||
const genericRuntime = "ms-rest";
|
||||
const azureRuntime = "ms-rest-azure";
|
||||
const azureSDK = "Azure-SDK-For-Node";
|
||||
|
@ -61,10 +52,6 @@ describe("ms-rest user agent filter (nodejs only)", () => {
|
|||
});
|
||||
|
||||
it("should insert azure-sdk-for-node at right position", function (done) {
|
||||
if (!isNode) {
|
||||
this.skip();
|
||||
}
|
||||
|
||||
const genericRuntime = "ms-rest";
|
||||
const azureRuntime = "ms-rest-azure";
|
||||
const azureSDK = "Azure-SDK-For-Node";
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
import * as msRest from "../lib/msRest";
|
||||
import * as msRest from "../../lib/msRest";
|
||||
const should = require("should");
|
||||
const TokenCredentials = msRest.TokenCredentials;
|
||||
const BasicAuthenticationCredentials = msRest.BasicAuthenticationCredentials;
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import * as msRest from '../../../../lib/msRest';
|
||||
import * as msRest from '../../../../../lib/msRest';
|
||||
import { Mappers } from './models/mappers';
|
||||
|
||||
/**
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
import * as assert from "assert";
|
||||
import { Response } from "node-fetch";
|
||||
import { LogPolicy } from "../lib/policies/logPolicy";
|
||||
import { HttpOperationResponse } from "../lib/httpOperationResponse";
|
||||
import { WebResource } from "../lib/webResource";
|
||||
import { RequestPolicy, RequestPolicyOptions } from "../lib/policies/requestPolicy";
|
||||
import { LogPolicy } from "../../lib/policies/logPolicy";
|
||||
import { HttpOperationResponse } from "../../lib/httpOperationResponse";
|
||||
import { WebResource } from "../../lib/webResource";
|
||||
import { RequestPolicy, RequestPolicyOptions } from "../../lib/policies/requestPolicy";
|
||||
|
||||
const emptyRequestPolicy: RequestPolicy = {
|
||||
sendRequest(request: WebResource): Promise<HttpOperationResponse> {
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
import * as assert from "assert";
|
||||
import * as msRest from "../lib/msRest";
|
||||
import * as msRest from "../../lib/msRest";
|
||||
const should = require("should");
|
||||
|
||||
import { TestClient } from "./data/TestClient/lib/testClient";
|
|
@ -0,0 +1,26 @@
|
|||
import * as path from "path";
|
||||
import * as webpackMiddleware from "webpack-dev-middleware";
|
||||
import webpack = require("webpack");
|
||||
import express = require("express");
|
||||
const testconfig: webpack.Configuration = require("../webpack.testconfig");
|
||||
|
||||
const port = parseInt(process.env.PORT) || 3001;
|
||||
const app = express();
|
||||
|
||||
if (process.argv.indexOf("--no-webpack") === -1) {
|
||||
app.use(webpackMiddleware(webpack(testconfig), {
|
||||
publicPath: "/"
|
||||
}));
|
||||
}
|
||||
|
||||
app.use(express.static(path.join(__dirname, "../")));
|
||||
app.use(express.static(path.join(__dirname, "../test/resources/")));
|
||||
|
||||
app.post("/fileupload", function(req, res) {
|
||||
res.status(200);
|
||||
req.pipe(res);
|
||||
});
|
||||
|
||||
app.listen(port, function() {
|
||||
console.log(`ms-rest-js testserver listening on port ${port}...`);
|
||||
});
|
|
@ -35,4 +35,4 @@ const config: webpack.Configuration = {
|
|||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
export = config;
|
|
@ -3,7 +3,7 @@ import * as glob from 'glob';
|
|||
import * as path from 'path';
|
||||
|
||||
const config = {
|
||||
entry: glob.sync('./test/*.ts'),
|
||||
entry: [...glob.sync(path.join(__dirname, 'test/shared/**/*.ts')), ...glob.sync(path.join(__dirname, 'test/browser/**/*.ts'))],
|
||||
mode: 'development',
|
||||
devtool: 'source-map',
|
||||
devServer: {
|
||||
|
@ -41,4 +41,4 @@ const config = {
|
|||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
export = config;
|
Загрузка…
Ссылка в новой задаче