How to use the path-parse.posix function in path-parse

To help you get started, we’ve selected a few path-parse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / ConversationLearner-UI / cypress / support / TestList.js View on Github external
export function AddToCypressTestList() {
  var funcName = `AddToCypressTestList()`
  //                                                                              test group name--\      /--Test function name
  // callerFileName looks like: http://localhost:5050/__cypress/tests?p=cypress\integration\Tests\Train\WhatsYourName1.js-044
  var callerFileName = GetCallerFileName()
  callerFileName = path.normalize(callerFileName.substring(callerFileName.lastIndexOf("p=") + 2, callerFileName.lastIndexOf("-"))).replace(/\\/g, path.sep)
  helpers.ConLog(funcName, `callerFileName: ${callerFileName}`)

  const parsed = pathParse.posix(callerFileName)
  const testName = parsed.name
  const testGroupName = parsed.dir.substr(parsed.dir.lastIndexOf(path.sep) + 1)

  var allTests = (testName == '(All)')
  var allGroups = (allTests && testGroupName == 'Tests')
  var toFind = `function ${testName}(`
  helpers.ConLog(funcName, `testGroup: ${testGroupName} - testName: ${testName} - allTests: ${allTests} - allGroups ${allGroups} - toFind: ${toFind}`)

  var group
  for (var i = 0; i < testGroups.length; i++) {
    if (allGroups || testGroups[i].name == testGroupName) {
      group = testGroups[i]

      var test
      describe(group.name, () => {
        helpers.ConLog(funcName, `Added Group: ${group.name}`)

path-parse

Node.js path.parse() ponyfill

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis

Popular path-parse functions