mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
chore: fix tests
This commit is contained in:
@ -13,6 +13,12 @@ jest.mock('cosmiconfig', () => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
jest.mock('../src/helpers/config.ts', () => ({
|
||||||
|
getValue(key, defaultValue) {
|
||||||
|
return defaultValue;
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
jest.mock('os', () => {
|
jest.mock('os', () => {
|
||||||
const os = jest.requireActual('os');
|
const os = jest.requireActual('os');
|
||||||
|
|
||||||
@ -23,27 +29,27 @@ jest.mock('os', () => {
|
|||||||
in0: [
|
in0: [
|
||||||
{
|
{
|
||||||
address: '127.0.0.1',
|
address: '127.0.0.1',
|
||||||
family: 'IPv4'
|
family: 'IPv4',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
address: 'in0-ipv6-should-not-use',
|
address: 'in0-ipv6-should-not-use',
|
||||||
family: 'IPv6'
|
family: 'IPv6',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
in1: [
|
in1: [
|
||||||
{
|
{
|
||||||
address: '192.168.0.10',
|
address: '192.168.0.10',
|
||||||
family: 'IPv4'
|
family: 'IPv4',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
address: 'in1-ipv6-should-not-use',
|
address: 'in1-ipv6-should-not-use',
|
||||||
family: 'IPv6'
|
family: 'IPv6',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
};
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
|
|
||||||
jest.mock('path', () => {
|
jest.mock('path', () => {
|
||||||
const path = jest.requireActual('path');
|
const path = jest.requireActual('path');
|
||||||
|
@ -16,10 +16,10 @@ function getCLILib() {
|
|||||||
*
|
*
|
||||||
* @param {string} key The key to get from the config. Supports dot-notation.
|
* @param {string} key The key to get from the config. Supports dot-notation.
|
||||||
*/
|
*/
|
||||||
export function getValue<T = any>(key: string): T {
|
export function getValue<T = any>(key: string, defaultValue?: any): T {
|
||||||
const lib = getCLILib();
|
const lib = getCLILib();
|
||||||
|
|
||||||
return (lib.projectConfigService as { getValue(key: string): T }).getValue(
|
return (lib.projectConfigService as {
|
||||||
key
|
getValue(key: string, defaultValue?: any): T;
|
||||||
);
|
}).getValue(key, defaultValue);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,8 @@ const webpack = require("@nativescript/webpack");
|
|||||||
module.exports = (env) => {
|
module.exports = (env) => {
|
||||||
webpack.init(env);
|
webpack.init(env);
|
||||||
|
|
||||||
// todo: comments for common usage
|
// Learn how to customize:
|
||||||
|
// https://docs.nativescript.org/webpack
|
||||||
|
|
||||||
return webpack.resolveConfig();
|
return webpack.resolveConfig();
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user