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