-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfast-node-manager.test.ts
More file actions
40 lines (37 loc) · 1.44 KB
/
Copy pathfast-node-manager.test.ts
File metadata and controls
40 lines (37 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { describe, it, expect } from 'vitest';
import { PluginTester, testSpawn } from '@codifycli/plugin-test';
import path from 'node:path';
import { SpawnStatus } from '@codifycli/plugin-core';
describe('fast-node-manager tests', () => {
const pluginPath = path.resolve('./src/index.ts');
it('Can install fnm and node', { timeout: 500000 }, async () => {
await PluginTester.fullTest(pluginPath, [
{
type: 'fnm',
defaultVersion: '20',
nodeVersions: ['20', '18'],
},
], {
validateApply: async () => {
expect(testSpawn('fnm --version')).resolves.toMatchObject({ status: SpawnStatus.SUCCESS });
expect(testSpawn('fnm exec --using=20 node --version')).resolves.toMatchObject({ data: expect.stringContaining('20') });
const { data: installedVersions } = await testSpawn('fnm list');
expect(installedVersions).toContain('20');
expect(installedVersions).toContain('18');
},
testModify: {
modifiedConfigs: [{
type: 'fnm',
defaultVersion: '22',
nodeVersions: ['22'],
}],
validateModify: async () => {
expect(testSpawn('fnm exec --using=22 node --version')).resolves.toMatchObject({ data: expect.stringContaining('22') });
},
},
validateDestroy: async () => {
expect(testSpawn('fnm --version')).resolves.toMatchObject({ status: SpawnStatus.ERROR });
},
});
});
});