bazel: check cycle test
This commit is contained in:
26
BUILD
26
BUILD
@ -853,3 +853,29 @@ public_api_test(
|
|||||||
public_api = ":public_api",
|
public_api = ":public_api",
|
||||||
size = "small",
|
size = "small",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
nodejs_test(
|
||||||
|
name = "check_cycle_test",
|
||||||
|
srcs = [
|
||||||
|
"//build_defs:check_cycle.js",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
":madge",
|
||||||
|
],
|
||||||
|
entry_point = "check_cycle.js",
|
||||||
|
data = [
|
||||||
|
":core",
|
||||||
|
":common",
|
||||||
|
":compiler",
|
||||||
|
":compiler-cli",
|
||||||
|
":forms",
|
||||||
|
":http",
|
||||||
|
":platform-browser",
|
||||||
|
":platform-browser-dynamic",
|
||||||
|
":platform-server",
|
||||||
|
":router",
|
||||||
|
":upgrade",
|
||||||
|
":tsc-wrapped",
|
||||||
|
],
|
||||||
|
size = "small",
|
||||||
|
)
|
||||||
|
@ -5,4 +5,5 @@ exports_files([
|
|||||||
"rollup_config_template.js",
|
"rollup_config_template.js",
|
||||||
"protractor_launcher_template.sh",
|
"protractor_launcher_template.sh",
|
||||||
"ts_api_guardian_launcher_template.sh",
|
"ts_api_guardian_launcher_template.sh",
|
||||||
|
"check_cycle.js",
|
||||||
])
|
])
|
||||||
|
16
build_defs/check_cycle.js
Normal file
16
build_defs/check_cycle.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const madge = require('madge');
|
||||||
|
|
||||||
|
const dependencyObject = madge([process.env.RUNFILES + '/modules/'], {
|
||||||
|
format: 'cjs',
|
||||||
|
extensions: ['.js'],
|
||||||
|
onParseFile: function(data) { data.src = data.src.replace(/\/\* circular \*\//g, '//'); }
|
||||||
|
});
|
||||||
|
|
||||||
|
const circularDependencies = dependencyObject.circular().getArray();
|
||||||
|
if (circularDependencies.length > 0) {
|
||||||
|
console.log('Found circular dependencies!');
|
||||||
|
console.log(circularDependencies);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
Reference in New Issue
Block a user