-
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a coverage map for more targetted testing
- Loading branch information
Showing
6 changed files
with
134 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const {basename} = require('path') | ||
|
||
const map = test => | ||
test === 'index.js' || test === 'map.js' ? test | ||
: test === 'unpack.js' ? ['lib/unpack.js', 'lib/mkdir.js'] | ||
: test === 'load-all.js' ? [] | ||
: `lib/${test}` | ||
|
||
module.exports = test => map(basename(test)) |
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 |
---|---|---|
|
@@ -43,6 +43,7 @@ | |
"lib/" | ||
], | ||
"tap": { | ||
"coverage-map": "map.js", | ||
"check-coverage": true | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const t = require('tap') | ||
const tar = require('../') | ||
t.match(tar, { | ||
create: Function, | ||
c: Function, | ||
replace: Function, | ||
r: Function, | ||
list: Function, | ||
t: Function, | ||
update: Function, | ||
u: Function, | ||
extract: Function, | ||
x: Function, | ||
Pack: Function, | ||
Unpack: Function, | ||
Parse: Function, | ||
ReadEntry: Function, | ||
WriteEntry: Function, | ||
Header: Function, | ||
Pax: Function, | ||
types: { | ||
name: new Map([ | ||
['0', 'File'], | ||
['', 'OldFile'], | ||
['1', 'Link'], | ||
['2', 'SymbolicLink'], | ||
['3', 'CharacterDevice'], | ||
['4', 'BlockDevice'], | ||
['5', 'Directory'], | ||
['6', 'FIFO'], | ||
['7', 'ContiguousFile'], | ||
['g', 'GlobalExtendedHeader'], | ||
['x', 'ExtendedHeader'], | ||
['A', 'SolarisACL'], | ||
['D', 'GNUDumpDir'], | ||
['I', 'Inode'], | ||
['K', 'NextFileHasLongLinkpath'], | ||
['L', 'NextFileHasLongPath'], | ||
['M', 'ContinuationFile'], | ||
['N', 'OldGnuLongPath'], | ||
['S', 'SparseFile'], | ||
['V', 'TapeVolumeHeader'], | ||
['X', 'OldExtendedHeader'], | ||
]), | ||
code: new Map([ | ||
['File', '0'], | ||
['OldFile', ''], | ||
['Link', '1'], | ||
['SymbolicLink', '2'], | ||
['CharacterDevice', '3'], | ||
['BlockDevice', '4'], | ||
['Directory', '5'], | ||
['FIFO', '6'], | ||
['ContiguousFile', '7'], | ||
['GlobalExtendedHeader', 'g'], | ||
['ExtendedHeader', 'x'], | ||
['SolarisACL', 'A'], | ||
['GNUDumpDir', 'D'], | ||
['Inode', 'I'], | ||
['NextFileHasLongLinkpath', 'K'], | ||
['NextFileHasLongPath', 'L'], | ||
['ContinuationFile', 'M'], | ||
['OldGnuLongPath', 'N'], | ||
['SparseFile', 'S'], | ||
['TapeVolumeHeader', 'V'], | ||
['OldExtendedHeader', 'X'], | ||
]), | ||
} | ||
}) | ||
t.match(tar.Pack.Sync, Function) | ||
t.match(tar.WriteEntry.Sync, Function) | ||
t.match(tar.WriteEntry.Tar, Function) | ||
t.match(tar.Pax.parse, Function) |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const t = require('tap') | ||
const map = require('../map.js') | ||
t.equal(map('test/index.js'), 'index.js') | ||
t.same(map('test/unpack.js'), ['lib/unpack.js', 'lib/mkdir.js']) | ||
t.same(map('test/load-all.js'), []) | ||
t.equal(map(__filename), 'map.js') | ||
t.equal(map('test/asdf'), 'lib/asdf') |
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
3f39282
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如何压缩文件夹不保留文件夹目录路径。