mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Improve install.ts tests
This commit is contained in:
parent
b419442896
commit
5b06192e7c
@ -69,6 +69,7 @@ jest.mock('../src/install', () => ({
|
|||||||
* @param extension_csv
|
* @param extension_csv
|
||||||
* @param ini_values_csv
|
* @param ini_values_csv
|
||||||
* @param coverage_driver
|
* @param coverage_driver
|
||||||
|
* @param tools
|
||||||
*/
|
*/
|
||||||
function setEnv(
|
function setEnv(
|
||||||
version: string | number,
|
version: string | number,
|
||||||
@ -76,8 +77,7 @@ function setEnv(
|
|||||||
extension_csv: string,
|
extension_csv: string,
|
||||||
ini_values_csv: string,
|
ini_values_csv: string,
|
||||||
coverage_driver: string,
|
coverage_driver: string,
|
||||||
tools: string,
|
tools: string
|
||||||
pecl: string
|
|
||||||
): void {
|
): void {
|
||||||
process.env['php-version'] = version.toString();
|
process.env['php-version'] = version.toString();
|
||||||
process.env['RUNNER_OS'] = os;
|
process.env['RUNNER_OS'] = os;
|
||||||
@ -85,26 +85,25 @@ function setEnv(
|
|||||||
process.env['ini-values'] = ini_values_csv;
|
process.env['ini-values'] = ini_values_csv;
|
||||||
process.env['coverage'] = coverage_driver;
|
process.env['coverage'] = coverage_driver;
|
||||||
process.env['tools'] = tools;
|
process.env['tools'] = tools;
|
||||||
process.env['pecl'] = pecl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('Install', () => {
|
describe('Install', () => {
|
||||||
it('Test install on windows', async () => {
|
it('Test install on windows', async () => {
|
||||||
setEnv('7.0', 'win32', '', '', '', '', '');
|
setEnv('7.0', 'win32', '', '', '', '');
|
||||||
// @ts-ignore
|
|
||||||
let script: string = await install.run();
|
let script: string = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('pwsh script.ps1 7.0 ' + __dirname);
|
expect(script).toContain('pwsh script.ps1 7.0 ' + __dirname);
|
||||||
|
|
||||||
setEnv('7.3', 'win32', '', '', '', '', '');
|
setEnv('7.3', 'win32', '', '', '', '');
|
||||||
// @ts-ignore
|
|
||||||
script = await install.run();
|
script = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('pwsh script.ps1 7.3 ' + __dirname);
|
expect(script).toContain('pwsh script.ps1 7.3 ' + __dirname);
|
||||||
|
|
||||||
setEnv('7.3', 'win32', 'a, b', 'a=b', 'x', '', '');
|
setEnv('7.3', 'win32', 'a, b', 'a=b', 'x', '');
|
||||||
// @ts-ignore
|
|
||||||
script = await install.run();
|
script = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('install extensions');
|
expect(script).toContain('install extensions');
|
||||||
expect(script).toContain('edit php.ini');
|
expect(script).toContain('edit php.ini');
|
||||||
@ -113,25 +112,15 @@ describe('Install', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Test install on linux', async () => {
|
it('Test install on linux', async () => {
|
||||||
setEnv('7.3', 'linux', '', '', '', '', '');
|
setEnv('7.3', 'linux', '', '', '', '');
|
||||||
// @ts-ignore
|
|
||||||
let script: string = await install.run();
|
let script: string = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('bash script.sh 7.3 ');
|
expect(script).toContain('bash script.sh 7.3 ');
|
||||||
|
|
||||||
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit', 'true');
|
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit');
|
||||||
// @ts-ignore
|
|
||||||
script = await install.run();
|
|
||||||
expect(script).toContain('initial script');
|
|
||||||
expect(script).toContain('install extensions');
|
|
||||||
expect(script).toContain('edit php.ini');
|
|
||||||
expect(script).toContain('set coverage driver');
|
|
||||||
expect(script).toContain('bash script.sh 7.3');
|
|
||||||
expect(script).toContain('add_tool');
|
|
||||||
|
|
||||||
setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit', '');
|
script = '' + (await install.run());
|
||||||
// @ts-ignore
|
|
||||||
script = await install.run();
|
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('install extensions');
|
expect(script).toContain('install extensions');
|
||||||
expect(script).toContain('edit php.ini');
|
expect(script).toContain('edit php.ini');
|
||||||
@ -141,15 +130,15 @@ describe('Install', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Test install on darwin', async () => {
|
it('Test install on darwin', async () => {
|
||||||
setEnv('7.3', 'darwin', '', '', '', '', '');
|
setEnv('7.3', 'darwin', '', '', '', '');
|
||||||
// @ts-ignore
|
|
||||||
let script: string = await install.run();
|
let script: string = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('bash script.sh 7.3 ' + __dirname);
|
expect(script).toContain('bash script.sh 7.3 ' + __dirname);
|
||||||
|
|
||||||
setEnv('7.3', 'darwin', 'a, b', 'a=b', 'x', '', '');
|
setEnv('7.3', 'darwin', 'a, b', 'a=b', 'x', '');
|
||||||
// @ts-ignore
|
|
||||||
script = await install.run();
|
script = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('install extensions');
|
expect(script).toContain('install extensions');
|
||||||
expect(script).toContain('edit php.ini');
|
expect(script).toContain('edit php.ini');
|
||||||
@ -158,21 +147,21 @@ describe('Install', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Test malformed version inputs', async () => {
|
it('Test malformed version inputs', async () => {
|
||||||
setEnv('7.4.1', 'darwin', '', '', '', '', '');
|
setEnv('7.4.1', 'darwin', '', '', '', '');
|
||||||
// @ts-ignore
|
|
||||||
let script: string = await install.run();
|
let script: string = '' + '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('bash script.sh 7.4 ' + __dirname);
|
expect(script).toContain('bash script.sh 7.4 ' + __dirname);
|
||||||
|
|
||||||
setEnv(8.0, 'darwin', '', '', '', '', '');
|
setEnv(8.0, 'darwin', '', '', '', '');
|
||||||
// @ts-ignore
|
|
||||||
script = await install.run();
|
script = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('bash script.sh 8.0 ' + __dirname);
|
expect(script).toContain('bash script.sh 8.0 ' + __dirname);
|
||||||
|
|
||||||
setEnv(8, 'darwin', '', '', '', '', '');
|
setEnv(8, 'darwin', '', '', '', '');
|
||||||
// @ts-ignore
|
|
||||||
script = await install.run();
|
script = '' + (await install.run());
|
||||||
expect(script).toContain('initial script');
|
expect(script).toContain('initial script');
|
||||||
expect(script).toContain('bash script.sh 8.0 ' + __dirname);
|
expect(script).toContain('bash script.sh 8.0 ' + __dirname);
|
||||||
});
|
});
|
||||||
|
62
package-lock.json
generated
62
package-lock.json
generated
@ -1057,45 +1057,46 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@typescript-eslint/eslint-plugin": {
|
"@typescript-eslint/eslint-plugin": {
|
||||||
"version": "2.34.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.0.0.tgz",
|
||||||
"integrity": "sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==",
|
"integrity": "sha512-lcZ0M6jD4cqGccYOERKdMtg+VWpoq3NSnWVxpc/AwAy0zhkUYVioOUZmfNqiNH8/eBNGhCn6HXd6mKIGRgNc1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/experimental-utils": "2.34.0",
|
"@typescript-eslint/experimental-utils": "3.0.0",
|
||||||
"functional-red-black-tree": "^1.0.1",
|
"functional-red-black-tree": "^1.0.1",
|
||||||
"regexpp": "^3.0.0",
|
"regexpp": "^3.0.0",
|
||||||
|
"semver": "^7.3.2",
|
||||||
"tsutils": "^3.17.1"
|
"tsutils": "^3.17.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/experimental-utils": {
|
"@typescript-eslint/experimental-utils": {
|
||||||
"version": "2.34.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.0.0.tgz",
|
||||||
"integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==",
|
"integrity": "sha512-BN0vmr9N79M9s2ctITtChRuP1+Dls0x/wlg0RXW1yQ7WJKPurg6X3Xirv61J2sjPif4F8SLsFMs5Nzte0WYoTQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/json-schema": "^7.0.3",
|
"@types/json-schema": "^7.0.3",
|
||||||
"@typescript-eslint/typescript-estree": "2.34.0",
|
"@typescript-eslint/typescript-estree": "3.0.0",
|
||||||
"eslint-scope": "^5.0.0",
|
"eslint-scope": "^5.0.0",
|
||||||
"eslint-utils": "^2.0.0"
|
"eslint-utils": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/parser": {
|
"@typescript-eslint/parser": {
|
||||||
"version": "2.34.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.34.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.0.0.tgz",
|
||||||
"integrity": "sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA==",
|
"integrity": "sha512-8RRCA9KLxoFNO0mQlrLZA0reGPd/MsobxZS/yPFj+0/XgMdS8+mO8mF3BDj2ZYQj03rkayhSJtF1HAohQ3iylw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/eslint-visitor-keys": "^1.0.0",
|
"@types/eslint-visitor-keys": "^1.0.0",
|
||||||
"@typescript-eslint/experimental-utils": "2.34.0",
|
"@typescript-eslint/experimental-utils": "3.0.0",
|
||||||
"@typescript-eslint/typescript-estree": "2.34.0",
|
"@typescript-eslint/typescript-estree": "3.0.0",
|
||||||
"eslint-visitor-keys": "^1.1.0"
|
"eslint-visitor-keys": "^1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/typescript-estree": {
|
"@typescript-eslint/typescript-estree": {
|
||||||
"version": "2.34.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.0.0.tgz",
|
||||||
"integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==",
|
"integrity": "sha512-nevQvHyNghsfLrrByzVIH4ZG3NROgJ8LZlfh3ddwPPH4CH7W4GAiSx5qu+xHuX5pWsq6q/eqMc1io840ZhAnUg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
@ -2253,6 +2254,35 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/experimental-utils": "^2.5.0"
|
"@typescript-eslint/experimental-utils": "^2.5.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@typescript-eslint/experimental-utils": {
|
||||||
|
"version": "2.34.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz",
|
||||||
|
"integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/json-schema": "^7.0.3",
|
||||||
|
"@typescript-eslint/typescript-estree": "2.34.0",
|
||||||
|
"eslint-scope": "^5.0.0",
|
||||||
|
"eslint-utils": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@typescript-eslint/typescript-estree": {
|
||||||
|
"version": "2.34.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz",
|
||||||
|
"integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"debug": "^4.1.1",
|
||||||
|
"eslint-visitor-keys": "^1.1.0",
|
||||||
|
"glob": "^7.1.6",
|
||||||
|
"is-glob": "^4.0.1",
|
||||||
|
"lodash": "^4.17.15",
|
||||||
|
"semver": "^7.3.2",
|
||||||
|
"tsutils": "^3.17.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint-plugin-prettier": {
|
"eslint-plugin-prettier": {
|
||||||
|
@ -30,10 +30,10 @@
|
|||||||
"fs": "0.0.1-security"
|
"fs": "0.0.1-security"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^25.2.2",
|
"@types/jest": "^25.2.3",
|
||||||
"@types/node": "^14.0.1",
|
"@types/node": "^14.0.4",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.34.0",
|
"@typescript-eslint/eslint-plugin": "^3.0.0",
|
||||||
"@typescript-eslint/parser": "^2.34.0",
|
"@typescript-eslint/parser": "^3.0.0",
|
||||||
"@zeit/ncc": "^0.22.2",
|
"@zeit/ncc": "^0.22.2",
|
||||||
"eslint": "^7.0.0",
|
"eslint": "^7.0.0",
|
||||||
"eslint-config-prettier": "^6.11.0",
|
"eslint-config-prettier": "^6.11.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user