From f44d4594534c425a3231d90175e75bd69074f3a7 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 17 Apr 2018 13:59:30 -0700 Subject: [PATCH 1/2] Add axios' source to user tests We already have the npm-installed version in order to test their d.ts so that we don't break their users. --- .gitmodules | 5 ++ tests/baselines/reference/user/axios-src.log | 66 ++++++++++++++++++++ tests/cases/user/axios-src/axios-src | 1 + tests/cases/user/axios-src/test.json | 3 + tests/cases/user/axios-src/tsconfig.json | 18 ++++++ 5 files changed, 93 insertions(+) create mode 100644 tests/baselines/reference/user/axios-src.log create mode 160000 tests/cases/user/axios-src/axios-src create mode 100644 tests/cases/user/axios-src/test.json create mode 100644 tests/cases/user/axios-src/tsconfig.json diff --git a/.gitmodules b/.gitmodules index ccb2be81520b9..a84341b761d04 100644 --- a/.gitmodules +++ b/.gitmodules @@ -29,3 +29,8 @@ [submodule "tests/cases/user/puppeteer/puppeteer"] path = tests/cases/user/puppeteer/puppeteer url = https://github.com/GoogleChrome/puppeteer.git + ignore = all +[submodule "tests/cases/user/axios-src/axios-src"] + path = tests/cases/user/axios-src/axios-src + url = https://github.com/axios/axios.git + ignore = all diff --git a/tests/baselines/reference/user/axios-src.log b/tests/baselines/reference/user/axios-src.log new file mode 100644 index 0000000000000..60d232b1c26a8 --- /dev/null +++ b/tests/baselines/reference/user/axios-src.log @@ -0,0 +1,66 @@ +Exit Code: 1 +Standard output: +examples/server.js(81,30): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. + Type 'undefined' is not assignable to type 'string'. +examples/server.js(85,31): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. + Type 'undefined' is not assignable to type 'string'. +examples/server.js(89,35): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. + Type 'undefined' is not assignable to type 'string'. +examples/server.js(93,36): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. + Type 'undefined' is not assignable to type 'string'. +examples/server.js(105,18): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. + Type 'undefined' is not assignable to type 'string'. +examples/server.js(110,15): error TS2532: Object is possibly 'undefined'. +examples/server.js(116,27): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. + Type 'undefined' is not assignable to type 'string'. +examples/server.js(117,44): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. + Type 'undefined' is not assignable to type 'string'. +examples/server.js(125,64): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. + Type 'undefined' is not assignable to type 'string'. +lib/adapters/http.js(12,19): error TS2307: Cannot find module './../../package.json'. +lib/adapters/http.js(83,22): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. + Type 'undefined' is not assignable to type 'string'. +lib/adapters/http.js(189,23): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. +lib/adapters/http.js(195,44): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. +lib/adapters/http.js(201,13): error TS2322: Type 'string' is not assignable to type 'Buffer'. +lib/adapters/http.js(213,40): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. +lib/adapters/http.js(237,42): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. +lib/adapters/xhr.js(29,16): error TS2339: Property 'XDomainRequest' does not exist on type 'Window'. +lib/adapters/xhr.js(31,28): error TS2339: Property 'XDomainRequest' does not exist on type 'Window'. +lib/adapters/xhr.js(80,7): error TS2322: Type 'null' is not assignable to type 'XMLHttpRequest'. +lib/adapters/xhr.js(92,7): error TS2322: Type 'null' is not assignable to type 'XMLHttpRequest'. +lib/adapters/xhr.js(99,51): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. +lib/adapters/xhr.js(102,7): error TS2322: Type 'null' is not assignable to type 'XMLHttpRequest'. +lib/adapters/xhr.js(111,7): error TS2322: Type 'null' is not assignable to type 'XMLHttpRequest'. +lib/adapters/xhr.js(181,9): error TS2322: Type 'null' is not assignable to type 'XMLHttpRequest'. +lib/axios.js(23,3): error TS2554: Expected 3 arguments, but got 2. +lib/axios.js(25,3): error TS2322: Type '(...args: any[]) => any' is not assignable to type 'Axios'. + Property 'defaults' is missing in type '(...args: any[]) => any'. +lib/axios.js(32,7): error TS2339: Property 'Axios' does not exist on type 'Axios'. +lib/axios.js(35,7): error TS2339: Property 'create' does not exist on type 'Axios'. +lib/axios.js(40,7): error TS2339: Property 'Cancel' does not exist on type 'Axios'. +lib/axios.js(41,7): error TS2339: Property 'CancelToken' does not exist on type 'Axios'. +lib/axios.js(42,7): error TS2339: Property 'isCancel' does not exist on type 'Axios'. +lib/axios.js(45,7): error TS2339: Property 'all' does not exist on type 'Axios'. +lib/axios.js(48,7): error TS2339: Property 'spread' does not exist on type 'Axios'. +lib/cancel/CancelToken.js(37,12): error TS2339: Property 'reason' does not exist on type 'CancelToken'. +lib/cancel/CancelToken.js(38,16): error TS2339: Property 'reason' does not exist on type 'CancelToken'. +lib/core/enhanceError.js(14,9): error TS2339: Property 'config' does not exist on type 'Error'. +lib/core/enhanceError.js(16,11): error TS2339: Property 'code' does not exist on type 'Error'. +lib/core/enhanceError.js(18,9): error TS2339: Property 'request' does not exist on type 'Error'. +lib/core/enhanceError.js(19,9): error TS2339: Property 'response' does not exist on type 'Error'. +lib/core/settle.js(21,7): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'. +lib/helpers/btoa.js(11,13): error TS2339: Property 'code' does not exist on type 'Error'. +lib/helpers/btoa.js(31,13): error TS2532: Object is possibly 'undefined'. +lib/helpers/cookies.js(16,56): error TS2551: Property 'toGMTString' does not exist on type 'Date'. Did you mean 'toUTCString'? +lib/utils.js(244,20): error TS8029: JSDoc '@param' tag has name 'obj1', but there is no parameter with that name. It would match 'arguments' if it had an array type. +lib/utils.js(268,20): error TS8029: JSDoc '@param' tag has name 'obj1', but there is no parameter with that name. It would match 'arguments' if it had an array type. +sandbox/client.js(13,7): error TS2339: Property 'get' does not exist on type 'typeof import("/home/nathansa/ts/tests/cases/user/axios-src/axios-src/index")'. +sandbox/client.js(18,7): error TS2339: Property 'post' does not exist on type 'typeof import("/home/nathansa/ts/tests/cases/user/axios-src/axios-src/index")'. +sandbox/server.js(20,26): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. + Type 'undefined' is not assignable to type 'string'. +../tsconfig.json(15,9): error TS1005: ',' expected. + + + +Standard error: diff --git a/tests/cases/user/axios-src/axios-src b/tests/cases/user/axios-src/axios-src new file mode 160000 index 0000000000000..0b3db5d87a60a --- /dev/null +++ b/tests/cases/user/axios-src/axios-src @@ -0,0 +1 @@ +Subproject commit 0b3db5d87a60a1ad8b0dce9669dbc10483ec33da diff --git a/tests/cases/user/axios-src/test.json b/tests/cases/user/axios-src/test.json new file mode 100644 index 0000000000000..b6495a1b80ba2 --- /dev/null +++ b/tests/cases/user/axios-src/test.json @@ -0,0 +1,3 @@ +{ + "types": ["node"] +} diff --git a/tests/cases/user/axios-src/tsconfig.json b/tests/cases/user/axios-src/tsconfig.json new file mode 100644 index 0000000000000..bfc6fe7537e6a --- /dev/null +++ b/tests/cases/user/axios-src/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "noImplicitAny": false, + "noImplicitThis": false, + "maxNodeModuleJsDepth": 0, + "strict": true, + "noEmit": true, + "allowJs": true, + "checkJs": true, + "types": ["node"], + "lib": ["esnext", "dom"], + }, + "include": [ + "axios-src/examples" + "axios-src/lib", + "axios-src/sandbox", + ] +} From b2d862a7431c6c1d55ecd96b22ef931970eb007c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 17 Apr 2018 15:00:08 -0700 Subject: [PATCH 2/2] Just compile lib, plus fix some config lint --- .gitmodules | 2 +- tests/baselines/reference/user/axios-src.log | 22 -------------------- tests/cases/user/axios-src/tsconfig.json | 6 +----- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/.gitmodules b/.gitmodules index a84341b761d04..fdf474a693d10 100644 --- a/.gitmodules +++ b/.gitmodules @@ -29,7 +29,7 @@ [submodule "tests/cases/user/puppeteer/puppeteer"] path = tests/cases/user/puppeteer/puppeteer url = https://github.com/GoogleChrome/puppeteer.git - ignore = all + ignore = all [submodule "tests/cases/user/axios-src/axios-src"] path = tests/cases/user/axios-src/axios-src url = https://github.com/axios/axios.git diff --git a/tests/baselines/reference/user/axios-src.log b/tests/baselines/reference/user/axios-src.log index 60d232b1c26a8..ad8bc285bbb31 100644 --- a/tests/baselines/reference/user/axios-src.log +++ b/tests/baselines/reference/user/axios-src.log @@ -1,22 +1,5 @@ Exit Code: 1 Standard output: -examples/server.js(81,30): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. - Type 'undefined' is not assignable to type 'string'. -examples/server.js(85,31): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. - Type 'undefined' is not assignable to type 'string'. -examples/server.js(89,35): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. - Type 'undefined' is not assignable to type 'string'. -examples/server.js(93,36): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. - Type 'undefined' is not assignable to type 'string'. -examples/server.js(105,18): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. - Type 'undefined' is not assignable to type 'string'. -examples/server.js(110,15): error TS2532: Object is possibly 'undefined'. -examples/server.js(116,27): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. - Type 'undefined' is not assignable to type 'string'. -examples/server.js(117,44): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. - Type 'undefined' is not assignable to type 'string'. -examples/server.js(125,64): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. - Type 'undefined' is not assignable to type 'string'. lib/adapters/http.js(12,19): error TS2307: Cannot find module './../../package.json'. lib/adapters/http.js(83,22): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. @@ -55,11 +38,6 @@ lib/helpers/btoa.js(31,13): error TS2532: Object is possibly 'undefined'. lib/helpers/cookies.js(16,56): error TS2551: Property 'toGMTString' does not exist on type 'Date'. Did you mean 'toUTCString'? lib/utils.js(244,20): error TS8029: JSDoc '@param' tag has name 'obj1', but there is no parameter with that name. It would match 'arguments' if it had an array type. lib/utils.js(268,20): error TS8029: JSDoc '@param' tag has name 'obj1', but there is no parameter with that name. It would match 'arguments' if it had an array type. -sandbox/client.js(13,7): error TS2339: Property 'get' does not exist on type 'typeof import("/home/nathansa/ts/tests/cases/user/axios-src/axios-src/index")'. -sandbox/client.js(18,7): error TS2339: Property 'post' does not exist on type 'typeof import("/home/nathansa/ts/tests/cases/user/axios-src/axios-src/index")'. -sandbox/server.js(20,26): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. - Type 'undefined' is not assignable to type 'string'. -../tsconfig.json(15,9): error TS1005: ',' expected. diff --git a/tests/cases/user/axios-src/tsconfig.json b/tests/cases/user/axios-src/tsconfig.json index bfc6fe7537e6a..ef3f63dc12643 100644 --- a/tests/cases/user/axios-src/tsconfig.json +++ b/tests/cases/user/axios-src/tsconfig.json @@ -10,9 +10,5 @@ "types": ["node"], "lib": ["esnext", "dom"], }, - "include": [ - "axios-src/examples" - "axios-src/lib", - "axios-src/sandbox", - ] + "include": ["axios-src/lib"] }