2019-06-17 06:46:28 +00:00
|
|
|
import { tap, expect } from '@pushrocks/tapbundle';
|
2022-03-16 15:09:24 +00:00
|
|
|
import * as smartenv from '../ts/index.js';
|
2017-04-19 18:02:43 +00:00
|
|
|
|
2019-06-17 06:46:28 +00:00
|
|
|
let testEnv: smartenv.Smartenv;
|
2015-12-10 14:52:14 +00:00
|
|
|
|
2017-05-17 13:59:10 +00:00
|
|
|
tap.test('should print env', async () => {
|
2019-06-17 06:46:28 +00:00
|
|
|
testEnv = new smartenv.Smartenv();
|
|
|
|
});
|
2015-11-28 13:49:44 +00:00
|
|
|
|
2017-05-17 13:59:10 +00:00
|
|
|
tap.test('should print a overview to console', async () => {
|
2019-06-17 06:46:28 +00:00
|
|
|
testEnv.printEnv();
|
|
|
|
});
|
2015-11-28 13:49:44 +00:00
|
|
|
|
2018-02-13 23:12:21 +00:00
|
|
|
tap.test('should get os', async () => {
|
2019-06-17 06:46:28 +00:00
|
|
|
const resultMac = await testEnv.isMacAsync();
|
|
|
|
const resultLinux = await testEnv.isLinuxAsync();
|
|
|
|
const resultWindows = await testEnv.isWindowsAsync();
|
|
|
|
const osModule = await import('os');
|
2018-02-13 23:12:21 +00:00
|
|
|
if (resultMac) {
|
2022-03-16 15:09:24 +00:00
|
|
|
expect(osModule.platform()).toEqual('darwin');
|
2019-06-17 06:46:28 +00:00
|
|
|
console.log('platform is Mac!');
|
2018-02-13 23:12:21 +00:00
|
|
|
} else if (resultLinux) {
|
2022-03-16 15:09:24 +00:00
|
|
|
expect(osModule.platform()).toEqual('linux');
|
2019-06-17 06:46:28 +00:00
|
|
|
console.log('platform is Linux!');
|
2018-02-13 23:12:21 +00:00
|
|
|
} else {
|
2022-03-16 15:09:24 +00:00
|
|
|
expect(osModule.platform()).toEqual('win32');
|
2019-06-17 06:46:28 +00:00
|
|
|
console.log('platform is Windows!');
|
2018-02-13 23:12:21 +00:00
|
|
|
}
|
2019-06-17 06:46:28 +00:00
|
|
|
});
|
2018-02-13 23:12:21 +00:00
|
|
|
|
2018-02-13 23:28:56 +00:00
|
|
|
tap.test('should state wether we are in CI', async () => {
|
2019-06-17 06:46:28 +00:00
|
|
|
if (process.env.CI) {
|
2022-03-16 15:09:24 +00:00
|
|
|
expect(testEnv.isCI).toBeTrue();
|
2018-02-13 23:28:56 +00:00
|
|
|
}
|
2019-06-17 06:46:28 +00:00
|
|
|
});
|
2018-02-13 23:28:56 +00:00
|
|
|
|
2019-06-17 06:46:28 +00:00
|
|
|
tap.start();
|