diff --git a/src/cli/command/file-download.ts b/src/cli/command/file-download.ts index 49e7388f3f..e905fd9505 100644 --- a/src/cli/command/file-download.ts +++ b/src/cli/command/file-download.ts @@ -31,7 +31,7 @@ export class FileDownloadCommand extends Command { try { const container = createContainer(); - const env = container.get(EnvService); + const env = await container.getAsync(EnvService); const path = dirname(this.output); await mkdir(path, { recursive: true }); diff --git a/src/cli/command/file-exists.ts b/src/cli/command/file-exists.ts index 5c7fd0b9a6..5606ff74ce 100644 --- a/src/cli/command/file-exists.ts +++ b/src/cli/command/file-exists.ts @@ -21,7 +21,7 @@ export class FileExistsCommand extends Command { try { const container = createContainer(); - const env = container.get(EnvService); + const env = await container.getAsync(EnvService); const nUrl = env.replaceUrl(this.url); const res = await got.head(nUrl, { throwHttpErrors: false, diff --git a/src/cli/command/install-tool.ts b/src/cli/command/install-tool.ts index e15aa67048..b14cc17a41 100644 --- a/src/cli/command/install-tool.ts +++ b/src/cli/command/install-tool.ts @@ -37,7 +37,7 @@ export class InstallToolCommand extends Command { override async execute(): Promise { const start = Date.now(); - if (isToolIgnored(this.name)) { + if (await isToolIgnored(this.name)) { logger.info({ tool: this.name }, 'tool ignored'); return 0; } diff --git a/src/cli/command/utils.spec.ts b/src/cli/command/utils.spec.ts index 5781b349b4..4729312ffb 100644 --- a/src/cli/command/utils.spec.ts +++ b/src/cli/command/utils.spec.ts @@ -17,10 +17,10 @@ describe('cli/command/utils', () => { expect(getVersion('del-cli')).toBe('1.0.1'); }); - test('isToolIgnored', () => { - expect(isToolIgnored('node')).toBe(false); + test('isToolIgnored', async () => { + expect(await isToolIgnored('node')).toBe(false); env.IGNORED_TOOLS = 'node,pnpm'; - expect(isToolIgnored('node')).toBe(true); - expect(isToolIgnored('php')).toBe(false); + expect(await isToolIgnored('node')).toBe(true); + expect(await isToolIgnored('php')).toBe(false); }); }); diff --git a/src/cli/command/utils.ts b/src/cli/command/utils.ts index e30aad16a4..87e9197b7c 100644 --- a/src/cli/command/utils.ts +++ b/src/cli/command/utils.ts @@ -5,7 +5,7 @@ export function getVersion(tool: string): string | undefined { return env[tool.replace('-', '_').toUpperCase() + '_VERSION']; } -export function isToolIgnored(tool: string): boolean { +export async function isToolIgnored(tool: string): Promise { const container = createContainer(); - return container.get(EnvService).isToolIgnored(tool); + return (await container.getAsync(EnvService)).isToolIgnored(tool); } diff --git a/src/cli/install-tool/index.ts b/src/cli/install-tool/index.ts index 99972ed28a..4d238d66b0 100644 --- a/src/cli/install-tool/index.ts +++ b/src/cli/install-tool/index.ts @@ -144,7 +144,7 @@ function prepareResolveContainer(): Container { return container; } -export function installTool( +export async function installTool( tool: string, version: string, dryRun = false, @@ -225,7 +225,11 @@ export function installTool( } } } - return container.get(InstallToolService).install(tool, version, dryRun); + return (await container.getAsync(InstallToolService)).install( + tool, + version, + dryRun, + ); } export async function resolveVersion( @@ -266,5 +270,8 @@ export async function resolveVersion( } } } - return await container.get(ToolVersionResolverService).resolve(tool, version); + return (await container.getAsync(ToolVersionResolverService)).resolve( + tool, + version, + ); } diff --git a/src/cli/install-tool/install-tool.spec.ts b/src/cli/install-tool/install-tool.spec.ts index 58ea9a7646..3ac155bed6 100644 --- a/src/cli/install-tool/install-tool.spec.ts +++ b/src/cli/install-tool/install-tool.spec.ts @@ -33,14 +33,14 @@ describe('cli/install-tool/install-tool', () => { } }); - beforeEach(() => { + beforeEach(async () => { child = createContainer(parent); - install = child.get(InstallToolService); + install = await child.getAsync(InstallToolService); }); test('writes version if tool is not installed', async () => { - const ver = child.get(VersionService); - const bun = child.get(INSTALL_TOOL_TOKEN); + const ver = await child.getAsync(VersionService); + const bun = await child.getAsync(INSTALL_TOOL_TOKEN); vi.mocked(bun).needsInitialize.mockResolvedValueOnce(true); vi.mocked(bun).needsPrepare.mockResolvedValueOnce(true); expect(await install.install('bun', '1.0.0')).toBeUndefined(); @@ -48,8 +48,8 @@ describe('cli/install-tool/install-tool', () => { }); test('writes version even if tool is installed', async () => { - const ver = child.get(VersionService); - const bun = child.get(INSTALL_TOOL_TOKEN); + const ver = await child.getAsync(VersionService); + const bun = await child.getAsync(INSTALL_TOOL_TOKEN); vi.mocked(bun).isInstalled.mockResolvedValueOnce(true); expect(await install.install('bun', '1.0.1')).toBeUndefined(); expect(await ver.find('bun')).toBe('1.0.1'); diff --git a/src/cli/prepare-tool/index.spec.ts b/src/cli/prepare-tool/index.spec.ts index 80e80db5c2..0f899c5ce7 100644 --- a/src/cli/prepare-tool/index.spec.ts +++ b/src/cli/prepare-tool/index.spec.ts @@ -33,7 +33,7 @@ describe('cli/prepare-tool/index', () => { ); const child = createContainer(); - const pathSvc = child.get(PathService); + const pathSvc = await child.getAsync(PathService); await pathSvc.setPrepared('bun'); }); diff --git a/src/cli/prepare-tool/index.ts b/src/cli/prepare-tool/index.ts index 18120250fd..d5ae7ec47a 100644 --- a/src/cli/prepare-tool/index.ts +++ b/src/cli/prepare-tool/index.ts @@ -40,18 +40,21 @@ function prepareContainer(): Container { return container; } -export function prepareTools( +export async function prepareTools( tools: string[], dryRun = false, ): Promise { const container = prepareContainer(); - return container.get(PrepareToolService).prepare(tools, dryRun); + return (await container.getAsync(PrepareToolService)).prepare(tools, dryRun); } -export function initializeTools( +export async function initializeTools( tools: string[], dryRun = false, ): Promise { const container = prepareContainer(); - return container.get(PrepareToolService).initialize(tools, dryRun); + return (await container.getAsync(PrepareToolService)).initialize( + tools, + dryRun, + ); } diff --git a/src/cli/services/apt.service.spec.ts b/src/cli/services/apt.service.spec.ts index b217b1136c..6033566d50 100644 --- a/src/cli/services/apt.service.spec.ts +++ b/src/cli/services/apt.service.spec.ts @@ -24,7 +24,7 @@ describe('cli/services/apt.service', () => { }); test('skips install', async () => { - const svc = child.get(AptService); + const svc = await child.getAsync(AptService); mocks.execa.mockResolvedValueOnce({ stdout: 'Status: install ok installed', @@ -34,7 +34,7 @@ describe('cli/services/apt.service', () => { }); test('works', async () => { - const svc = child.get(AptService); + const svc = await child.getAsync(AptService); mocks.execa.mockRejectedValueOnce(new Error('not installed')); await svc.install('some-pkg'); @@ -45,7 +45,7 @@ describe('cli/services/apt.service', () => { test('uses proxy', async () => { env.APT_HTTP_PROXY = 'http://proxy'; - const svc = child.get(AptService); + const svc = await child.getAsync(AptService); mocks.execa.mockRejectedValueOnce(new Error('not installed')); await svc.install('some-pkg', 'other-pkg'); diff --git a/src/cli/services/compression.service.spec.ts b/src/cli/services/compression.service.spec.ts index 65a896f293..4d85af36bb 100644 --- a/src/cli/services/compression.service.spec.ts +++ b/src/cli/services/compression.service.spec.ts @@ -12,7 +12,7 @@ describe('cli/services/compression.service', () => { }); test('extracts with bstar', async () => { - const svc = child.get(CompressionService); + const svc = await child.getAsync(CompressionService); await expect( svc.extract({ file: 'some.txz', cwd: globalThis.cacheDir }), diff --git a/src/cli/services/env.service.spec.ts b/src/cli/services/env.service.spec.ts index 067d1efc91..23942ede48 100644 --- a/src/cli/services/env.service.spec.ts +++ b/src/cli/services/env.service.spec.ts @@ -19,113 +19,111 @@ vi.mock('node:process', () => ({ describe('cli/services/env.service', () => { let child!: Container; let rootDir: string | undefined; + let svc!: EnvService; beforeAll(() => { rootDir = globalThis.rootDir; }); - beforeEach(() => { + beforeEach(async () => { child = createContainer(); globalThis.rootDir = rootDir; mocks.arch.mockReturnValue('x64'); + svc = await child.getAsync(EnvService); }); - test('arch', () => { - mocks.arch.mockReturnValue('arm64'); - expect(child.get(EnvService).arch).toBe('arm64'); + test('arch', async () => { + expect(svc.arch).toBe('amd64'); - mocks.arch.mockReturnValue('x64'); - expect(child.get(EnvService).arch).toBe('amd64'); + mocks.arch.mockReturnValue('arm64'); + expect((await child.getAsync(EnvService)).arch).toBe('arm64'); mocks.arch.mockReturnValue('invalid'); - expect(() => child.get(EnvService).arch).toThrow(); + await expect( + async () => (await child.getAsync(EnvService)).arch, + ).rejects.toThrow(); }); test('isRoot', () => { - expect(child.get(EnvService).isRoot).toBe(true); + expect(svc.isRoot).toBe(true); }); test('home', () => { - expect(child.get(EnvService).home).toBeUndefined(); + expect(svc.home).toBeUndefined(); }); test('rootHome', () => { - expect(child.get(EnvService).rootHome).toBe(rootPath('root')); + expect(svc.rootHome).toBe(rootPath('root')); }); test('userHome', () => { - expect(child.get(EnvService).userHome).toBe(rootPath('home/ubuntu')); + expect(svc.userHome).toBe(rootPath('home/ubuntu')); }); test('userId', () => { - expect(child.get(EnvService).userId).toBe(12021); + expect(svc.userId).toBe(12021); }); test('umask', () => { - const e = child.get(EnvService); - expect(e.umask).toBe(0o755); - Object.assign(e, { uid: 12021 }); - expect(e.umask).toBe(0o775); + expect(svc.umask).toBe(0o755); + Object.assign(svc, { uid: 12021 }); + expect(svc.umask).toBe(0o775); }); test('skipTests', () => { - expect(child.get(EnvService).skipTests).toBe(false); + expect(svc.skipTests).toBe(false); }); test('cacheDir', () => { delete env.CONTAINERBASE_CACHE_DIR; - expect(child.get(EnvService).cacheDir).toBeNull(); + expect(svc.cacheDir).toBeNull(); }); describe('rootDir', () => { test('uses test root', () => { - const e = child.get(EnvService); - expect(e.rootDir).toBe(rootPath()); + expect(svc.rootDir).toBe(rootPath()); }); test('uses default root', () => { globalThis.rootDir = undefined; - const e = child.get(EnvService); - expect(e.rootDir).toBe(sep); + expect(svc.rootDir).toBe(sep); }); }); - test('isToolIgnored', () => { - let e = child.get(EnvService); - expect(e.isToolIgnored('npm')).toBe(false); - expect(e.isToolIgnored('node')).toBe(false); + test('isToolIgnored', async () => { + expect(svc.isToolIgnored('npm')).toBe(false); + expect(svc.isToolIgnored('node')).toBe(false); env.IGNORED_TOOLS = 'npm,yarn'; - e = child.get(EnvService); + const e = await child.getAsync(EnvService); expect(e.isToolIgnored('npm')).toBe(true); expect(e.isToolIgnored('node')).toBe(false); }); test('replaceUrl', () => { - const e = child.get(EnvService); env.URL_REPLACE_0_FROM = 'https://example.com'; env.URL_REPLACE_0_TO = 'https://example.test'; env.URL_REPLACE_1_FROM = 'https://cdn.example.com/registry.npmjs.org'; env.URL_REPLACE_1_TO = 'https://npm.example.test'; - expect(e.replaceUrl('https://example.com/file.txt')).toBe( + expect(svc.replaceUrl('https://example.com/file.txt')).toBe( 'https://example.test/file.txt', ); - expect(e.replaceUrl('https://example.org/file.txt')).toBe( + expect(svc.replaceUrl('https://example.org/file.txt')).toBe( 'https://example.org/file.txt', ); env.CONTAINERBASE_CDN = `https://cdn.example.com/`; - expect(e.replaceUrl('https://localhost')).toBe( + expect(svc.replaceUrl('https://localhost')).toBe( 'https://cdn.example.com/localhost', ); - expect(e.replaceUrl('https://example.test/file.txt')).toBe( + expect(svc.replaceUrl('https://example.test/file.txt')).toBe( 'https://cdn.example.com/example.test/file.txt', ); - expect(e.replaceUrl('https://registry.npmjs.org')).toBe( + expect(svc.replaceUrl('https://registry.npmjs.org')).toBe( 'https://npm.example.test', ); - expect(e.replaceUrl('https://registry.npmjs.org', false)).toBe( + expect(svc.replaceUrl('https://registry.npmjs.org', false)).toBe( 'https://registry.npmjs.org', ); }); diff --git a/src/cli/services/http.service.spec.ts b/src/cli/services/http.service.spec.ts index 459b47ed76..7810ece648 100644 --- a/src/cli/services/http.service.spec.ts +++ b/src/cli/services/http.service.spec.ts @@ -9,9 +9,11 @@ import { cachePath } from '~test/path'; const baseUrl = 'https://example.com'; describe('cli/services/http.service', () => { let child!: Container; + let http!: HttpService; - beforeEach(() => { + beforeEach(async () => { child = createContainer(); + http = await child.getAsync(HttpService); for (const key of Object.keys(env)) { if (key.startsWith('URL_REPLACE_')) { @@ -23,8 +25,6 @@ describe('cli/services/http.service', () => { test('throws', async () => { scope(baseUrl).get('/fail.txt').times(6).reply(404); - const http = child.get(HttpService); - await expect( http.download({ url: `${baseUrl}/fail.txt` }), ).rejects.toThrow(); @@ -36,7 +36,6 @@ describe('cli/services/http.service', () => { test('throws with checksum', async () => { scope(baseUrl).get('/checksum.txt').thrice().reply(200, 'ok'); - const http = child.get(HttpService); const expectedChecksum = 'invalid'; const checksumType = 'sha256'; @@ -52,7 +51,6 @@ describe('cli/services/http.service', () => { test('download', async () => { scope(baseUrl).get('/test.txt').reply(200, 'ok'); - const http = child.get(HttpService); const expected = cachePath( `d1dc63218c42abba594fff6450457dc8c4bfdd7c22acf835a50ca0e5d2693020/test.txt`, ); @@ -65,7 +63,6 @@ describe('cli/services/http.service', () => { test('download with checksum', async () => { scope(baseUrl).get('/test.txt').reply(200, 'https://example.com/test.txt'); - const http = child.get(HttpService); const expectedChecksum = 'd1dc63218c42abba594fff6450457dc8c4bfdd7c22acf835a50ca0e5d2693020'; const expected = cachePath( @@ -98,7 +95,6 @@ describe('cli/services/http.service', () => { .head('/test.txt') .reply(501); - const http = child.get(HttpService); expect(await http.exists(`${baseUrl}/test.txt`)).toBe(true); expect(await http.exists(`${baseUrl}/test.txt`)).toBe(false); await expect(http.exists(`${baseUrl}/test.txt`)).rejects.toThrow(); @@ -114,7 +110,6 @@ describe('cli/services/http.service', () => { .times(3) .reply(501); - const http = child.get(HttpService); expect( await http.get(`${baseUrl}/test.txt`, { headers: { 'x-test': 'test' }, @@ -135,7 +130,6 @@ describe('cli/services/http.service', () => { .times(3) .reply(501); - const http = child.get(HttpService); expect( await http.getJson(`${baseUrl}/test.json`, { headers: { 'x-test': 'test' }, @@ -165,7 +159,6 @@ describe('cli/services/http.service', () => { // coverage env.URL_REPLACE_1_FROM = 'https://example.test'; - const http = child.get(HttpService); const expected = cachePath( `f4eba41457a330d0fa5289e49836326c6a0208bbc639862e70bb378c88c62642/replace.txt`, ); diff --git a/src/cli/services/path.service.spec.ts b/src/cli/services/path.service.spec.ts index dffa7af292..5bfcf495d8 100644 --- a/src/cli/services/path.service.spec.ts +++ b/src/cli/services/path.service.spec.ts @@ -11,11 +11,13 @@ import { rootPath } from '~test/path'; describe('cli/services/path.service', () => { const path = env.PATH; let child!: Container; + let pathSvc!: PathService; beforeEach(async () => { child = createContainer(); env.PATH = path; delete env.NODE_VERSION; + pathSvc = await child.getAsync(PathService); await deleteAsync('**', { force: true, dot: true, cwd: rootPath() }); await mkdir(rootPath('var/lib/containerbase/tool.prep.d'), { recursive: true, @@ -26,47 +28,39 @@ describe('cli/services/path.service', () => { }); test('cachePath', () => { - expect(child.get(PathService).cachePath).toBe( - rootPath('tmp/containerbase/cache'), - ); + expect(pathSvc.cachePath).toBe(rootPath('tmp/containerbase/cache')); }); test('envFile', () => { - expect(child.get(PathService).envFile).toBe(rootPath('usr/local/etc/env')); + expect(pathSvc.envFile).toBe(rootPath('usr/local/etc/env')); }); test('tmpDir', () => { - expect(child.get(PathService).tmpDir).toBe(rootPath('tmp/containerbase')); + expect(pathSvc.tmpDir).toBe(rootPath('tmp/containerbase')); }); test('sslPath', () => { - expect(child.get(PathService).sslPath).toBe( - rootPath('opt/containerbase/ssl'), - ); + expect(pathSvc.sslPath).toBe(rootPath('opt/containerbase/ssl')); }); test('toolsPath', () => { - expect(child.get(PathService).toolsPath).toBe( - rootPath('opt/containerbase/tools'), - ); + expect(pathSvc.toolsPath).toBe(rootPath('opt/containerbase/tools')); }); test('versionPath', () => { - expect(child.get(PathService).versionPath).toBe( - rootPath('opt/containerbase/versions'), - ); + expect(pathSvc.versionPath).toBe(rootPath('opt/containerbase/versions')); }); test('resetToolEnv', async () => { - expect(await child.get(PathService).resetToolEnv('node')).toBeUndefined(); + expect(await pathSvc.resetToolEnv('node')).toBeUndefined(); }); test('toolEnvExists', async () => { - expect(await child.get(PathService).toolEnvExists('node')).toBe(false); + expect(await pathSvc.toolEnvExists('node')).toBe(false); }); test('ensureBasePaths', async () => { - await child.get(PathService).ensureBasePaths(); + await pathSvc.ensureBasePaths(); expect(await pathExists(rootPath('opt/containerbase'), 'dir')).toBe(true); expect(await pathExists(rootPath('var/lib/containerbase'), 'dir')).toBe( true, @@ -75,8 +69,6 @@ describe('cli/services/path.service', () => { }); test('exportToolEnvContent', async () => { - const pathSvc = child.get(PathService); - await mkdir(`${pathSvc.installDir}/tools`, { recursive: true }); await pathSvc.exportToolEnvContent( @@ -91,30 +83,29 @@ describe('cli/services/path.service', () => { }); test('versionedToolPath', () => { - expect(child.get(PathService).versionedToolPath('node', '18.0.1')).toBe( + expect(pathSvc.versionedToolPath('node', '18.0.1')).toBe( rootPath('opt/containerbase/tools/node/18.0.1'), ); }); test('creates and finds tool paths', async () => { await mkdir(rootPath('opt/containerbase/tools'), { recursive: true }); - const svc = child.get(PathService); - expect(await svc.findToolPath('node')).toBeNull(); - await svc.createToolPath('node'); - expect(await svc.findToolPath('node')).toBe( + expect(await pathSvc.findToolPath('node')).toBeNull(); + await pathSvc.createToolPath('node'); + expect(await pathSvc.findToolPath('node')).toBe( rootPath('opt/containerbase/tools/node'), ); - expect(await svc.findVersionedToolPath('node', '18.0.1')).toBeNull(); - await svc.createVersionedToolPath('node', '18.0.1'); - expect(await svc.findVersionedToolPath('node', '18.0.1')).toBe( + expect(await pathSvc.findVersionedToolPath('node', '18.0.1')).toBeNull(); + await pathSvc.createVersionedToolPath('node', '18.0.1'); + expect(await pathSvc.findVersionedToolPath('node', '18.0.1')).toBe( rootPath('opt/containerbase/tools/node/18.0.1'), ); }); test('exportEnv', async () => { await mkdir(rootPath('usr/local/etc'), { recursive: true }); - await child.get(PathService).exportEnv({ NODE_VERSION: 'v14.17.1' }); - await child.get(PathService).exportEnv({ TEST: '/tmp/test' }, true); + await pathSvc.exportEnv({ NODE_VERSION: 'v14.17.1' }); + await pathSvc.exportEnv({ TEST: '/tmp/test' }, true); expect(env).toMatchObject({ NODE_VERSION: 'v14.17.1' }); const content = await readFile(rootPath('usr/local/etc/env'), 'utf8'); @@ -126,7 +117,7 @@ describe('cli/services/path.service', () => { test('exportPath', async () => { await mkdir(rootPath('usr/local/etc'), { recursive: true }); - await child.get(PathService).exportPath('/some/path'); + await pathSvc.exportPath('/some/path'); expect(env).toMatchObject({ PATH: `/some/path:${path}` }); const content = await readFile(rootPath('usr/local/etc/env'), 'utf8'); @@ -135,8 +126,6 @@ describe('cli/services/path.service', () => { describe('exportToolEnv', () => { test('node', async () => { - const pathSvc = child.get(PathService); - await mkdir(`${pathSvc.installDir}/tools`, { recursive: true }); await pathSvc.exportToolEnv('node', { NODE_VERSION: 'v14.17.0' }); await pathSvc.exportToolEnv('node', { TEST: '/tmp/test' }, true); @@ -157,8 +146,6 @@ describe('cli/services/path.service', () => { describe('exportToolPath', () => { test('node', async () => { - const pathSvc = child.get(PathService); - await mkdir(`${pathSvc.installDir}/tools`, { recursive: true }); await pathSvc.exportToolPath('node', '/some/path'); expect(env).toMatchObject({ @@ -174,7 +161,7 @@ describe('cli/services/path.service', () => { test('ensureToolPath', async () => { await mkdir(rootPath('opt/containerbase/tools'), { recursive: true }); - expect(await child.get(PathService).ensureToolPath('node')).toBe( + expect(await pathSvc.ensureToolPath('node')).toBe( rootPath('opt/containerbase/tools/node'), ); expect( @@ -183,22 +170,21 @@ describe('cli/services/path.service', () => { }); test('fileExists', async () => { - expect( - await child.get(PathService).fileExists(rootPath('usr/local/etc/env123')), - ).toBe(false); + expect(await pathSvc.fileExists(rootPath('usr/local/etc/env123'))).toBe( + false, + ); }); test('createDir', async () => { const dir = rootPath('env123/sub'); - expect(await child.get(PathService).createDir(dir)).toBeUndefined(); + expect(await pathSvc.createDir(dir)).toBeUndefined(); const s = await stat(dir); expect(s.mode & fileRights).toBe(platform() === 'win32' ? 0 : 0o775); - expect(await child.get(PathService).createDir(dir)).toBeUndefined(); + expect(await pathSvc.createDir(dir)).toBeUndefined(); }); test('toolInit', async () => { - const pathSvc = child.get(PathService); expect(pathSvc.toolInitPath('node')).toBe( rootPath('tmp/containerbase/tool.init.d/node'), ); @@ -208,7 +194,6 @@ describe('cli/services/path.service', () => { }); test('toolPrepare', async () => { - const pathSvc = child.get(PathService); expect(pathSvc.toolPreparePath('node')).toBe( rootPath('var/lib/containerbase/tool.prep.d/node'), ); @@ -219,7 +204,7 @@ describe('cli/services/path.service', () => { test('writeFile', async () => { const file = rootPath('env123'); - await child.get(PathService).writeFile(file, 'test'); + await pathSvc.writeFile(file, 'test'); const s = await stat(file); expect(s.mode & fileRights).toBe(platform() === 'win32' ? 0 : 0o664); diff --git a/src/cli/services/version.service.spec.ts b/src/cli/services/version.service.spec.ts index 0628a16414..885bd34c0b 100644 --- a/src/cli/services/version.service.spec.ts +++ b/src/cli/services/version.service.spec.ts @@ -6,14 +6,14 @@ import { rootPath } from '~test/path'; describe('cli/services/version.service', () => { let child!: Container; + let svc!: VersionService; - beforeEach(() => { + beforeEach(async () => { child = createContainer(); + svc = await child.getAsync(VersionService); }); test('works', async () => { - const svc = child.get(VersionService); - // doesn't fail await svc.update('node', '14.17.0');