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

Add tests for the gzip functionality - VM #1730

Conversation

julienw
Copy link
Contributor

@julienw julienw commented Feb 6, 2019

In this PR we fake a worker by using node's VM capability. This isn't a real worker so it may have slightly different semantics (especially the structured clone algorithm) but it might be good enough for our needs.

Please compare with #1731.

@codecov
Copy link

codecov bot commented Feb 6, 2019

Codecov Report

Merging #1730 into master will increase coverage by 0.1%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #1730     +/-   ##
=========================================
+ Coverage   83.24%   83.35%   +0.1%     
=========================================
  Files         178      178             
  Lines       12022    12033     +11     
  Branches     2952     2958      +6     
=========================================
+ Hits        10008    10030     +22     
+ Misses       1837     1828      -9     
+ Partials      177      175      -2
Impacted Files Coverage Δ
src/profile-logic/profile-store.js 0% <ø> (ø) ⬆️
src/utils/gz.js 100% <100%> (+95.23%) ⬆️
src/components/app/MenuButtons.js 77.54% <100%> (ø) ⬆️
src/profile-logic/process-profile.js 91.31% <0%> (-1.88%) ⬇️
src/profile-logic/processed-profile-versioning.js 93.5% <0%> (-0.07%) ⬇️
src/test/fixtures/profiles/gecko-profile.js 100% <0%> (ø) ⬆️

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 d38834e...75191b9. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Feb 6, 2019

Codecov Report

Merging #1730 into master will increase coverage by 0.1%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #1730     +/-   ##
=========================================
+ Coverage   83.24%   83.35%   +0.1%     
=========================================
  Files         178      178             
  Lines       12022    12033     +11     
  Branches     2952     2958      +6     
=========================================
+ Hits        10008    10030     +22     
+ Misses       1837     1828      -9     
+ Partials      177      175      -2
Impacted Files Coverage Δ
src/profile-logic/profile-store.js 0% <ø> (ø) ⬆️
src/utils/gz.js 100% <100%> (+95.23%) ⬆️
src/components/app/MenuButtons.js 77.54% <100%> (ø) ⬆️
src/profile-logic/process-profile.js 91.31% <0%> (-1.88%) ⬇️
src/profile-logic/processed-profile-versioning.js 93.5% <0%> (-0.07%) ⬇️
src/test/fixtures/profiles/gecko-profile.js 100% <0%> (ø) ⬆️

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 d38834e...75191b9. Read the comment docs.

@@ -30,7 +30,7 @@ function workerOnMessage(zeeWorker: Worker) {
export function compress(
data: string | Uint8Array,
compressionLevel?: number
): Promise<string> {
): Promise<Uint8Array> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were lying :)

it('compresses and decompresses properly', async () => {
const clearText = '42';
const gzipedData = await compress(clearText);
expect(gzipedData.constructor.name).toBe('Uint8Array');
Copy link
Contributor Author

@julienw julienw Feb 6, 2019

Choose a reason for hiding this comment

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

The Uint8Array's instance used is the one from inside the sandbox, that's why we can't use toBeInstanceOflike the other PR.

@gregtatum gregtatum changed the title Add tests for the gzip functionality Add tests for the gzip functionality - VM Feb 8, 2019
@julienw
Copy link
Contributor Author

julienw commented Feb 14, 2019

closing in favor of #1731

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.

2 participants