add ESM-safe os test helpers and tsconfig for tests
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -14,12 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {describe, expect, it, jest, test, afterEach} from '@jest/globals';
|
||||
import {describe, expect, it, test, afterEach} from '@jest/globals';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import * as rimraf from 'rimraf';
|
||||
import osm = require('os');
|
||||
|
||||
import {mockArch, mockPlatform} from '../.helpers/os';
|
||||
|
||||
import {Install} from '../../src/compose/install';
|
||||
|
||||
@@ -85,8 +86,8 @@ describe('download', () => {
|
||||
['linux', 's390x'],
|
||||
])(
|
||||
'acquires compose for %s/%s', async (os, arch) => {
|
||||
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
|
||||
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
|
||||
mockPlatform(os as NodeJS.Platform);
|
||||
mockArch(arch);
|
||||
const install = new Install();
|
||||
const composeBin = await install.download('latest');
|
||||
expect(fs.existsSync(composeBin)).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user