@codyswann/lisa 1.62.0 → 1.63.0
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/dist/configs/vitest/base.d.ts +88 -0
- package/dist/configs/vitest/base.d.ts.map +1 -0
- package/dist/configs/vitest/base.js +117 -0
- package/dist/configs/vitest/base.js.map +1 -0
- package/dist/configs/vitest/index.d.ts +15 -0
- package/dist/configs/vitest/index.d.ts.map +1 -0
- package/dist/configs/vitest/index.js +15 -0
- package/dist/configs/vitest/index.js.map +1 -0
- package/dist/configs/vitest/nestjs.d.ts +40 -0
- package/dist/configs/vitest/nestjs.d.ts.map +1 -0
- package/dist/configs/vitest/nestjs.js +51 -0
- package/dist/configs/vitest/nestjs.js.map +1 -0
- package/dist/configs/vitest/typescript.d.ts +36 -0
- package/dist/configs/vitest/typescript.d.ts.map +1 -0
- package/dist/configs/vitest/typescript.js +30 -0
- package/dist/configs/vitest/typescript.js.map +1 -0
- package/dist/detection/detectors/rails.js +1 -1
- package/dist/detection/detectors/rails.js.map +1 -1
- package/package.json +8 -2
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vitest Configuration - Shared Base
|
|
3
|
+
*
|
|
4
|
+
* Exports shared configuration pieces that can be imported by
|
|
5
|
+
* project-specific vitest.config.ts files. Reduces duplication between
|
|
6
|
+
* typescript, nestjs, and other project type configurations.
|
|
7
|
+
*
|
|
8
|
+
* Published as part of the @codyswann/lisa npm package so downstream
|
|
9
|
+
* projects can import these utilities directly from the package.
|
|
10
|
+
*
|
|
11
|
+
* @see https://vitest.dev/config/
|
|
12
|
+
* @module configs/vitest/base
|
|
13
|
+
*/
|
|
14
|
+
import type { ViteUserConfig } from "vitest/config";
|
|
15
|
+
/** Vite UserConfig augmented with Vitest's `test` property */
|
|
16
|
+
type UserConfig = ViteUserConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Vitest coverage threshold shape — flat metrics without the `global` wrapper
|
|
19
|
+
* that Jest uses. Projects store thresholds in the Jest-compatible format
|
|
20
|
+
* (with `global` key) for portability; factories map to this shape internally.
|
|
21
|
+
*/
|
|
22
|
+
export interface VitestThresholds {
|
|
23
|
+
readonly statements?: number;
|
|
24
|
+
readonly branches?: number;
|
|
25
|
+
readonly functions?: number;
|
|
26
|
+
readonly lines?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Portable threshold format shared with Jest configs.
|
|
30
|
+
* Projects use this in their threshold JSON files so the same file
|
|
31
|
+
* works with both Jest (Expo/CDK) and Vitest (TypeScript/NestJS).
|
|
32
|
+
*/
|
|
33
|
+
export interface PortableThresholds {
|
|
34
|
+
readonly global?: {
|
|
35
|
+
readonly statements?: number;
|
|
36
|
+
readonly branches?: number;
|
|
37
|
+
readonly functions?: number;
|
|
38
|
+
readonly lines?: number;
|
|
39
|
+
};
|
|
40
|
+
readonly [path: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Default coverage thresholds used when not specified in project config.
|
|
44
|
+
* Projects can override via vitest.thresholds.json.
|
|
45
|
+
*/
|
|
46
|
+
export declare const defaultThresholds: PortableThresholds;
|
|
47
|
+
/**
|
|
48
|
+
* Default patterns to exclude from coverage collection.
|
|
49
|
+
* Common across all stacks — stack-specific configs extend this list.
|
|
50
|
+
*
|
|
51
|
+
* Unlike Jest's `!`-prefixed negation patterns in `collectCoverageFrom`,
|
|
52
|
+
* Vitest uses separate `include`/`exclude` arrays without `!` prefixes.
|
|
53
|
+
*/
|
|
54
|
+
export declare const defaultCoverageExclusions: readonly string[];
|
|
55
|
+
/**
|
|
56
|
+
* Maps portable threshold format (with `global` wrapper) to Vitest's
|
|
57
|
+
* flat threshold format. Projects store thresholds in the portable
|
|
58
|
+
* format so the same JSON file works for both Jest and Vitest stacks.
|
|
59
|
+
*
|
|
60
|
+
* @param thresholds - Portable thresholds with `global` wrapper
|
|
61
|
+
* @returns Flat Vitest thresholds object
|
|
62
|
+
*/
|
|
63
|
+
export declare const mapThresholds: (thresholds: PortableThresholds) => VitestThresholds;
|
|
64
|
+
/**
|
|
65
|
+
* Merges project-specific threshold overrides into default thresholds.
|
|
66
|
+
* Allows projects to selectively raise or lower coverage requirements
|
|
67
|
+
* via vitest.thresholds.json without replacing the entire threshold object.
|
|
68
|
+
*
|
|
69
|
+
* Uses the portable format (with `global` wrapper) for compatibility
|
|
70
|
+
* with both Jest and Vitest threshold JSON files.
|
|
71
|
+
*
|
|
72
|
+
* @param defaults - Base thresholds from the stack config
|
|
73
|
+
* @param overrides - Project-specific overrides from vitest.thresholds.json
|
|
74
|
+
* @returns Merged thresholds with overrides taking precedence
|
|
75
|
+
*/
|
|
76
|
+
export declare const mergeThresholds: (defaults: PortableThresholds, overrides: PortableThresholds) => PortableThresholds;
|
|
77
|
+
/**
|
|
78
|
+
* Deep merges the `test` key of multiple Vitest UserConfig objects.
|
|
79
|
+
* Arrays are concatenated and deduplicated. Nested objects (like
|
|
80
|
+
* `coverage`) are shallow-merged. Scalar values from later configs
|
|
81
|
+
* take precedence.
|
|
82
|
+
*
|
|
83
|
+
* @param configs - Vitest UserConfig objects to merge in order of precedence
|
|
84
|
+
* @returns Single merged UserConfig
|
|
85
|
+
*/
|
|
86
|
+
export declare const mergeVitestConfigs: (...configs: UserConfig[]) => UserConfig;
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;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
|
+
*/
|
|
5
|
+
export const defaultThresholds = {
|
|
6
|
+
global: {
|
|
7
|
+
statements: 70,
|
|
8
|
+
branches: 70,
|
|
9
|
+
functions: 70,
|
|
10
|
+
lines: 70,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Default patterns to exclude from coverage collection.
|
|
15
|
+
* Common across all stacks — stack-specific configs extend this list.
|
|
16
|
+
*
|
|
17
|
+
* Unlike Jest's `!`-prefixed negation patterns in `collectCoverageFrom`,
|
|
18
|
+
* Vitest uses separate `include`/`exclude` arrays without `!` prefixes.
|
|
19
|
+
*/
|
|
20
|
+
export const defaultCoverageExclusions = [
|
|
21
|
+
"**/*.d.ts",
|
|
22
|
+
"**/index.ts",
|
|
23
|
+
"**/node_modules/**",
|
|
24
|
+
"**/dist/**",
|
|
25
|
+
"**/*.test.ts",
|
|
26
|
+
"**/*.spec.ts",
|
|
27
|
+
"**/*.mock.ts",
|
|
28
|
+
"**/test/**",
|
|
29
|
+
"**/tests/**",
|
|
30
|
+
"**/__tests__/**",
|
|
31
|
+
"**/__mocks__/**",
|
|
32
|
+
"**/components/ui/**",
|
|
33
|
+
];
|
|
34
|
+
/**
|
|
35
|
+
* Maps portable threshold format (with `global` wrapper) to Vitest's
|
|
36
|
+
* flat threshold format. Projects store thresholds in the portable
|
|
37
|
+
* format so the same JSON file works for both Jest and Vitest stacks.
|
|
38
|
+
*
|
|
39
|
+
* @param thresholds - Portable thresholds with `global` wrapper
|
|
40
|
+
* @returns Flat Vitest thresholds object
|
|
41
|
+
*/
|
|
42
|
+
export const mapThresholds = (thresholds) => ({
|
|
43
|
+
...(thresholds.global?.statements !== undefined
|
|
44
|
+
? { statements: thresholds.global.statements }
|
|
45
|
+
: {}),
|
|
46
|
+
...(thresholds.global?.branches !== undefined
|
|
47
|
+
? { branches: thresholds.global.branches }
|
|
48
|
+
: {}),
|
|
49
|
+
...(thresholds.global?.functions !== undefined
|
|
50
|
+
? { functions: thresholds.global.functions }
|
|
51
|
+
: {}),
|
|
52
|
+
...(thresholds.global?.lines !== undefined
|
|
53
|
+
? { lines: thresholds.global.lines }
|
|
54
|
+
: {}),
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Merges project-specific threshold overrides into default thresholds.
|
|
58
|
+
* Allows projects to selectively raise or lower coverage requirements
|
|
59
|
+
* via vitest.thresholds.json without replacing the entire threshold object.
|
|
60
|
+
*
|
|
61
|
+
* Uses the portable format (with `global` wrapper) for compatibility
|
|
62
|
+
* with both Jest and Vitest threshold JSON files.
|
|
63
|
+
*
|
|
64
|
+
* @param defaults - Base thresholds from the stack config
|
|
65
|
+
* @param overrides - Project-specific overrides from vitest.thresholds.json
|
|
66
|
+
* @returns Merged thresholds with overrides taking precedence
|
|
67
|
+
*/
|
|
68
|
+
export const mergeThresholds = (defaults, overrides) => ({
|
|
69
|
+
...defaults,
|
|
70
|
+
...overrides,
|
|
71
|
+
global: {
|
|
72
|
+
...defaults.global,
|
|
73
|
+
...overrides.global,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* Deep merges the `test` key of multiple Vitest UserConfig objects.
|
|
78
|
+
* Arrays are concatenated and deduplicated. Nested objects (like
|
|
79
|
+
* `coverage`) are shallow-merged. Scalar values from later configs
|
|
80
|
+
* take precedence.
|
|
81
|
+
*
|
|
82
|
+
* @param configs - Vitest UserConfig objects to merge in order of precedence
|
|
83
|
+
* @returns Single merged UserConfig
|
|
84
|
+
*/
|
|
85
|
+
export const mergeVitestConfigs = (...configs) => {
|
|
86
|
+
if (configs.length === 0) {
|
|
87
|
+
return {};
|
|
88
|
+
}
|
|
89
|
+
const mergeObjects = (a, b) => Object.keys(b).reduce((acc, key) => {
|
|
90
|
+
const accVal = acc[key];
|
|
91
|
+
const bVal = b[key];
|
|
92
|
+
const merged = Array.isArray(accVal) && Array.isArray(bVal)
|
|
93
|
+
? [...new Set([...accVal, ...bVal])]
|
|
94
|
+
: typeof accVal === "object" &&
|
|
95
|
+
accVal !== null &&
|
|
96
|
+
!Array.isArray(accVal) &&
|
|
97
|
+
typeof bVal === "object" &&
|
|
98
|
+
bVal !== null &&
|
|
99
|
+
!Array.isArray(bVal)
|
|
100
|
+
? {
|
|
101
|
+
...accVal,
|
|
102
|
+
...bVal,
|
|
103
|
+
}
|
|
104
|
+
: bVal;
|
|
105
|
+
return { ...acc, [key]: merged };
|
|
106
|
+
}, { ...a });
|
|
107
|
+
return configs.reduce((acc, config) => {
|
|
108
|
+
const accTest = (acc.test ?? {});
|
|
109
|
+
const configTest = (config.test ?? {});
|
|
110
|
+
return {
|
|
111
|
+
...acc,
|
|
112
|
+
...config,
|
|
113
|
+
test: mergeObjects(accTest, configTest),
|
|
114
|
+
};
|
|
115
|
+
}, {});
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/configs/vitest/base.ts"],"names":[],"mappings":"AA6CA;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAuB;IACnD,MAAM,EAAE;QACN,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,EAAE;KACV;CACF,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,WAAW;IACX,aAAa;IACb,oBAAoB;IACpB,YAAY;IACZ,cAAc;IACd,cAAc;IACd,cAAc;IACd,YAAY;IACZ,aAAa;IACb,iBAAiB;IACjB,iBAAiB;IACjB,qBAAqB;CACtB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,UAA8B,EACZ,EAAE,CAAC,CAAC;IACtB,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,KAAK,SAAS;QAC7C,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,C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AG,CAAC,CAAC,GAAG,CAAC,CAAC;QAEpB,MAAM,MAAM,GACV,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YAC1C,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;YACpC,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;gBACxB,MAAM,KAAK,IAAI;gBACf,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBACtB,OAAO,IAAI,KAAK,QAAQ;gBACxB,IAAI,KAAK,IAAI;gBACb,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;gBACtB,CAAC,CAAC;oBACE,GAAI,MAAkC;oBACtC,GAAI,IAAgC;iBACrC;gBACH,CAAC,CAAC,IAAI,CAAC;QAEb,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACnC,CAAC,EACD,EAAE,GAAG,CAAC,EAAE,CACT,CAAC;IAEJ,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACpC,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAA4B,CAAC;QAC5D,MAAM,UAAU,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAA4B,CAAC;QAElE,OAAO;YACL,GAAG,GAAG;YACN,GAAG,MAAM;YACT,IAAI,EAAE,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC;SACxC,CAAC;IACJ,CAAC,EAAE,EAAgB,CAAC,CAAC;AACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vitest configuration factory functions for Lisa-supported stacks.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports config factories and utilities from each stack module,
|
|
5
|
+
* allowing downstream projects to import from a single entry point.
|
|
6
|
+
*
|
|
7
|
+
* Note: Expo and CDK stacks remain on Jest — only TypeScript and NestJS
|
|
8
|
+
* are available as Vitest configs.
|
|
9
|
+
*
|
|
10
|
+
* @module configs/vitest
|
|
11
|
+
*/
|
|
12
|
+
export * from "./base.js";
|
|
13
|
+
export * from "./typescript.js";
|
|
14
|
+
export * from "./nestjs.js";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vitest configuration factory functions for Lisa-supported stacks.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports config factories and utilities from each stack module,
|
|
5
|
+
* allowing downstream projects to import from a single entry point.
|
|
6
|
+
*
|
|
7
|
+
* Note: Expo and CDK stacks remain on Jest — only TypeScript and NestJS
|
|
8
|
+
* are available as Vitest configs.
|
|
9
|
+
*
|
|
10
|
+
* @module configs/vitest
|
|
11
|
+
*/
|
|
12
|
+
export * from "./base.js";
|
|
13
|
+
export * from "./typescript.js";
|
|
14
|
+
export * from "./nestjs.js";
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/configs/vitest/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vitest Configuration - NestJS Stack
|
|
3
|
+
*
|
|
4
|
+
* Provides NestJS-specific Vitest configuration with extensive coverage
|
|
5
|
+
* exclusions for generated files, DTOs, entities, and modules.
|
|
6
|
+
*
|
|
7
|
+
* Inheritance chain:
|
|
8
|
+
* nestjs.ts (this file)
|
|
9
|
+
* +-- base.ts
|
|
10
|
+
*
|
|
11
|
+
* @see https://vitest.dev/config/
|
|
12
|
+
* @module configs/vitest/nestjs
|
|
13
|
+
*/
|
|
14
|
+
import type { ViteUserConfig } from "vitest/config";
|
|
15
|
+
/** Vite UserConfig augmented with Vitest's `test` property */
|
|
16
|
+
type UserConfig = ViteUserConfig;
|
|
17
|
+
import { defaultCoverageExclusions, defaultThresholds, mapThresholds, mergeThresholds, mergeVitestConfigs } from "./base.js";
|
|
18
|
+
import type { PortableThresholds } from "./base.js";
|
|
19
|
+
export { defaultCoverageExclusions, defaultThresholds, mapThresholds, mergeThresholds, mergeVitestConfigs, };
|
|
20
|
+
export type { PortableThresholds };
|
|
21
|
+
/**
|
|
22
|
+
* Options for configuring the NestJS Vitest config factory.
|
|
23
|
+
*/
|
|
24
|
+
interface NestjsVitestOptions {
|
|
25
|
+
/** Coverage thresholds in portable format (merged defaults + project overrides) */
|
|
26
|
+
readonly thresholds?: PortableThresholds;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates a Vitest configuration for NestJS projects.
|
|
30
|
+
*
|
|
31
|
+
* Unlike the Jest equivalent, no `ts-jest` with `tsconfig.spec.json` is needed —
|
|
32
|
+
* Vitest transforms TypeScript natively via esbuild. Path aliases should be
|
|
33
|
+
* configured via `vite-tsconfig-paths` plugin in the project's vitest.config.local.ts.
|
|
34
|
+
*
|
|
35
|
+
* @param options - Configuration options for threshold overrides
|
|
36
|
+
* @param options.thresholds - Coverage thresholds in portable format
|
|
37
|
+
* @returns Vitest UserConfig object with node environment and NestJS-specific exclusions
|
|
38
|
+
*/
|
|
39
|
+
export declare const getNestjsVitestConfig: ({ thresholds, }?: NestjsVitestOptions) => UserConfig;
|
|
40
|
+
//# sourceMappingURL=nestjs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nestjs.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/nestjs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,8DAA8D;AAC9D,KAAK,UAAU,GAAG,cAAc,CAAC;AAEjC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,EACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAGpD,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,CAAC;AAEF,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC;;GAEG;AACH,UAAU,mBAAmB;IAC3B,mFAAmF;IACnF,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;CAC1C;AAwBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,qBAE/B,mBAAmB,KAAQ,UAc5B,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defaultCoverageExclusions, defaultThresholds, mapThresholds, mergeThresholds, mergeVitestConfigs, } from "./base.js";
|
|
2
|
+
// Re-export base utilities for entry-point configs
|
|
3
|
+
export { defaultCoverageExclusions, defaultThresholds, mapThresholds, mergeThresholds, mergeVitestConfigs, };
|
|
4
|
+
/**
|
|
5
|
+
* NestJS-specific patterns excluded from coverage collection.
|
|
6
|
+
* These are generated or boilerplate files that don't benefit from coverage tracking.
|
|
7
|
+
*/
|
|
8
|
+
const nestjsCoverageExclusions = [
|
|
9
|
+
...defaultCoverageExclusions,
|
|
10
|
+
"**/*.entity.ts",
|
|
11
|
+
"**/*.dto.ts",
|
|
12
|
+
"**/*.input.ts",
|
|
13
|
+
"**/*.args.ts",
|
|
14
|
+
"**/*.model.ts",
|
|
15
|
+
"**/*.module.ts",
|
|
16
|
+
"**/*.factory.ts",
|
|
17
|
+
"**/*.enum.ts",
|
|
18
|
+
"**/*.interface.ts",
|
|
19
|
+
"**/*.constants.ts",
|
|
20
|
+
"**/database/migrations/**",
|
|
21
|
+
"**/database/seeds/**",
|
|
22
|
+
"**/graphql/**",
|
|
23
|
+
"**/main.ts",
|
|
24
|
+
];
|
|
25
|
+
/**
|
|
26
|
+
* Creates a Vitest configuration for NestJS projects.
|
|
27
|
+
*
|
|
28
|
+
* Unlike the Jest equivalent, no `ts-jest` with `tsconfig.spec.json` is needed —
|
|
29
|
+
* Vitest transforms TypeScript natively via esbuild. Path aliases should be
|
|
30
|
+
* configured via `vite-tsconfig-paths` plugin in the project's vitest.config.local.ts.
|
|
31
|
+
*
|
|
32
|
+
* @param options - Configuration options for threshold overrides
|
|
33
|
+
* @param options.thresholds - Coverage thresholds in portable format
|
|
34
|
+
* @returns Vitest UserConfig object with node environment and NestJS-specific exclusions
|
|
35
|
+
*/
|
|
36
|
+
export const getNestjsVitestConfig = ({ thresholds = defaultThresholds, } = {}) => ({
|
|
37
|
+
test: {
|
|
38
|
+
globals: true,
|
|
39
|
+
environment: "node",
|
|
40
|
+
root: "src",
|
|
41
|
+
include: ["**/*.spec.ts"],
|
|
42
|
+
testTimeout: 10000,
|
|
43
|
+
coverage: {
|
|
44
|
+
provider: "v8",
|
|
45
|
+
include: ["**/*.ts"],
|
|
46
|
+
exclude: [...nestjsCoverageExclusions],
|
|
47
|
+
thresholds: mapThresholds(thresholds),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=nestjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nestjs.js","sourceRoot":"","sources":["../../../src/configs/vitest/nestjs.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAInB,mDAAmD;AACnD,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,CAAC;AAYF;;;GAGG;AACH,MAAM,wBAAwB,GAAsB;IAClD,GAAG,yBAAyB;IAC5B,gBAAgB;IAChB,aAAa;IACb,eAAe;IACf,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,cAAc;IACd,mBAAmB;IACnB,mBAAmB;IACnB,2BAA2B;IAC3B,sBAAsB;IACtB,eAAe;IACf,YAAY;CACb,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EACpC,UAAU,GAAG,iBAAiB,MACP,EAAE,EAAc,EAAE,CAAC,CAAC;IAC3C,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,CAAC,cAAc,CAAC;QACzB,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE;YACR,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,CAAC,SAAS,CAAC;YACpB,OAAO,EAAE,CAAC,GAAG,wBAAwB,CAAC;YACtC,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC;SACtC;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vitest Configuration - TypeScript Stack
|
|
3
|
+
*
|
|
4
|
+
* Provides TypeScript/Node-specific Vitest configuration.
|
|
5
|
+
* Imports shared utilities from the base module.
|
|
6
|
+
*
|
|
7
|
+
* @see https://vitest.dev/config/
|
|
8
|
+
* @module configs/vitest/typescript
|
|
9
|
+
*/
|
|
10
|
+
import type { ViteUserConfig } from "vitest/config";
|
|
11
|
+
/** Vite UserConfig augmented with Vitest's `test` property */
|
|
12
|
+
type UserConfig = ViteUserConfig;
|
|
13
|
+
import { defaultCoverageExclusions, defaultThresholds, mapThresholds, mergeThresholds, mergeVitestConfigs } from "./base.js";
|
|
14
|
+
import type { PortableThresholds } from "./base.js";
|
|
15
|
+
export { defaultCoverageExclusions, defaultThresholds, mapThresholds, mergeThresholds, mergeVitestConfigs, };
|
|
16
|
+
export type { PortableThresholds };
|
|
17
|
+
/**
|
|
18
|
+
* Options for configuring the TypeScript Vitest config factory.
|
|
19
|
+
*/
|
|
20
|
+
interface TypescriptVitestOptions {
|
|
21
|
+
/** Coverage thresholds in portable format (merged defaults + project overrides) */
|
|
22
|
+
readonly thresholds?: PortableThresholds;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates a Vitest configuration for TypeScript/Node projects.
|
|
26
|
+
*
|
|
27
|
+
* Unlike the Jest equivalent, no `ts-jest` or `moduleNameMapper` is needed —
|
|
28
|
+
* Vitest transforms TypeScript natively via esbuild and resolves `.ts` files
|
|
29
|
+
* without extension mapping.
|
|
30
|
+
*
|
|
31
|
+
* @param options - Configuration options for threshold overrides
|
|
32
|
+
* @param options.thresholds - Coverage thresholds in portable format
|
|
33
|
+
* @returns Vitest UserConfig object
|
|
34
|
+
*/
|
|
35
|
+
export declare const getTypescriptVitestConfig: ({ thresholds, }?: TypescriptVitestOptions) => UserConfig;
|
|
36
|
+
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/typescript.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,8DAA8D;AAC9D,KAAK,UAAU,GAAG,cAAc,CAAC;AAEjC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,EACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAGpD,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,CAAC;AAEF,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC;;GAEG;AACH,UAAU,uBAAuB;IAC/B,mFAAmF;IACnF,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;CAC1C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,qBAEnC,uBAAuB,KAAQ,UAchC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defaultCoverageExclusions, defaultThresholds, mapThresholds, mergeThresholds, mergeVitestConfigs, } from "./base.js";
|
|
2
|
+
// Re-export base utilities for stack-specific configs to use
|
|
3
|
+
export { defaultCoverageExclusions, defaultThresholds, mapThresholds, mergeThresholds, mergeVitestConfigs, };
|
|
4
|
+
/**
|
|
5
|
+
* Creates a Vitest configuration for TypeScript/Node projects.
|
|
6
|
+
*
|
|
7
|
+
* Unlike the Jest equivalent, no `ts-jest` or `moduleNameMapper` is needed —
|
|
8
|
+
* Vitest transforms TypeScript natively via esbuild and resolves `.ts` files
|
|
9
|
+
* without extension mapping.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Configuration options for threshold overrides
|
|
12
|
+
* @param options.thresholds - Coverage thresholds in portable format
|
|
13
|
+
* @returns Vitest UserConfig object
|
|
14
|
+
*/
|
|
15
|
+
export const getTypescriptVitestConfig = ({ thresholds = defaultThresholds, } = {}) => ({
|
|
16
|
+
test: {
|
|
17
|
+
globals: true,
|
|
18
|
+
environment: "node",
|
|
19
|
+
include: ["tests/**/*.test.ts", "src/**/*.test.ts"],
|
|
20
|
+
exclude: ["**/node_modules/**", "**/dist/**"],
|
|
21
|
+
testTimeout: 10000,
|
|
22
|
+
coverage: {
|
|
23
|
+
provider: "v8",
|
|
24
|
+
include: ["src/**/*.ts"],
|
|
25
|
+
exclude: [...defaultCoverageExclusions],
|
|
26
|
+
thresholds: mapThresholds(thresholds),
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../src/configs/vitest/typescript.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAInB,6DAA6D;AAC7D,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,CAAC;AAYF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,UAAU,GAAG,iBAAiB,MACH,EAAE,EAAc,EAAE,CAAC,CAAC;IAC/C,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,CAAC,oBAAoB,EAAE,kBAAkB,CAAC;QACnD,OAAO,EAAE,CAAC,oBAAoB,EAAE,YAAY,CAAC;QAC7C,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE;YACR,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,CAAC,aAAa,CAAC;YACxB,OAAO,EAAE,CAAC,GAAG,yBAAyB,CAAC;YACvC,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC;SACtC;KACF;CACF,CAAC,CAAC"}
|
|
@@ -28,7 +28,7 @@ export class RailsDetector {
|
|
|
28
28
|
}
|
|
29
29
|
// Check for config/application.rb (secondary indicator)
|
|
30
30
|
const configAppPath = path.join(destDir, "config", "application.rb");
|
|
31
|
-
return pathExists(configAppPath);
|
|
31
|
+
return await pathExists(configAppPath);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
//# sourceMappingURL=rails.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rails.js","sourceRoot":"","sources":["../../../src/detection/detectors/rails.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,aAAa;IACf,IAAI,GAAG,OAAgB,CAAC;IAEjC;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,OAAe;QAC1B,0CAA0C;QAC1C,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACxD,IAAI,MAAM,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,wDAAwD;QACxD,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACrE,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"rails.js","sourceRoot":"","sources":["../../../src/detection/detectors/rails.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,aAAa;IACf,IAAI,GAAG,OAAgB,CAAC;IAEjC;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,OAAe;QAC1B,0CAA0C;QAC1C,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACxD,IAAI,MAAM,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,wDAAwD;QACxD,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACrE,OAAO,MAAM,UAAU,CAAC,aAAa,CAAC,CAAC;IACzC,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"axios": ">=1.13.5"
|
|
73
73
|
},
|
|
74
74
|
"name": "@codyswann/lisa",
|
|
75
|
-
"version": "1.
|
|
75
|
+
"version": "1.63.0",
|
|
76
76
|
"description": "Claude Code governance framework that applies guardrails, guidance, and automated enforcement to projects",
|
|
77
77
|
"main": "dist/index.js",
|
|
78
78
|
"exports": {
|
|
@@ -90,6 +90,10 @@
|
|
|
90
90
|
"./jest/nestjs": "./dist/configs/jest/nestjs.js",
|
|
91
91
|
"./jest/expo": "./dist/configs/jest/expo.js",
|
|
92
92
|
"./jest/cdk": "./dist/configs/jest/cdk.js",
|
|
93
|
+
"./vitest": "./dist/configs/vitest/index.js",
|
|
94
|
+
"./vitest/base": "./dist/configs/vitest/base.js",
|
|
95
|
+
"./vitest/typescript": "./dist/configs/vitest/typescript.js",
|
|
96
|
+
"./vitest/nestjs": "./dist/configs/vitest/nestjs.js",
|
|
93
97
|
"./tsconfig/base": "./tsconfig/base.json",
|
|
94
98
|
"./tsconfig/typescript": "./tsconfig/typescript.json",
|
|
95
99
|
"./tsconfig/nestjs": "./tsconfig/nestjs.json",
|
|
@@ -134,6 +138,7 @@
|
|
|
134
138
|
"@types/jest": "^30.0.0",
|
|
135
139
|
"@types/lodash.merge": "^4.6.0",
|
|
136
140
|
"@types/node": "^22.0.0",
|
|
141
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
137
142
|
"commander": "^12.0.0",
|
|
138
143
|
"esbuild-register": "^3.6.0",
|
|
139
144
|
"eslint": "^9.39.0",
|
|
@@ -168,7 +173,8 @@
|
|
|
168
173
|
"ts-morph": "^27.0.2",
|
|
169
174
|
"tsx": "^4.0.0",
|
|
170
175
|
"typescript": "~5.7.0",
|
|
171
|
-
"typescript-eslint": "^8.0.0"
|
|
176
|
+
"typescript-eslint": "^8.0.0",
|
|
177
|
+
"vitest": "^4.1.0"
|
|
172
178
|
},
|
|
173
179
|
"devDependencies": {
|
|
174
180
|
"@codyswann/lisa": "^1.56.7"
|