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

Remove unnecessary prepend of test with current folder #145

Merged
merged 18 commits into from
Apr 11, 2018
Merged

Remove unnecessary prepend of test with current folder #145

merged 18 commits into from
Apr 11, 2018

Conversation

pkuczynski
Copy link
Contributor

@pkuczynski pkuczynski commented Jun 30, 2017

Allow running individual tests from WebStorm environment. Works well also outside of WebStorm.

Fixes #115

@pkuczynski
Copy link
Contributor Author

@zinserjan could you please review this change and release 1.0.0-beta.2? It's kind of urgent for my team to be able to run the tests from within WebStorm environment :)

@zinserjan
Copy link
Owner

zinserjan commented Jun 30, 2017

@pkuczynski looks like all tests with relative entries are failing, so this isn't a solution.
It would be better to check for absolute paths instead of skipping this step.

EDIT: Can you create a path utilitly for that and add some unit tests? For example a function like the following ensureAbsolutePath(filePath, cwd) which prepends cwd when the path isn't already absolute.

@pkuczynski
Copy link
Contributor Author

I noticed that tests are failing. I will have a look on Monday, ok?

@zinserjan
Copy link
Owner

Sure, sounds good for me.

Btw I just found the PR that added this absolute path handling: #106.

I think bumping the glob version in globby to at least 7.1 and reverting #106 could fix this.

@pkuczynski
Copy link
Contributor Author

@zinserjan how would you like to bump glob in globby if that's an external package?

@zinserjan
Copy link
Owner

@pkuczynski sending a PR there is the only reliable way to make sure that we are using a version that works with absolute paths.

But before you can try this out on your project.

@pkuczynski
Copy link
Contributor Author

I reverted the changes as you suggested, but 4 tests still fail:

  • cli --watch should run only the changed test again when it changes
  • cli --watch should recognize new test entries that match the pattern
  • cli --watch should recognize multiple new test entries that match the pattern
  • cli --watch should recognize deleted test entries that match the pattern

Even if I updated local installation of globby to use glob 7.1.

@zinserjan
Copy link
Owner

CI tests aren't failing, just the linting fails. For local development rebase your branch. I made several changes to make the tests working again :)

@pkuczynski
Copy link
Contributor Author

Indeed, I was removing a comma instead of adding it. Different linting style then the one I am used to :)

@zinserjan
Copy link
Owner

Looks like the rebase rewrote the whole history. Can you fix this so that only your commits applied to the latest master?

@codecov-io
Copy link

codecov-io commented Jul 3, 2017

Codecov Report

Merging #145 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #145      +/-   ##
==========================================
- Coverage      97%   96.99%   -0.01%     
==========================================
  Files          28       28              
  Lines         767      765       -2     
==========================================
- Hits          744      742       -2     
  Misses         23       23
Impacted Files Coverage Δ
src/runner/TestRunner.js 99.15% <100%> (-0.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update acc7221...c240a1e. Read the comment docs.

@pkuczynski
Copy link
Contributor Author

I can confirm, that after re-base all the tests pass. It it did not require changing glob version in globby! Are we good to merge?

@pkuczynski
Copy link
Contributor Author

PR rebased against latest upstream/master

@zinserjan
Copy link
Owner

It it did not require changing glob version in globby! Are we good to merge?

No, bumping the version in globby is the only reliable way to make sure that the absolute path option is available. We cannot rely on npms module hoisting as it fails with npm@2 and it could also fail if another package needs glob < 7.1 and cause of the matching of glob > 7.0 in globby we will get 7.0 for glob :( That was the reason why I did #106, but I wasn't aware of the drawbacks... It was just the simplest solution...

History is still messed up, but githubs squashing should fix this :D

@pkuczynski
Copy link
Contributor Author

PR requested sindresorhus/globby#45

@pkuczynski
Copy link
Contributor Author

@zinserjan could you please comment in sindresorhus/globby#45?

@zinserjan
Copy link
Owner

I think we should start to work an a different approach to speed things up and just ensure the absolute paths manually.

Can you work on this on a different PR? So we can keep this open and merge it someday.

I think something like this could work:

import path from "path";
import normalizePath from "normalize-path"
function ensureAbsolutePath(path, basePath) {
  return path.posix.isAbsolute(path) || path.win32.isAbsolute(path)  ? path : path.join(basePath, path);
}

@pkuczynski
Copy link
Contributor Author

Not sure if its worth the effort if undoing #106 make it work anyway.

sindresorhus pushed a commit to sindresorhus/globby that referenced this pull request Jul 5, 2017
@zinserjan zinserjan mentioned this pull request Jul 12, 2017
zinserjan added a commit that referenced this pull request Jul 17, 2017
fixes #115
workaround until #145 is ready to merge
@zinserjan
Copy link
Owner

I added a temporary workaround to fix this issue (#160).

We can continue the work on this PR when a new version of globby is available.

kevva pushed a commit to sindresorhus/globby that referenced this pull request Jul 24, 2017
@astorije
Copy link
Contributor

astorije commented Mar 9, 2018

@pkuczynski, would you like to rebase on master and fix conflicts? (also squash commits)

@pkuczynski
Copy link
Contributor Author

Done

@pkuczynski
Copy link
Contributor Author

You can squash in GH interface, right?

@zinserjan
Copy link
Owner

Yep.

The ensureAbsolutePath workaround introcuded with #160 is no longer necessary with this change. Can you remove that also?

@pkuczynski
Copy link
Contributor Author

Sure. Done. Should I also remove it from

.forEach((assetPath) => assetMap.set(ensureAbsolutePath(assetPath, compiler.options.output.path), true));
?

@zinserjan
Copy link
Owner

Good question. If I remember correctly, webpack emits just relative file paths.

@zinserjan
Copy link
Owner

Ah I'm pretty sure right now, cause I was happy that we had this function already :)

@pkuczynski
Copy link
Contributor Author

Good. So we are done with this PR, right?

@zinserjan
Copy link
Owner

Yep. Thank you! 😉

@zinserjan zinserjan merged commit e2aeeb0 into zinserjan:master Apr 11, 2018
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

Successfully merging this pull request may close these issues.

6 participants