Skip to content

Commit 4be6031

Browse files
committed
Detect playwright
1 parent 20f6ae8 commit 4be6031

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

dist/index/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29664,6 +29664,7 @@ async function detectFrameworks(rootPath = './') {
2966429664
detectJava,
2966529665
detectNode,
2966629666
detectPhp,
29667+
detectPlaywright,
2966729668
detectPython,
2966829669
detectRuby,
2966929670
detectRust,
@@ -29720,6 +29721,16 @@ async function detectPhp(rootPath) {
2972029721
}
2972129722
return detected;
2972229723
}
29724+
async function detectPlaywright(rootPath) {
29725+
let detected = [];
29726+
if (external_node_fs_namespaceObject.existsSync(external_node_path_namespaceObject.join(rootPath, 'playwright.config.js'))) {
29727+
detected.push('playwright');
29728+
}
29729+
if (external_node_fs_namespaceObject.existsSync(external_node_path_namespaceObject.join(rootPath, 'playwright.config.ts'))) {
29730+
detected.push('playwright');
29731+
}
29732+
return detected;
29733+
}
2972329734
async function detectPython(rootPath) {
2972429735
let detected = [];
2972529736
if (external_node_fs_namespaceObject.existsSync(external_node_path_namespaceObject.join(rootPath, 'poetry.lock'))) {

src/framework.test.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ beforeEach(() => {
88
vol.reset(); // reset the state of in-memory fs
99
});
1010

11-
test('detects go - mod', async () => {
11+
test('detects go mod', async () => {
1212
vol.fromJSON({
1313
'mockdata/go.mod': '',
1414
});
@@ -17,7 +17,7 @@ test('detects go - mod', async () => {
1717
expect(detected).toContain('go');
1818
});
1919

20-
test('detects go - work', async () => {
20+
test('detects go work', async () => {
2121
vol.fromJSON({
2222
'mockdata/go.work': '',
2323
});
@@ -66,6 +66,24 @@ test('detects php', async () => {
6666
expect(detected).toContain('composer');
6767
});
6868

69+
test('detects playwright js', async () => {
70+
vol.fromJSON({
71+
'mockdata/playwright.config.js': '',
72+
});
73+
74+
const detected = await detectFrameworks('mockdata');
75+
expect(detected).toContain('playwright');
76+
});
77+
78+
test('detects playwright ts', async () => {
79+
vol.fromJSON({
80+
'mockdata/playwright.config.ts': '',
81+
});
82+
83+
const detected = await detectFrameworks('mockdata');
84+
expect(detected).toContain('playwright');
85+
});
86+
6987
test('detects python', async () => {
7088
vol.fromJSON({
7189
'mockdata/poetry.lock': '',

src/framework.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export async function detectFrameworks(rootPath = './'): Promise<string[]> {
88
detectJava,
99
detectNode,
1010
detectPhp,
11+
detectPlaywright,
1112
detectPython,
1213
detectRuby,
1314
detectRust,
@@ -85,6 +86,20 @@ async function detectPhp(rootPath: string): Promise<string[]> {
8586
return detected;
8687
}
8788

89+
async function detectPlaywright(rootPath: string): Promise<string[]> {
90+
let detected: string[] = [];
91+
92+
if (fs.existsSync(path.join(rootPath, 'playwright.config.js'))) {
93+
detected.push('playwright');
94+
}
95+
96+
if (fs.existsSync(path.join(rootPath, 'playwright.config.ts'))) {
97+
detected.push('playwright');
98+
}
99+
100+
return detected;
101+
}
102+
88103
async function detectPython(rootPath: string): Promise<string[]> {
89104
let detected: string[] = [];
90105

0 commit comments

Comments
 (0)