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

fix: Upgraded project development environment to babel 7 and webpack 4 #1505

Merged
merged 6 commits into from
Feb 20, 2019

Conversation

rpl
Copy link
Member

@rpl rpl commented Feb 18, 2019

No description provided.

@coveralls
Copy link

coveralls commented Feb 18, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 0e98fc2 on rpl:update-deps/babel7-and-webpack4 into a9b9a76 on mozilla:master.

@rpl rpl force-pushed the update-deps/babel7-and-webpack4 branch 3 times, most recently from 94af977 to f3057f4 Compare February 18, 2019 19:01
@rpl rpl requested a review from Rob--W February 18, 2019 19:37
Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you thought of using stubs instead of injecting fake implementations? The advantage is that the implementation is not filled with test-specific parameters. The disadvantage is that if the test somehow fails unexpectedly and restore isn't called, that other tests may fail in unexpected ways.

let stub = sinon.stub(fs, "readFile").callsFake(() => ... );
// or if you want to asynchronously throw:
let stub = sinon.stub(fs, "readFile").rejects(new Error(""));

// Done? Restore original
stub.restore();

tests/unit/test-util/test.artifacts.js Show resolved Hide resolved
tests/unit/test-util/test.temp-dir.js Outdated Show resolved Hide resolved
};
},
const FxProfile = {};
FxProfile.Finder = function Finder() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests has started to fail because of Finder wasn't considered a constructor, I think that the upgrade from babel 6 to babel 7 somehow unveiled the issue.

throw new Error('Unexpected fs.readFile error');
});
await assert.isRejected(
getIdFromSourceDir('fakeSourceDir', fakeAsyncFsReadFile),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to minimize the number of injected dependencies, then you could create a directory or file without the right permissions (since the the implementation doesn't handle the EACCES error). This makes the test a bit less artificial than injecting a fake fs.readFile.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I was initially thinking of going for that strategy, but I would prefer to don't add this test to the ones skipped on windows (I would like to reduce the number of tests skipped on windows, not growing that list), and so I preferred to use this strategy instead.

@rpl rpl force-pushed the update-deps/babel7-and-webpack4 branch from f3057f4 to 0e98fc2 Compare February 20, 2019 12:49
@rpl
Copy link
Member Author

rpl commented Feb 20, 2019

Have you thought of using stubs instead of injecting fake implementations?
The advantage is that.... The disadvantage...

@Rob--W yeah, obviously I've been also thinking about that, to be honest I would like to rework our unit tests to avoid all the "dependency injection" that we are currently using (almost everywhere in the project) just to make those tests possible, not just the ones added in this PR.

But in this PR I really want to avoid any change that is not strictly necessary to complete the port to babel 7 and webpack 4, and so I just added the minimum set of additional tests needed to make coveralls happy again, using the testing strategy currently used in the rest of the project.

In the meantime I filed it as #1511 to follow up on that.

Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to land, thanks for this work!

tests/unit/test-util/test.artifacts.js Show resolved Hide resolved
@rpl rpl merged commit 5d2dfb4 into mozilla:master Feb 20, 2019
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.

3 participants