feat(smartenv): add Bun and Deno OS detection support and update test runtime compatibility
This commit is contained in:
+6
-6
@@ -13,7 +13,7 @@ tap.test('should detect Bun runtime correctly', async () => {
|
||||
expect(testEnv.isNode).toBeFalse();
|
||||
expect(testEnv.isDeno).toBeFalse();
|
||||
expect(testEnv.isBrowser).toBeFalse();
|
||||
console.log(' Bun runtime detected correctly');
|
||||
console.log('Bun runtime detected correctly');
|
||||
});
|
||||
|
||||
tap.test('should get Bun version', async () => {
|
||||
@@ -31,27 +31,27 @@ tap.test('should load modules for Bun', async () => {
|
||||
const pathModule = await testEnv.getSafeModuleFor('bun', 'path');
|
||||
expect(pathModule).not.toBeUndefined();
|
||||
expect(typeof pathModule.join).toEqual('function');
|
||||
console.log(' Successfully loaded module for Bun');
|
||||
console.log('Successfully loaded module for Bun');
|
||||
});
|
||||
|
||||
tap.test('should load modules for server runtimes', async () => {
|
||||
const pathModule = await testEnv.getSafeModuleFor('server', 'path');
|
||||
expect(pathModule).not.toBeUndefined();
|
||||
expect(typeof pathModule.join).toEqual('function');
|
||||
console.log(' Successfully loaded module with server target');
|
||||
console.log('Successfully loaded module with server target');
|
||||
});
|
||||
|
||||
tap.test('should load modules for array of runtimes', async () => {
|
||||
const pathModule = await testEnv.getSafeModuleFor(['bun', 'node'], 'path');
|
||||
expect(pathModule).not.toBeUndefined();
|
||||
expect(typeof pathModule.join).toEqual('function');
|
||||
console.log(' Successfully loaded module with array target');
|
||||
console.log('Successfully loaded module with array target');
|
||||
});
|
||||
|
||||
tap.test('should not load modules for wrong runtime', async () => {
|
||||
const result = await testEnv.getSafeModuleFor('node', 'path');
|
||||
expect(result).toBeUndefined();
|
||||
console.log(' Correctly rejected Node.js-only module in Bun');
|
||||
console.log('Correctly rejected Node.js-only module in Bun');
|
||||
});
|
||||
|
||||
tap.test('should detect OS', async () => {
|
||||
@@ -78,4 +78,4 @@ tap.test('should detect CI environment if present', async () => {
|
||||
console.log('CI detection: ' + testEnv.isCI);
|
||||
});
|
||||
|
||||
tap.start();
|
||||
export default tap.start();
|
||||
|
||||
Reference in New Issue
Block a user