-
Notifications
You must be signed in to change notification settings - Fork 585
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5cbc92b
commit 616bd3a
Showing
5 changed files
with
38 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Validate the tslib and tsc version is consistent and corresponds to each other. | ||
*/ | ||
import { execSync } from "child_process"; | ||
import { readFileSync } from "fs"; | ||
import JSON from "json5"; | ||
import { join } from "path"; | ||
|
||
type PackageInfo = { | ||
name: string; | ||
version: string; | ||
private: boolean; | ||
location: string; | ||
}; | ||
|
||
test("tslib and tsc version should be consistent within workspace.", () => { | ||
const expectedVersions: { [name: string]: string } = JSON.parse( | ||
readFileSync(join(__dirname, "versions.jsonc"), "utf8") | ||
); | ||
const packagesInfo: PackageInfo[] = JSON.parse(execSync("./node_modules/.bin/lerna list -l --json").toString()); | ||
for (const { name, location } of packagesInfo) { | ||
const manifest = readFileSync(`${location}/package.json`, "utf8"); | ||
const { dependencies, devDependencies } = JSON.parse(manifest); | ||
for (const [expectedName, expectedVersion] of Object.entries(expectedVersions)) { | ||
if (expectedName === name) { | ||
const actualVersion = dependencies[expectedName] || devDependencies[expectedName]; | ||
if (actualVersion !== expectedVersion) { | ||
fail(`Expected version ${expectedVersion} for ${name} in ${location}, but got ${actualVersion}`); | ||
} | ||
} | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testMatch: ["**/*.spec.ts"], | ||
}; |
This file was deleted.
Oops, something went wrong.
File renamed without changes.