浏览代码

assert all ts files

Daniel Zlotin 7 年前
父节点
当前提交
0c8e928adf
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10
    0
      scripts/test-js.js

+ 10
- 0
scripts/test-js.js 查看文件

@@ -16,5 +16,15 @@ run();
16 16
 function run() {
17 17
   const paths = _.chain(dirs).map((d) => `'${d}/**/*.[tj]s*'`).join(' ').value();
18 18
   exec.execSync(`tslint ${paths} ${fix} --format verbose`);
19
+  assertAllTsFilesInSrc();
19 20
   exec.execSync(`jest --coverage`);
20 21
 }
22
+
23
+function assertAllTsFilesInSrc() {
24
+  const allFiles = exec.execSyncRead('find ./lib/src -type f');
25
+  const lines = _.split(allFiles, '\n');
26
+  const offenders = _.filter(lines, (f) => !f.endsWith('.ts') && !f.endsWith('.tsx'));
27
+  if (offenders.length) {
28
+    throw new Error(`\n\nOnly ts/tsx files are allowed:\n${offenders.join('\n')}\n\n\n`);
29
+  }
30
+}