()
| 984 | } |
| 985 | |
| 986 | const installMaybe = () => { |
| 987 | const installParameter = getInputBool('install', true) |
| 988 | if (!installParameter) { |
| 989 | console.log('Skipping install because install parameter is false') |
| 990 | return Promise.resolve() |
| 991 | } |
| 992 | |
| 993 | const packageManagerCacheEnabled = getInputBool( |
| 994 | 'package-manager-cache', |
| 995 | true |
| 996 | ) |
| 997 | const npmCachePromise = packageManagerCacheEnabled |
| 998 | ? restoreCachedNpm() |
| 999 | : Promise.resolve(false) |
| 1000 | |
| 1001 | return Promise.all([ |
| 1002 | npmCachePromise, |
| 1003 | restoreCachedCypressBinary() |
| 1004 | ]).then(([npmCacheHit, cypressCacheHit]) => { |
| 1005 | debug(`npm cache hit ${npmCacheHit}`) |
| 1006 | debug(`cypress cache hit ${cypressCacheHit}`) |
| 1007 | |
| 1008 | return install().then(() => { |
| 1009 | debug('install has finished') |
| 1010 | return listCypressBinaries().then(() => { |
| 1011 | if (npmCacheHit && cypressCacheHit) { |
| 1012 | debug('no need to verify Cypress binary or save caches') |
| 1013 | return Promise.resolve(undefined) |
| 1014 | } |
| 1015 | |
| 1016 | debug('verifying Cypress binary') |
| 1017 | const saveNpmPromise = packageManagerCacheEnabled |
| 1018 | ? saveCachedNpm() |
| 1019 | : Promise.resolve(undefined) |
| 1020 | return verifyCypressBinary() |
| 1021 | .then(() => saveNpmPromise) |
| 1022 | .then(saveCachedCypressBinary) |
| 1023 | }) |
| 1024 | }) |
| 1025 | }) |
| 1026 | } |
| 1027 | |
| 1028 | installMaybe() |
| 1029 | .then(buildAppMaybe) |
no test coverage detected