Skip to content

Commit c84739d

Browse files
Keen Yee Liaujasonaden
authored andcommitted
test(bazel): Integration test for Sass support (angular#28297)
Add .sass files to the integration test for bazel-schematics. Also addressed Alex's comment in https://github.com/angular/angular/pull/28167/files#r248149866 about the unit tests being too brittle. PR Close angular#28297
1 parent bb94434 commit c84739d

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

integration/bazel-schematics/angular.json.original

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"src/assets"
2424
],
2525
"styles": [
26-
"src/styles.css"
26+
"src/styles.scss"
2727
],
2828
"scripts": []
2929
},
@@ -82,7 +82,7 @@
8282
"tsConfig": "src/tsconfig.spec.json",
8383
"karmaConfig": "src/karma.conf.js",
8484
"styles": [
85-
"src/styles.css"
85+
"src/styles.scss"
8686
],
8787
"scripts": [],
8888
"assets": [

integration/bazel-schematics/test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ function testBazel() {
77
bazel version
88
rm -rf demo
99
# Create project
10-
ng new demo --collection=@angular/bazel --defaults --skip-git
10+
ng new demo --collection=@angular/bazel --defaults --skip-git --style=scss
1111
node replace_angular_repo.js "./demo/WORKSPACE"
1212
cd demo
1313
cp ../package.json.replace ./package.json
14+
ng generate component widget --style=css
1415
ng build
1516
ng test
1617
ng e2e

packages/bazel/src/schematics/bazel-workspace/index_spec.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,32 +91,17 @@ describe('Bazel-workspace Schematic', () => {
9191
expect(host.files).toContain('/src/BUILD.bazel');
9292
});
9393

94-
it('should download rules_sass in WORKSPACE', () => {
94+
it('should download and load rules_sass in WORKSPACE', () => {
9595
const content = host.readContent('/WORKSPACE');
9696
expect(content).toContain('RULES_SASS_VERSION');
97-
expect(content).toContain('io_bazel_rules_sass');
98-
});
99-
100-
it('should load sass_repositories in WORKSPACE', () => {
101-
const content = host.readContent('/WORKSPACE');
10297
expect(content).toContain(
10398
'load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")');
104-
expect(content).toContain('sass_repositories()');
10599
});
106100

107101
it('should add sass_binary rules in src/BUILD', () => {
108102
const content = host.readContent('/src/BUILD.bazel');
109103
expect(content).toContain('load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")');
110-
expect(content).toMatch(/sass_binary\((.*\n)+\)/);
111-
});
112-
113-
it('should add SASS targets to assets of ng_module in src/BUILD', () => {
114-
const content = host.readContent('/src/BUILD.bazel');
115-
expect(content).toContain(`
116-
assets = glob([
117-
"**/*.css",
118-
"**/*.html",
119-
]) + [":style_" + x for x in glob(["**/*.scss"])],`);
104+
expect(content).toContain('glob(["**/*.scss"])');
120105
});
121106
});
122107
});

0 commit comments

Comments
 (0)