Skip to content

Commit

Permalink
Replace one-double-zero with one-double-zero-core
Browse files Browse the repository at this point in the history
one-double-zero-core embarks its own lightweight parser, instead of
depending on the gigantic TypeScript package.
  • Loading branch information
ericmorand committed Jan 22, 2025
1 parent cf49e94 commit 92a2ac1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/jest-reporters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"jest-message-util": "workspace:*",
"jest-util": "workspace:*",
"jest-worker": "workspace:*",
"one-double-zero": "1.0.0-beta.14",
"one-double-zero-core": "^1.0.0-alpha.0",
"slash": "^3.0.0",
"string-length": "^4.0.1",
"strip-ansi": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-reporters/src/CoverageReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
type ProcessCoverage,
type SourceMap,
createOneDoubleZero,
} from 'one-double-zero';
} from 'one-double-zero-core';
import v8toIstanbul = require('v8-to-istanbul');
import type {
AggregatedResult,
Expand Down
20 changes: 20 additions & 0 deletions packages/jest-reporters/src/__tests__/CoverageReporter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,4 +448,24 @@ describe('onRunComplete', () => {
expect(testReporter.getLastError()).toBeUndefined();
});
});

test('that it supports odz coverage provider', () => {
const testReporter = new CoverageReporter(

Check failure on line 453 in packages/jest-reporters/src/__tests__/CoverageReporter.test.js

View workflow job for this annotation

GitHub Actions / Lint

Delete `⏎······`
{
collectCoverage: true,

Check failure on line 455 in packages/jest-reporters/src/__tests__/CoverageReporter.test.js

View workflow job for this annotation

GitHub Actions / Lint

Delete `··`
coverageProvider: 'odz',

Check failure on line 456 in packages/jest-reporters/src/__tests__/CoverageReporter.test.js

View workflow job for this annotation

GitHub Actions / Lint

Delete `··`
coverageThreshold: {

Check failure on line 457 in packages/jest-reporters/src/__tests__/CoverageReporter.test.js

View workflow job for this annotation

GitHub Actions / Lint

Delete `··`
global: {

Check failure on line 458 in packages/jest-reporters/src/__tests__/CoverageReporter.test.js

View workflow job for this annotation

GitHub Actions / Lint

Replace `··········` with `········`
statements: 100,

Check failure on line 459 in packages/jest-reporters/src/__tests__/CoverageReporter.test.js

View workflow job for this annotation

GitHub Actions / Lint

Delete `··`
},

Check failure on line 460 in packages/jest-reporters/src/__tests__/CoverageReporter.test.js

View workflow job for this annotation

GitHub Actions / Lint

Delete `··`
},

Check failure on line 461 in packages/jest-reporters/src/__tests__/CoverageReporter.test.js

View workflow job for this annotation

GitHub Actions / Lint

Delete `··`
}

Check failure on line 462 in packages/jest-reporters/src/__tests__/CoverageReporter.test.js

View workflow job for this annotation

GitHub Actions / Lint

Replace `··}⏎····` with `}`
);
testReporter.log = jest.fn();
return testReporter
.onRunComplete(new Set(), {}, mockAggResults)
.then(() => {
expect(testReporter.getLastError().message.split('\n')).toHaveLength(1);
});
});
});
13 changes: 12 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3862,6 +3862,7 @@ __metadata:
jest-worker: "workspace:*"
mock-fs: ^5.1.2
node-notifier: ^10.0.0
one-double-zero-core: ^1.0.0-alpha.0
slash: ^3.0.0
string-length: ^4.0.1
strip-ansi: ^6.0.0
Expand Down Expand Up @@ -13389,7 +13390,7 @@ __metadata:
languageName: node
linkType: hard

"istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.0":
"istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.0, istanbul-lib-coverage@npm:^3.2.2":
version: 3.2.2
resolution: "istanbul-lib-coverage@npm:3.2.2"
checksum: 2367407a8d13982d8f7a859a35e7f8dd5d8f75aae4bb5484ede3a9ea1b426dc245aff28b976a2af48ee759fdd9be374ce2bd2669b644f31e76c5f46a2e29a831
Expand Down Expand Up @@ -17007,6 +17008,16 @@ __metadata:
languageName: node
linkType: hard

"one-double-zero-core@npm:^1.0.0-alpha.0":
version: 1.0.0-alpha.0
resolution: "one-double-zero-core@npm:1.0.0-alpha.0"
dependencies:
"@jridgewell/trace-mapping": ^0.3.25
istanbul-lib-coverage: ^3.2.2
checksum: 0831ba26ede8b95a697bd09f79b270a2eede2d2317830c5c11a5b714c8211081f5f30a7e3f863e4bb4de6755e4b47305828865f8e7a0fde0e18a4a87b74f9576
languageName: node
linkType: hard

"onetime@npm:^5.1.2":
version: 5.1.2
resolution: "onetime@npm:5.1.2"
Expand Down

0 comments on commit 92a2ac1

Please sign in to comment.