jasmine-focused-test-detector 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/workspace.xml +1 -1
- package/index.js +27 -37
- package/package.json +7 -5
package/.idea/workspace.xml
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
<option name="number" value="Default" />
|
|
47
47
|
<option name="presentableId" value="Default" />
|
|
48
48
|
<updated>1767089273794</updated>
|
|
49
|
-
<workItem from="1767089274873" duration="
|
|
49
|
+
<workItem from="1767089274873" duration="7676000" />
|
|
50
50
|
</task>
|
|
51
51
|
<servers />
|
|
52
52
|
</component>
|
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {hideBin} from 'yargs/helpers';
|
|
2
|
+
|
|
3
|
+
import { hideBin } from 'yargs/helpers';
|
|
5
4
|
import yargs from 'yargs/yargs';
|
|
6
|
-
import {
|
|
5
|
+
import { ESLint } from 'eslint';
|
|
6
|
+
import { globby } from 'globby';
|
|
7
7
|
|
|
8
8
|
const argv = yargs(hideBin(process.argv))
|
|
9
9
|
.option('files', {
|
|
@@ -13,7 +13,7 @@ const argv = yargs(hideBin(process.argv))
|
|
|
13
13
|
demandOption: true
|
|
14
14
|
})
|
|
15
15
|
.help()
|
|
16
|
-
.
|
|
16
|
+
.parse();
|
|
17
17
|
|
|
18
18
|
const filePatterns = argv.files.split(',').map(f => f.trim());
|
|
19
19
|
|
|
@@ -25,44 +25,34 @@ const filePatterns = argv.files.split(',').map(f => f.trim());
|
|
|
25
25
|
process.exit(0);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
found = true;
|
|
38
|
-
console.log(filePath)
|
|
39
|
-
if (!focusedFiles.includes(filePath)) focusedFiles.push(filePath);
|
|
40
|
-
}
|
|
41
|
-
for (const key in node) {
|
|
42
|
-
if (node[key] && typeof node[key] === 'object') {
|
|
43
|
-
visit(node[key], filePath);
|
|
28
|
+
const eslint = new ESLint({
|
|
29
|
+
baseConfig: {
|
|
30
|
+
plugins: ['jasmine'],
|
|
31
|
+
env: {
|
|
32
|
+
jasmine: true,
|
|
33
|
+
node: true
|
|
34
|
+
},
|
|
35
|
+
rules: {
|
|
36
|
+
'jasmine/no-focused-tests': 'error'
|
|
44
37
|
}
|
|
45
|
-
}
|
|
46
|
-
|
|
38
|
+
},
|
|
39
|
+
useEslintrc: false
|
|
40
|
+
});
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} catch (err) {
|
|
54
|
-
console.warn(`Warning: Failed to parse ${filePath}: ${err.message}`);
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
visit(ast, filePath);
|
|
58
|
-
}
|
|
42
|
+
const results = await eslint.lintFiles(files);
|
|
43
|
+
|
|
44
|
+
const focusedFiles = results
|
|
45
|
+
.filter(r => r.messages.some(m => m.ruleId === 'jasmine/no-focused-tests'))
|
|
46
|
+
.map(r => r.filePath);
|
|
59
47
|
|
|
60
|
-
if (
|
|
48
|
+
if (focusedFiles.length > 0) {
|
|
61
49
|
console.error('\n==========================================');
|
|
62
50
|
console.error('BUILD FAILED: Found focused tests (fit/fdescribe)');
|
|
63
|
-
console.error('
|
|
51
|
+
console.error('Please remove all fit/fdescribe calls before committing.');
|
|
52
|
+
console.error('==========================================\n');
|
|
64
53
|
focusedFiles.forEach(f => console.error(`ERROR: Focused test found in ${f}`));
|
|
65
|
-
console.error('
|
|
54
|
+
console.error('==========================================\n');
|
|
55
|
+
|
|
66
56
|
process.exit(1);
|
|
67
57
|
}
|
|
68
58
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jasmine-focused-test-detector",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "CLI tool to detect focused tests (fit/fdescribe/it.only/describe.only) in Jasmine test files using ESLint",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
"author": "Pouya Sadat Alhosseini",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@typescript-eslint/parser": "^6.2.0",
|
|
18
17
|
"globby": "^14.1.0",
|
|
19
|
-
"yargs": "^17.7.2"
|
|
18
|
+
"yargs": "^17.7.2",
|
|
19
|
+
"eslint": "^8.50.0",
|
|
20
|
+
"eslint-plugin-jasmine": "^4.0.0"
|
|
20
21
|
},
|
|
21
22
|
"repository": {
|
|
22
23
|
"type": "git",
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
"frontend",
|
|
28
29
|
"jasmine",
|
|
29
30
|
"test",
|
|
30
|
-
"cli"
|
|
31
|
+
"cli",
|
|
32
|
+
"eslint"
|
|
31
33
|
]
|
|
32
34
|
}
|