Skip to content
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

test(bazel): fix test for @angular/common ng_package #23153

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 3 additions & 5 deletions packages/bazel/test/ng_package/common_package.spec.ts
Expand Up @@ -13,18 +13,16 @@ import * as shx from 'shelljs';
shx.cd(path.join(process.env['TEST_SRCDIR'], 'angular', 'packages', 'common', 'npm_package'));

describe('@angular/common ng_package', () => {
it('should have the locales files', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is giving false positives :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could make up for this mistake by writing a tslint or tsetse.info check so no one ever falls in this hole again. "the compiler could have caught it" is my mantra

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much Alex, I’d give it a shoot and try to create a tsetse rule

describe('should have the locales files', () => {
it('/locales', () => {
const files = shx.ls('-R', 'locales').stdout.split('\n');
const files = shx.ls('locales').stdout.split('\n');
expect(files.some(n => n.endsWith('.d.ts'))).toBe(true, `.d.ts files don't exist`);
expect(files.some(n => n.endsWith('.js'))).toBe(true, `.js files don't exist`);
expect(files.some(n => n.endsWith('.js.map'))).toBe(true, `.js.map files don't exist`);
});
it('/locales/extra', () => {
const files = shx.ls('-R', 'locales/extra').stdout.split('\n');
const files = shx.ls('locales/extra').stdout.split('\n');
expect(files.some(n => n.endsWith('.d.ts'))).toBe(true, `.d.ts files don't exist`);
expect(files.some(n => n.endsWith('.js'))).toBe(true, `.js files don't exist`);
expect(files.some(n => n.endsWith('.js.map'))).toBe(true, `.js.map files don't exist`);
});
});

Expand Down
4 changes: 1 addition & 3 deletions packages/common/BUILD.bazel
Expand Up @@ -25,10 +25,8 @@ ng_package(
"//packages/common/http/testing:package.json",
"//packages/common/testing:package.json",
],
data = [
"//packages/common/locales",
],
entry_point = "packages/common/index.js",
packages = ["//packages/common/locales:package"],
tags = ["release-with-framework"],
deps = [
"//packages/common",
Expand Down
7 changes: 6 additions & 1 deletion packages/common/locales/BUILD.bazel
@@ -1,6 +1,6 @@
package(default_visibility = ["//visibility:public"])

load("//tools:defaults.bzl", "ts_library")
load("//tools:defaults.bzl", "ts_library", "npm_package")

ts_library(
name = "locales",
Expand All @@ -10,3 +10,8 @@ ts_library(
),
module_name = "@angular/common/locales",
)

npm_package(
name = "package",
deps = [":locales"],
)