-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add basic erlang detection via rebar (#5886)
* chore: add basic erlang detection via rebar * test: ensure only one runtime is detected
- Loading branch information
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { beforeEach, expect, test } from 'vitest' | ||
|
||
import { mockFileSystem } from '../../tests/mock-file-system.js' | ||
import { NodeFS } from '../node/file-system.js' | ||
import { Project } from '../project.js' | ||
|
||
beforeEach((ctx) => { | ||
ctx.fs = new NodeFS() | ||
}) | ||
|
||
test('detects erlang when rebar.config is present', async ({ fs }) => { | ||
const cwd = mockFileSystem({ | ||
'rebar.config': '', | ||
}) | ||
|
||
const detected = await new Project(fs, cwd).detectRuntime() | ||
expect(detected.length).toBe(1) | ||
expect(detected[0].name).toBe('Erlang') | ||
}) | ||
|
||
test('detects erlang when rebar.lock is present', async ({ fs }) => { | ||
const cwd = mockFileSystem({ | ||
'rebar.lock': '', | ||
}) | ||
|
||
const detected = await new Project(fs, cwd).detectRuntime() | ||
expect(detected.length).toBe(1) | ||
expect(detected[0].name).toBe('Erlang') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { LangRuntime } from './runtime.js' | ||
|
||
export class Erlang extends LangRuntime { | ||
id = 'erlang' | ||
name = 'Erlang' | ||
configFiles = ['rebar.config', 'rebar.lock'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters