Skip to content

Commit

Permalink
Enable type validation for all client packages (#9673)
Browse files Browse the repository at this point in the history
This change uses a new improved version of the type validation tool to generate validation tests for all packages (#9674).

Generally this change in all done via automation, but there are a couple other changes.

Remove type validation from existing packages, and move to new model
Fix fluid-build non-conformant packages
All automatic type validation generation is removed. It is to slow to run on every build. It should only need to be run after release, and in the presence of new breaking changes that must be suppressed
  • Loading branch information
anthony-murphy authored Mar 31, 2022
1 parent 40a0e58 commit 5681a58
Show file tree
Hide file tree
Showing 172 changed files with 20,767 additions and 11,821 deletions.
3,286 changes: 2,189 additions & 1,097 deletions lerna-package-lock.json

Large diffs are not rendered by default.

87 changes: 42 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
"tsc:fast": "fluid-build --root . -s tsc",
"tsfmt": "lerna run tsfmt:fix --no-sort --stream --no-bail",
"tsfmt:fix": "lerna run tsfmt:fix --no-sort --stream --no-bail",
"typetests:gen": "fluid-type-validator -m packages -v",
"typetests:prepare": "npm run typetests:gen -- -p",
"watch": "concurrently \"npm run watch:tsc\" \"npm run watch:esnext\" \"npm run watch:webpack\"",
"watch:esnext": "lerna run --parallel build:esnext -- -- --watch",
"watch:tsc": "lerna run --parallel tsc -- -- --watch",
Expand Down Expand Up @@ -107,7 +109,7 @@
"temp-directory": "nyc/.nyc_output"
},
"devDependencies": {
"@fluidframework/build-tools": "^0.2.58041",
"@fluidframework/build-tools": "^0.2.59529",
"@fluidframework/test-tools": "^0.2.3074",
"@microsoft/api-documenter": "^7.12.7",
"@microsoft/api-extractor": "^7.16.1",
Expand Down
9 changes: 7 additions & 2 deletions packages/dds/cell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"lint:fix": "npm run eslint:fix",
"test": "npm run test:mocha",
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
"test:mocha": "mocha --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
"tsc": "tsc",
"tsfmt": "tsfmt --verify",
Expand Down Expand Up @@ -70,6 +70,7 @@
"devDependencies": {
"@fluid-internal/test-dds-utils": "^0.58.3000",
"@fluidframework/build-common": "^0.23.0",
"@fluidframework/cell-previous": "npm:@fluidframework/[email protected]",
"@fluidframework/eslint-config-fluid": "^0.27.0",
"@fluidframework/mocha-test-setup": "^0.58.3000",
"@fluidframework/test-runtime-utils": "^0.58.3000",
Expand All @@ -94,5 +95,9 @@
"rimraf": "^2.6.2",
"typescript": "~4.1.3",
"typescript-formatter": "7.1.0"
},
"typeValidation": {
"version": "0.58.3000",
"broken": {}
}
}
}
87 changes: 87 additions & 0 deletions packages/dds/cell/src/test/types/validateCellPrevious.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
/*
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
* Generated by fluid-type-validator in @fluidframework/build-tools.
*/
/* eslint-disable max-lines */
import * as old from "@fluidframework/cell-previous";
import * as current from "../../index";

type TypeOnly<T> = {
[P in keyof T]: TypeOnly<T[P]>;
};

/*
* Validate forward compat by using old type in place of current type
* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:
* "InterfaceDeclaration_ISharedCell": {"forwardCompat": false}
*/
declare function get_old_InterfaceDeclaration_ISharedCell():
TypeOnly<old.ISharedCell>;
declare function use_current_InterfaceDeclaration_ISharedCell(
use: TypeOnly<current.ISharedCell>);
use_current_InterfaceDeclaration_ISharedCell(
get_old_InterfaceDeclaration_ISharedCell());

/*
* Validate back compat by using current type in place of old type
* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:
* "InterfaceDeclaration_ISharedCell": {"backCompat": false}
*/
declare function get_current_InterfaceDeclaration_ISharedCell():
TypeOnly<current.ISharedCell>;
declare function use_old_InterfaceDeclaration_ISharedCell(
use: TypeOnly<old.ISharedCell>);
use_old_InterfaceDeclaration_ISharedCell(
get_current_InterfaceDeclaration_ISharedCell());

/*
* Validate forward compat by using old type in place of current type
* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:
* "InterfaceDeclaration_ISharedCellEvents": {"forwardCompat": false}
*/
declare function get_old_InterfaceDeclaration_ISharedCellEvents():
TypeOnly<old.ISharedCellEvents<any>>;
declare function use_current_InterfaceDeclaration_ISharedCellEvents(
use: TypeOnly<current.ISharedCellEvents<any>>);
use_current_InterfaceDeclaration_ISharedCellEvents(
get_old_InterfaceDeclaration_ISharedCellEvents());

/*
* Validate back compat by using current type in place of old type
* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:
* "InterfaceDeclaration_ISharedCellEvents": {"backCompat": false}
*/
declare function get_current_InterfaceDeclaration_ISharedCellEvents():
TypeOnly<current.ISharedCellEvents<any>>;
declare function use_old_InterfaceDeclaration_ISharedCellEvents(
use: TypeOnly<old.ISharedCellEvents<any>>);
use_old_InterfaceDeclaration_ISharedCellEvents(
get_current_InterfaceDeclaration_ISharedCellEvents());

/*
* Validate forward compat by using old type in place of current type
* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:
* "ClassDeclaration_SharedCell": {"forwardCompat": false}
*/
declare function get_old_ClassDeclaration_SharedCell():
TypeOnly<old.SharedCell>;
declare function use_current_ClassDeclaration_SharedCell(
use: TypeOnly<current.SharedCell>);
use_current_ClassDeclaration_SharedCell(
get_old_ClassDeclaration_SharedCell());

/*
* Validate back compat by using current type in place of old type
* If breaking change required, add in package.json under typeValidation.broken.0.58.2000:
* "ClassDeclaration_SharedCell": {"backCompat": false}
*/
declare function get_current_ClassDeclaration_SharedCell():
TypeOnly<current.SharedCell>;
declare function use_old_ClassDeclaration_SharedCell(
use: TypeOnly<old.SharedCell>);
use_old_ClassDeclaration_SharedCell(
get_current_ClassDeclaration_SharedCell());
9 changes: 7 additions & 2 deletions packages/dds/counter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"lint:fix": "npm run eslint:fix",
"test": "npm run test:mocha",
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
"test:mocha": "mocha --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
"tsc": "tsc"
},
Expand Down Expand Up @@ -67,6 +67,7 @@
},
"devDependencies": {
"@fluidframework/build-common": "^0.23.0",
"@fluidframework/counter-previous": "npm:@fluidframework/[email protected]",
"@fluidframework/eslint-config-fluid": "^0.27.0",
"@fluidframework/mocha-test-setup": "^0.58.3000",
"@fluidframework/test-runtime-utils": "^0.58.3000",
Expand All @@ -90,5 +91,9 @@
"nyc": "^15.0.0",
"rimraf": "^2.6.2",
"typescript": "~4.1.3"
},
"typeValidation": {
"version": "0.58.3000",
"broken": {}
}
}
}
Loading

0 comments on commit 5681a58

Please sign in to comment.