TS Consumer Smoke Test (#199)
* WIP * Rename files * Add back lib reference * Rename folder * Create ci script * Loop over array for TS test. Opt out of latest via env var * Log versions * Include ts-test * Clean up CI script * Remove compiled file
This commit is contained in:
Родитель
9679a34bcd
Коммит
0f5fc76f49
|
@ -260,3 +260,7 @@ node_modules
|
||||||
lib/**
|
lib/**
|
||||||
|
|
||||||
*.tgz
|
*.tgz
|
||||||
|
|
||||||
|
ts-test/package-lock.json
|
||||||
|
ts-test/package.json
|
||||||
|
ts-test/*.js
|
||||||
|
|
|
@ -4,5 +4,4 @@ notifications:
|
||||||
node_js:
|
node_js:
|
||||||
- 10
|
- 10
|
||||||
script:
|
script:
|
||||||
- npm run build
|
- npm run ci
|
||||||
- npm run test
|
|
||||||
|
|
|
@ -2866,13 +2866,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"execa": {
|
"execa": {
|
||||||
"version": "0.7.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
|
||||||
"integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=",
|
"integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"cross-spawn": "^5.0.1",
|
"cross-spawn": "^6.0.0",
|
||||||
"get-stream": "^3.0.0",
|
"get-stream": "^4.0.0",
|
||||||
"is-stream": "^1.1.0",
|
"is-stream": "^1.1.0",
|
||||||
"npm-run-path": "^2.0.0",
|
"npm-run-path": "^2.0.0",
|
||||||
"p-finally": "^1.0.0",
|
"p-finally": "^1.0.0",
|
||||||
|
@ -2880,15 +2880,23 @@
|
||||||
"strip-eof": "^1.0.0"
|
"strip-eof": "^1.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cross-spawn": {
|
"get-stream": {
|
||||||
"version": "5.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
|
||||||
"integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
|
"integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"lru-cache": "^4.0.1",
|
"pump": "^3.0.0"
|
||||||
"shebang-command": "^1.2.0",
|
}
|
||||||
"which": "^1.2.9"
|
},
|
||||||
|
"pump": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"end-of-stream": "^1.1.0",
|
||||||
|
"once": "^1.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6399,7 +6407,7 @@
|
||||||
},
|
},
|
||||||
"os-homedir": {
|
"os-homedir": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
"resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
||||||
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
@ -6412,6 +6420,34 @@
|
||||||
"execa": "^0.7.0",
|
"execa": "^0.7.0",
|
||||||
"lcid": "^1.0.0",
|
"lcid": "^1.0.0",
|
||||||
"mem": "^1.1.0"
|
"mem": "^1.1.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"cross-spawn": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
|
||||||
|
"integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"lru-cache": "^4.0.1",
|
||||||
|
"shebang-command": "^1.2.0",
|
||||||
|
"which": "^1.2.9"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"execa": {
|
||||||
|
"version": "0.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz",
|
||||||
|
"integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"cross-spawn": "^5.0.1",
|
||||||
|
"get-stream": "^3.0.0",
|
||||||
|
"is-stream": "^1.1.0",
|
||||||
|
"npm-run-path": "^2.0.0",
|
||||||
|
"p-finally": "^1.0.0",
|
||||||
|
"signal-exit": "^3.0.0",
|
||||||
|
"strip-eof": "^1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"os-tmpdir": {
|
"os-tmpdir": {
|
||||||
|
|
|
@ -33,7 +33,8 @@
|
||||||
"build-prod": "npm run clean && npm run check-format && npm run lint && npm run compile-prod && npm run docs && npm run webpack-prod",
|
"build-prod": "npm run clean && npm run check-format && npm run lint && npm run compile-prod && npm run docs && npm run webpack-prod",
|
||||||
"test": "mocha -r ./src/test/common/setup.ts ./lib/test/ --recursive --timeout 100000 -i -g .*ignore.js",
|
"test": "mocha -r ./src/test/common/setup.ts ./lib/test/ --recursive --timeout 100000 -i -g .*ignore.js",
|
||||||
"test-ts": "mocha -r ts-node/register -r ./src/test/common/setup.ts ./src/test/**/*.spec.ts --recursive --timeout 100000 -i -g .*ignore.js",
|
"test-ts": "mocha -r ts-node/register -r ./src/test/common/setup.ts ./src/test/**/*.spec.ts --recursive --timeout 100000 -i -g .*ignore.js",
|
||||||
"test-browser": "karma start ./karma.config.js --single-run"
|
"test-browser": "karma start ./karma.config.js --single-run",
|
||||||
|
"ci": "npm run build && npm run test && node ts-test.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/mocha": "^5.2.5",
|
"@types/mocha": "^5.2.5",
|
||||||
|
@ -43,6 +44,7 @@
|
||||||
"@types/sinon": "^4.3.3",
|
"@types/sinon": "^4.3.3",
|
||||||
"@types/tunnel": "^0.0.0",
|
"@types/tunnel": "^0.0.0",
|
||||||
"@types/underscore": "^1.8.8",
|
"@types/underscore": "^1.8.8",
|
||||||
|
"execa": "1.0.0",
|
||||||
"karma": "^3.0.0",
|
"karma": "^3.0.0",
|
||||||
"karma-chrome-launcher": "^2.2.0",
|
"karma-chrome-launcher": "^2.2.0",
|
||||||
"karma-cli": "^1.0.1",
|
"karma-cli": "^1.0.1",
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
const execa = require("execa");
|
||||||
|
|
||||||
|
let versions = ["3.0", "3.1"];
|
||||||
|
|
||||||
|
if (!process.env.SKIP_LATEST) {
|
||||||
|
versions.push("latest");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function exec(cmd) {
|
||||||
|
const command = execa.shell(cmd, { cwd: "./ts-test" });
|
||||||
|
command.stderr.pipe(process.stderr);
|
||||||
|
command.stdout.pipe(process.stdout);
|
||||||
|
return command;
|
||||||
|
}
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
console.log("Running typescript consumer test againast", versions);
|
||||||
|
await exec("npm init -y");
|
||||||
|
console.log("Setting up typescript consumer project");
|
||||||
|
await exec("npm install --save ./..");
|
||||||
|
console.log("Installing @azure/cosmos as a file dependency");
|
||||||
|
for (const version of versions) {
|
||||||
|
console.log(`Installing typescript@${version}`);
|
||||||
|
await exec(`npm install --save typescript@${version}`);
|
||||||
|
console.log(`Compling with typescript@${version}`);
|
||||||
|
await exec(`tsc ./test.ts --allowSyntheticDefaultImports true`);
|
||||||
|
}
|
||||||
|
process.exit(0);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Typescript consumer test failed!");
|
||||||
|
console.log(error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
})();
|
|
@ -0,0 +1,3 @@
|
||||||
|
import * as Cosmos from "@azure/cosmos";
|
||||||
|
|
||||||
|
console.log(Object.keys(Cosmos));
|
Загрузка…
Ссылка в новой задаче