testomatio / check-tests

GitHub action with static analysis for JavaScript tests.
https://testomat.io
21 stars 7 forks source link

[ISSUE-80]: update-ids func inserts ids into import statements #91

Closed mykhailiukVitalii closed 1 year ago

mykhailiukVitalii commented 1 year ago

Fixes for https://github.com/testomatio/check-tests/issues/80 I have added additional import handling for ts & js files. Like

const fixSuiteContent = (title, replace, content) => {
  const importLines = content.split('\n').filter(line => line.match(LINE_START_REGEX));

  if (importLines.length) {
    const testLines = content.split('\n').filter(line => !line.match(LINE_START_REGEX));
    const updatedTestLines = testLines.map(line => line.replace(title, replace));

    return [...importLines, ...updatedTestLines].join('\n');
  }

  return content.replace(title, replace);
};
mykhailiukVitalii commented 1 year ago

@DavertMik I have updated changes + added a new unit test. Seem's like if I re-push to fork branch - the error for jobs is displayed again!

mykhailiukVitalii commented 1 year ago

I have pushed latest changes

mykhailiukVitalii commented 1 year ago

@DavertMik I check your case + added a new unit-tests. Actual result -> all right.