Przeglądaj źródła

assert all ts files

Daniel Zlotin 6 lat temu
rodzic
commit
0c8e928adf
1 zmienionych plików z 10 dodań i 0 usunięć
  1. 10
    0
      scripts/test-js.js

+ 10
- 0
scripts/test-js.js Wyświetl plik

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