Skip to content

build: schematics unit tests not being run #22293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/cdk/schematics/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin", "pkg_npm")
load("//:packages.bzl", "VERSION_PLACEHOLDER_REPLACEMENTS")
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")

package(default_visibility = ["//visibility:public"])

filegroup(
copy_to_bin(
name = "schematics_assets",
srcs = glob([
"**/files/**/*",
Expand Down Expand Up @@ -47,9 +47,11 @@ ts_library(
# This package is intended to be combined into the main @angular/cdk package as a dep.
pkg_npm(
name = "npm_package",
srcs = [":schematics_assets"],
substitutions = VERSION_PLACEHOLDER_REPLACEMENTS,
deps = [":schematics"],
deps = [
":schematics",
":schematics_assets",
],
)

### Testing rules
Expand Down
13 changes: 0 additions & 13 deletions src/cdk/schematics/index.spec.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/cdk/schematics/ng-add/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Tree} from '@angular-devkit/schematics';
import {SchematicTestRunner} from '@angular-devkit/schematics/testing';
import {COLLECTION_PATH} from '../index.spec';
import {COLLECTION_PATH} from '../paths';
import {createTestApp, getFileContent} from '../testing';
import {addPackageToPackageJson} from './package-config';

Expand Down
2 changes: 1 addition & 1 deletion src/cdk/schematics/ng-generate/drag-drop/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {SchematicTestRunner} from '@angular-devkit/schematics/testing';
import {COLLECTION_PATH} from '../../index.spec';
import {COLLECTION_PATH} from '../../paths';
import {createTestApp, getFileContent} from '../../testing';
import {Schema} from './schema';

Expand Down
2 changes: 1 addition & 1 deletion src/cdk/schematics/ng-update/test-cases/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {defineJasmineTestCases, findBazelVersionTestCases} from '@angular/cdk/schematics/testing';
import {MIGRATION_PATH} from '../../index.spec';
import {MIGRATION_PATH} from '../../paths';
import {getAllVersionNames} from '../../update-tool/target-version';

describe('CDK upgrade test cases', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {resolveBazelPath} from '@angular/cdk/schematics/testing';
import {MIGRATION_PATH} from '../../../index.spec';
import {MIGRATION_PATH} from '../../../paths';
import {createTestCaseSetup} from '../../../testing';

describe('ng-update external resource resolution', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {resolveBazelPath} from '@angular/cdk/schematics/testing';
import {readFileSync} from 'fs';
import {MIGRATION_PATH} from '../../../index.spec';
import {MIGRATION_PATH} from '../../../paths';
import {createTestCaseSetup} from '../../../testing';

describe('global stylesheets migration', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {resolveBazelPath} from '@angular/cdk/schematics/testing';
import {MIGRATION_PATH} from '../../../index.spec';
import {MIGRATION_PATH} from '../../../paths';
import {createTestCaseSetup} from '../../../testing';

describe('v6 method call checks', () => {
Expand Down
15 changes: 15 additions & 0 deletions src/cdk/schematics/paths.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {join} from 'path';

/** Path to the schematic collection for non-migration schematics. */
export const COLLECTION_PATH = join(__dirname, 'collection.json');

/** Path to the schematic collection that includes the migrations. */
export const MIGRATION_PATH = join(__dirname, 'migration.json');
10 changes: 6 additions & 4 deletions src/material/schematics/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin", "pkg_npm")
load("//:packages.bzl", "VERSION_PLACEHOLDER_REPLACEMENTS")
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")

package(default_visibility = ["//visibility:public"])

filegroup(
copy_to_bin(
name = "schematics_assets",
srcs = ["ng-update/migrations/hammer-gestures-v9/gesture-config.template"] + glob([
"ng-generate/*/files/**/*",
Expand Down Expand Up @@ -44,9 +44,11 @@ ts_library(
# This package is intended to be combined into the main @angular/material package as a dep.
pkg_npm(
name = "npm_package",
srcs = [":schematics_assets"],
substitutions = VERSION_PLACEHOLDER_REPLACEMENTS,
deps = [":schematics"],
deps = [
":schematics",
":schematics_assets",
],
)

### Testing rules
Expand Down
13 changes: 0 additions & 13 deletions src/material/schematics/index.spec.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/material/schematics/ng-add/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@angular/cdk/schematics';
import {createTestApp, createTestLibrary, getFileContent} from '@angular/cdk/schematics/testing';
import {getWorkspace} from '@schematics/angular/utility/workspace';
import {COLLECTION_PATH} from '../index.spec';
import {COLLECTION_PATH} from '../paths';
import {addPackageToPackageJson} from './package-config';

interface PackageJson {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {SchematicTestRunner} from '@angular-devkit/schematics/testing';
import {createTestApp, getFileContent} from '@angular/cdk/schematics/testing';
import {COLLECTION_PATH} from '../../index.spec';
import {COLLECTION_PATH} from '../../paths';
import {Schema} from './schema';

describe('Material address-form schematic', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {SchematicTestRunner} from '@angular-devkit/schematics/testing';
import {createTestApp, getFileContent} from '@angular/cdk/schematics/testing';
import {COLLECTION_PATH} from '../../index.spec';
import {COLLECTION_PATH} from '../../paths';
import {Schema} from './schema';

describe('material-dashboard-schematic', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {SchematicTestRunner, UnitTestTree} from '@angular-devkit/schematics/testing';
import {createTestApp, getFileContent} from '@angular/cdk/schematics/testing';
import {COLLECTION_PATH} from '../../index.spec';
import {COLLECTION_PATH} from '../../paths';

import {Schema} from './schema';

Expand Down
2 changes: 1 addition & 1 deletion src/material/schematics/ng-generate/table/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {SchematicTestRunner} from '@angular-devkit/schematics/testing';
import {createTestApp, getFileContent} from '@angular/cdk/schematics/testing';
import {COLLECTION_PATH} from '../../index.spec';
import {COLLECTION_PATH} from '../../paths';
import {Schema} from './schema';

describe('material-table-schematic', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/material/schematics/ng-generate/tree/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {SchematicTestRunner} from '@angular-devkit/schematics/testing';
import {createTestApp, getFileContent} from '@angular/cdk/schematics/testing';
import {COLLECTION_PATH} from '../../index.spec';
import {COLLECTION_PATH} from '../../paths';
import {Schema} from './schema';

describe('Material tree schematic', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/material/schematics/ng-update/test-cases/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {getAllVersionNames} from '@angular/cdk/schematics';
import {defineJasmineTestCases, findBazelVersionTestCases} from '@angular/cdk/schematics/testing';
import {MIGRATION_PATH} from '../../index.spec';
import {MIGRATION_PATH} from '../../paths';

describe('Material upgrade test cases', () => {
const versionNames = getAllVersionNames().map(versionName => versionName.toLowerCase());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {createTestCaseSetup, resolveBazelPath} from '@angular/cdk/schematics/testing';
import {MIGRATION_PATH} from '../../../index.spec';
import {MIGRATION_PATH} from '../../../paths';

describe('class inheritance misc checks', () => {
describe('v6 class which extends MatFormFieldControl', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {createTestCaseSetup, resolveBazelPath} from '@angular/cdk/schematics/testing';
import {MIGRATION_PATH} from '../../../index.spec';
import {MIGRATION_PATH} from '../../../paths';

describe('constructor checks', () => {
it('should properly report invalid constructor expression signatures', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {createTestCaseSetup, resolveBazelPath} from '@angular/cdk/schematics/testing';
import {MIGRATION_PATH} from '../../../index.spec';
import {MIGRATION_PATH} from '../../../paths';

describe('v6 import misc checks', () => {
it('should report imports for deleted animation constants', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
readFileContent,
resolveBazelPath
} from '@angular/cdk/schematics/testing';
import {MIGRATION_PATH} from '../../../../index.spec';
import {MIGRATION_PATH} from '../../../../paths';

describe('v8 material imports', () => {
it('should re-map top-level material imports to the proper entry points', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {dedent} from '@angular/cdk/testing/private';
import {addPackageToPackageJson} from '@angular/cdk/schematics/ng-add/package-config';
import {createTestCaseSetup, resolveBazelPath} from '@angular/cdk/schematics/testing';
import {readFileSync} from 'fs';
import {MIGRATION_PATH} from '../../../../index.spec';
import {MIGRATION_PATH} from '../../../../paths';


interface PackageJson {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {createTestCaseSetup, readFileContent, resolveBazelPath} from '@angular/cdk/schematics/testing';
import {MIGRATION_PATH} from '../../../../index.spec';
import {MIGRATION_PATH} from '../../../../paths';

describe('v9 material imports', () => {
it('should re-map top-level material imports to the proper entry points when top-level ' +
Expand Down
15 changes: 15 additions & 0 deletions src/material/schematics/paths.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {join} from 'path';

/** Path to the schematic collection for non-migration schematics. */
export const COLLECTION_PATH = join(__dirname, 'collection.json');

/** Path to the schematic collection that includes the migrations. */
export const MIGRATION_PATH = join(__dirname, 'migration.json');