test(bazel): Integration test for Sass support (#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 #28297
This commit is contained in:
parent
bb94434d85
commit
c84739dc55
|
@ -23,7 +23,7 @@
|
||||||
"src/assets"
|
"src/assets"
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
"src/styles.css"
|
"src/styles.scss"
|
||||||
],
|
],
|
||||||
"scripts": []
|
"scripts": []
|
||||||
},
|
},
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
"tsConfig": "src/tsconfig.spec.json",
|
"tsConfig": "src/tsconfig.spec.json",
|
||||||
"karmaConfig": "src/karma.conf.js",
|
"karmaConfig": "src/karma.conf.js",
|
||||||
"styles": [
|
"styles": [
|
||||||
"src/styles.css"
|
"src/styles.scss"
|
||||||
],
|
],
|
||||||
"scripts": [],
|
"scripts": [],
|
||||||
"assets": [
|
"assets": [
|
||||||
|
|
|
@ -7,10 +7,11 @@ function testBazel() {
|
||||||
bazel version
|
bazel version
|
||||||
rm -rf demo
|
rm -rf demo
|
||||||
# Create project
|
# Create project
|
||||||
ng new demo --collection=@angular/bazel --defaults --skip-git
|
ng new demo --collection=@angular/bazel --defaults --skip-git --style=scss
|
||||||
node replace_angular_repo.js "./demo/WORKSPACE"
|
node replace_angular_repo.js "./demo/WORKSPACE"
|
||||||
cd demo
|
cd demo
|
||||||
cp ../package.json.replace ./package.json
|
cp ../package.json.replace ./package.json
|
||||||
|
ng generate component widget --style=css
|
||||||
ng build
|
ng build
|
||||||
ng test
|
ng test
|
||||||
ng e2e
|
ng e2e
|
||||||
|
|
|
@ -91,32 +91,17 @@ describe('Bazel-workspace Schematic', () => {
|
||||||
expect(host.files).toContain('/src/BUILD.bazel');
|
expect(host.files).toContain('/src/BUILD.bazel');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should download rules_sass in WORKSPACE', () => {
|
it('should download and load rules_sass in WORKSPACE', () => {
|
||||||
const content = host.readContent('/WORKSPACE');
|
const content = host.readContent('/WORKSPACE');
|
||||||
expect(content).toContain('RULES_SASS_VERSION');
|
expect(content).toContain('RULES_SASS_VERSION');
|
||||||
expect(content).toContain('io_bazel_rules_sass');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should load sass_repositories in WORKSPACE', () => {
|
|
||||||
const content = host.readContent('/WORKSPACE');
|
|
||||||
expect(content).toContain(
|
expect(content).toContain(
|
||||||
'load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")');
|
'load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")');
|
||||||
expect(content).toContain('sass_repositories()');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add sass_binary rules in src/BUILD', () => {
|
it('should add sass_binary rules in src/BUILD', () => {
|
||||||
const content = host.readContent('/src/BUILD.bazel');
|
const content = host.readContent('/src/BUILD.bazel');
|
||||||
expect(content).toContain('load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")');
|
expect(content).toContain('load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")');
|
||||||
expect(content).toMatch(/sass_binary\((.*\n)+\)/);
|
expect(content).toContain('glob(["**/*.scss"])');
|
||||||
});
|
|
||||||
|
|
||||||
it('should add SASS targets to assets of ng_module in src/BUILD', () => {
|
|
||||||
const content = host.readContent('/src/BUILD.bazel');
|
|
||||||
expect(content).toContain(`
|
|
||||||
assets = glob([
|
|
||||||
"**/*.css",
|
|
||||||
"**/*.html",
|
|
||||||
]) + [":style_" + x for x in glob(["**/*.scss"])],`);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue