Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting different results tho nothing is changed #1154

Closed
bartekleon opened this issue Jul 30, 2019 · 3 comments
Closed

getting different results tho nothing is changed #1154

bartekleon opened this issue Jul 30, 2019 · 3 comments

Comments

@bartekleon
Copy link

bartekleon commented Jul 30, 2019

Expected Behavior

Getting the same output if i dont change code

Observed Behavior

Getting different results

Environment Information

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    Memory: 2.71 GB / 7.90 GB
  Binaries:
    Node: 10.16.0 - C:\Program Files\nodejs\node.EXE
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    nyc: ^14.0.0 => 14.1.1 
    source-map-support: ^0.5.12 => 0.5.12 
    ts-node: ^8.3.0 => 8.3.0 
    typescript: ^3.5.3 => 3.5.3

Configuration

package.json

"nyc": {
    "extends": "@istanbuljs/nyc-config-typescript",
    "all": true,
    "check-coverage": true,
    "reporter": ["text", "html"]
  }

mocha.opts

--require ts-node/register/transpile-only
--require source-map-support/register
--recursive
test/**.ts

Function I am testing

type statusNames = "passes" | "both" | "fails";
interface Item {
  codes?: {
    [key in statusNames]?: string;
  };
  dependencies?: string[];
  description?: string;
  name: string;
}
interface Config {
  docker: boolean;
  items: Item[];
  language: string;
  projectName: string;
}
const phpParser = (code: Config) => {
  let newCode = `<?xml version="1.0" encoding="UTF-8"?>
<project name="${ code.projectName }" default="${ (code.items[0] || {}).name || "" }">`;

  if (code.docker) {
    newCode += `\n  <!-- Docker properties -->
  <property name="docker" value="docker" />
  <property name="dockerFilePath" value="\${basedir}/Dockerfile" />
  <property name="dockerBaseDir" value="\${basedir}" />`;
  }

  if (code.items.length > 0) {
    newCode += "\n  <!-- Properties -->";
    for (const item of code.items) {
      newCode += `\n  <property name="${ item.name }" value="\${dockerBaseDir}/bin/${ item.name }" />`;
    }
    newCode += "\n  <!-- Tasks -->";

    for (const item of code.items) {
      newCode += `\n  <target name="${ item.name }"${
        Array.isArray(item.dependencies) && item.dependencies.length > 0 ?
        `\n    depends="${ (item.dependencies || []).join(",") }"` : ""
      }${
        item.description ? `\n    description="${ item.description }"` : ""
      }/>`;
    }
  }
  newCode += "\n</project>";
  return newCode;
};

image
image

@soryy708
Copy link

You're using TypeScript. Perhaps this is related? #1148

@coreyfarrell
Copy link
Member

I believe this issue is fixed in nyc 15.0.0.

@bartekleon
Copy link
Author

Unfortunately I don't have access to that repository anymore, so i can't confirm it. I guess I'll close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants