-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fix tests for zlib differences between node versions (#7040)
- Loading branch information
Showing
7 changed files
with
68 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,10 @@ Array [ | |
name: test-package | ||
version: 1.0.0 | ||
filename: test-package-1.0.0.tgz | ||
package size: 136 B | ||
package size: {size} | ||
unpacked size: 41 B | ||
shasum: a92a0679a70a450f14f98a468756948a679e4107 | ||
integrity: sha512-Gka9ZV/Bryxky[...]LgMJ+0F+FhXMA== | ||
shasum: {sha} | ||
integrity: {integrity} | ||
total files: 1 | ||
), | ||
"", | ||
|
@@ -41,14 +41,14 @@ Array [ | |
Object { | ||
"mode": 420, | ||
"path": "package.json", | ||
"size": 41, | ||
"size": "{size}", | ||
}, | ||
], | ||
"id": "[email protected]", | ||
"integrity": "sha512-Gka9ZV/BryxkypfvMpTvLfaJE1AUi7PK1EAbYqnVzqtucf6QvUK4CFsLVzagY1GwZVx2T1jwWLgMJ+0F+FhXMA==", | ||
"integrity": "{integrity}", | ||
"name": "test-package", | ||
"shasum": "a92a0679a70a450f14f98a468756948a679e4107", | ||
"size": 136, | ||
"shasum": "{sha}", | ||
"size": "{size}", | ||
"unpackedSize": 41, | ||
"version": "1.0.0", | ||
}, | ||
|
@@ -71,14 +71,14 @@ Array [ | |
Object { | ||
"mode": 420, | ||
"path": "package.json", | ||
"size": 50, | ||
"size": "{size}", | ||
}, | ||
], | ||
"id": "@myscope/[email protected]", | ||
"integrity": "sha512-bUu8iTm2E5DZMrwKeyx963K6ViEmaFocXh75EujgI+FHSaJeqvObcdk1KFwdx8CbOgsfNHEvWNQw/bONAJsoNw==", | ||
"integrity": "{integrity}", | ||
"name": "@myscope/test-package", | ||
"shasum": "7e6eb2e1ca46bed6b8fa8e144e0fcd1b22fe2d98", | ||
"size": 145, | ||
"shasum": "{sha}", | ||
"size": "{size}", | ||
"unpackedSize": 50, | ||
"version": "1.0.0", | ||
}, | ||
|
@@ -97,10 +97,10 @@ Array [ | |
name: test-package | ||
version: 1.0.0 | ||
filename: test-package-1.0.0.tgz | ||
package size: 136 B | ||
package size: {size} | ||
unpacked size: 41 B | ||
shasum: a92a0679a70a450f14f98a468756948a679e4107 | ||
integrity: sha512-Gka9ZV/Bryxky[...]LgMJ+0F+FhXMA== | ||
shasum: {sha} | ||
integrity: {integrity} | ||
total files: 1 | ||
), | ||
"", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,10 +38,10 @@ Array [ | |
name: test-package | ||
version: 1.0.0 | ||
filename: test-package-1.0.0.tgz | ||
package size: 160 B | ||
package size: {size} | ||
unpacked size: 87 B | ||
shasum:{sha} | ||
integrity:{sha} | ||
shasum: {sha} | ||
integrity: {integrity} | ||
total files: 1 | ||
), | ||
], | ||
|
@@ -82,15 +82,15 @@ exports[`test/lib/commands/publish.js TAP json > new package json 1`] = ` | |
"id": "[email protected]", | ||
"name": "test-package", | ||
"version": "1.0.0", | ||
"size": 160, | ||
"size": "{size}", | ||
"unpackedSize": 87, | ||
"shasum": "{sha}", | ||
"integrity": "{sha}", | ||
"integrity": "{integrity}", | ||
"filename": "test-package-1.0.0.tgz", | ||
"files": [ | ||
{ | ||
"path": "package.json", | ||
"size": 87, | ||
"size": "{size}", | ||
"mode": 420 | ||
} | ||
], | ||
|
@@ -289,10 +289,10 @@ Array [ | |
name: @npm/test-package | ||
version: 1.0.0 | ||
filename: npm-test-package-1.0.0.tgz | ||
package size: 147 B | ||
package size: {size} | ||
unpacked size: 55 B | ||
shasum:{sha} | ||
integrity:{sha} | ||
shasum: {sha} | ||
integrity: {integrity} | ||
total files: 1 | ||
), | ||
], | ||
|
@@ -344,10 +344,10 @@ Array [ | |
name: @npm/test-package | ||
version: 1.0.0 | ||
filename: npm-test-package-1.0.0.tgz | ||
package size: 147 B | ||
package size: {size} | ||
unpacked size: 55 B | ||
shasum:{sha} | ||
integrity:{sha} | ||
shasum: {sha} | ||
integrity: {integrity} | ||
total files: 1 | ||
), | ||
], | ||
|
@@ -398,10 +398,10 @@ Array [ | |
name: test-tar-package | ||
version: 1.0.0 | ||
filename: test-tar-package-1.0.0.tgz | ||
package size: 218 B | ||
package size: {size} | ||
unpacked size: 124 B | ||
shasum:{sha} | ||
integrity:{sha} | ||
shasum: {sha} | ||
integrity: {integrity} | ||
total files: 2 | ||
), | ||
], | ||
|
@@ -550,15 +550,15 @@ exports[`test/lib/commands/publish.js TAP workspaces json > all workspaces in js | |
"id": "[email protected]", | ||
"name": "workspace-a", | ||
"version": "1.2.3-a", | ||
"size": 162, | ||
"size": "{size}", | ||
"unpackedSize": 82, | ||
"shasum": "{sha}", | ||
"integrity": "{sha}", | ||
"integrity": "{integrity}", | ||
"filename": "workspace-a-1.2.3-a.tgz", | ||
"files": [ | ||
{ | ||
"path": "package.json", | ||
"size": 82, | ||
"size": "{size}", | ||
"mode": 420 | ||
} | ||
], | ||
|
@@ -569,15 +569,15 @@ exports[`test/lib/commands/publish.js TAP workspaces json > all workspaces in js | |
"id": "[email protected]", | ||
"name": "workspace-b", | ||
"version": "1.2.3-n", | ||
"size": 171, | ||
"size": "{size}", | ||
"unpackedSize": 92, | ||
"shasum": "{sha}", | ||
"integrity": "{sha}", | ||
"integrity": "{integrity}", | ||
"filename": "workspace-b-1.2.3-n.tgz", | ||
"files": [ | ||
{ | ||
"path": "package.json", | ||
"size": 92, | ||
"size": "{size}", | ||
"mode": 420 | ||
} | ||
], | ||
|
@@ -588,15 +588,15 @@ exports[`test/lib/commands/publish.js TAP workspaces json > all workspaces in js | |
"id": "[email protected]", | ||
"name": "workspace-n", | ||
"version": "1.2.3-n", | ||
"size": 140, | ||
"size": "{size}", | ||
"unpackedSize": 42, | ||
"shasum": "{sha}", | ||
"integrity": "{sha}", | ||
"integrity": "{integrity}", | ||
"filename": "workspace-n-1.2.3-n.tgz", | ||
"files": [ | ||
{ | ||
"path": "package.json", | ||
"size": 42, | ||
"size": "{size}", | ||
"mode": 420 | ||
} | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,10 @@ const t = require('tap') | |
const pack = require('libnpmpack') | ||
const ssri = require('ssri') | ||
const tmock = require('../../fixtures/tmock') | ||
const { cleanZlib } = require('../../fixtures/clean-snapshot') | ||
|
||
const { getContents } = require('../../../lib/utils/tar.js') | ||
t.cleanSnapshot = data => cleanZlib(data) | ||
|
||
const mockTar = ({ notice }) => tmock(t, '{LIB}/utils/tar.js', { | ||
'proc-log': { | ||
|
@@ -121,13 +123,15 @@ t.test('should getContents of a tarball', async (t) => { | |
algorithms: ['sha1', 'sha512'], | ||
}) | ||
|
||
// zlib is nondeterministic | ||
t.match(tarballContents.shasum, /^[0-9a-f]{40}$/) | ||
delete tarballContents.shasum | ||
t.strictSame(tarballContents, { | ||
id: '[email protected]', | ||
name: 'my-cool-pkg', | ||
version: '1.0.0', | ||
size: 146, | ||
size: tarball.length, | ||
unpackedSize: 49, | ||
shasum: 'b8379c5e69693cdda73aec3d81dae1d11c1e75bd', | ||
integrity: ssri.parse(integrity.sha512[0]), | ||
filename: 'my-cool-pkg-1.0.0.tgz', | ||
files: [{ path: 'package.json', size: 49, mode: 420 }], | ||
|