-
Notifications
You must be signed in to change notification settings - Fork 60
/
consumer-test.js
35 lines (31 loc) · 1.15 KB
/
consumer-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const execa = require("execa");
let versions = ["3.0", "3.1", "3.2", "3.3", "3.4"];
if (!process.env.SKIP_LATEST) {
versions.push("latest");
}
async function exec(cmd) {
const command = execa.shell(cmd, { cwd: "./consumer-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(`Compling with typescript@${version} - Basic`);
await exec(`npx -p typescript@${version} tsc ./test.ts --allowSyntheticDefaultImports true`);
console.log(`Compling with typescript@${version} - Custom lib`);
await exec(`npx -p typescript@${version} tsc ./test.ts --allowSyntheticDefaultImports true --lib es2018`);
}
process.exit(0);
} catch (error) {
console.log("Typescript consumer test failed!");
console.log(error);
process.exit(1);
}
})();