1
1
import _ from 'lodash'
2
+ import assert from 'assert'
2
3
import arch from 'arch'
3
4
import os from 'os'
4
5
import ospath from 'ospath'
5
6
import hasha from 'hasha'
6
- import la from 'lazy-ass'
7
7
import tty from 'tty'
8
8
import path from 'path'
9
9
import { isCI as isCi } from 'ci-info'
@@ -23,9 +23,6 @@ import Debug from 'debug'
23
23
import fs from 'fs-extra'
24
24
import pkg from '../package.json'
25
25
26
- // TODO: this package needs to be replaced as we can't import it in vitest
27
- const is = require ( 'check-more-types' )
28
-
29
26
const debug = Debug ( 'cypress:cli' )
30
27
31
28
const issuesUrl = 'https://github.com/cypress-io/cypress/issues'
@@ -34,13 +31,13 @@ const issuesUrl = 'https://github.com/cypress-io/cypress/issues'
34
31
* Returns SHA512 of a file
35
32
*/
36
33
const getFileChecksum = ( filename : string ) : any => {
37
- la ( is . unemptyString ( filename ) , 'expected filename' , filename )
34
+ assert . ok ( _ . isString ( filename ) && ! _ . isEmpty ( filename ) , 'expected filename' )
38
35
39
36
return hasha . fromFile ( filename , { algorithm : 'sha512' } )
40
37
}
41
38
42
39
const getFileSize = async ( filename : string ) : Promise < any > => {
43
- la ( is . unemptyString ( filename ) , 'expected filename' , filename )
40
+ assert . ok ( _ . isString ( filename ) && ! _ . isEmpty ( filename ) , 'expected filename' )
44
41
45
42
const { size } = await fs . stat ( filename )
46
43
@@ -165,7 +162,7 @@ function printNodeOptions (log: any = debug): void {
165
162
```
166
163
*/
167
164
const dequote = ( str : string ) : string => {
168
- la ( is . string ( str ) , 'expected a string to remove double quotes' , str )
165
+ assert . ok ( _ . isString ( str ) , 'expected a string to remove double quotes' )
169
166
if ( str . length > 1 && str [ 0 ] === '"' && str [ str . length - 1 ] === '"' ) {
170
167
return str . substr ( 1 , str . length - 2 )
171
168
}
@@ -501,7 +498,7 @@ const util = {
501
498
} ,
502
499
503
500
getEnv ( varName : string , trim ?: boolean ) : string | undefined {
504
- la ( is . unemptyString ( varName ) , 'expected environment variable name, not' , varName )
501
+ assert . ok ( _ . isString ( varName ) && ! _ . isEmpty ( varName ) , 'expected environment variable name, not' )
505
502
506
503
const configVarName = `npm_config_${ varName } `
507
504
const configVarNameLower = configVarName . toLowerCase ( )
@@ -560,8 +557,8 @@ const util = {
560
557
isPossibleLinuxWithIncorrectDisplay,
561
558
562
559
getGitHubIssueUrl ( number : number ) : string {
563
- la ( is . positive ( number ) , 'github issue should be a positive number' , number )
564
- la ( _ . isInteger ( number ) , 'github issue should be an integer' , number )
560
+ assert . ok ( _ . isInteger ( number ) , 'github issue should be an integer' )
561
+ assert . ok ( number > 0 , 'github issue should be a positive number' )
565
562
566
563
return `${ issuesUrl } /${ number } `
567
564
} ,
0 commit comments