Browse Source

assert all ts files

Daniel Zlotin 7 years ago
parent
commit
0c8e928adf
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      scripts/test-js.js

+ 10
- 0
scripts/test-js.js View File

@@ -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
+}