update smartenv to support os information on nodejs
This commit is contained in:
20
test/test.ts
20
test/test.ts
@ -1,5 +1,5 @@
|
||||
import { tap, expect } from 'tapbundle'
|
||||
import * as smartenv from '../dist/index'
|
||||
import * as smartenv from '../ts/index'
|
||||
|
||||
let testEnv: smartenv.Smartenv
|
||||
|
||||
@ -11,4 +11,22 @@ tap.test('should print a overview to console', async () => {
|
||||
testEnv.printEnv()
|
||||
})
|
||||
|
||||
tap.test('should get os', async () => {
|
||||
let resultLinux = await testEnv.isLinuxAsync()
|
||||
let resultMac = await testEnv.isMacAsync
|
||||
let resultWindows = await testEnv.isWindowsAsync()
|
||||
const osModule = await import('os')
|
||||
if (resultMac) {
|
||||
expect(osModule.platform()).to.equal('darwin');
|
||||
console.log('platform is Mac!')
|
||||
} else if (resultLinux) {
|
||||
expect(osModule.platform()).to.equal('linux');
|
||||
console.log('platform is Linux!')
|
||||
} else {
|
||||
expect(osModule.platform()).to.equal('win32');
|
||||
console.log('platform is Windows!')
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
tap.start()
|
||||
|
Reference in New Issue
Block a user