mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-29 19:41:16 -05:00
38f980e0c4
* internal: (studio) improvements to how studio can access the protocol database * fix * fix build * refactor due to downstream changes * feat: capture errors with studio * types * add tests * fix types * fix typescript * strip path * fix tests
15 lines
391 B
TypeScript
15 lines
391 B
TypeScript
import { last } from 'lodash'
|
|
|
|
// strip everything but the file name to remove any sensitive
|
|
// data in the path
|
|
const pathRe = /'?((\/|\\+|[a-z]:\\)[^\s']+)+'?/ig
|
|
const pathSepRe = /[\/\\]+/
|
|
|
|
export const stripPath = (text: string) => {
|
|
return (text || '').replace(pathRe, (path) => {
|
|
const fileName = last(path.split(pathSepRe)) || ''
|
|
|
|
return `<stripped-path>${fileName}`
|
|
})
|
|
}
|