Skip to content

Commit

Permalink
fix(middleware-code-coverage): fix tests fo node 20
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Sep 8, 2023
1 parent 6cc892c commit 11c5ba6
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ formatMessage(message) {

test.beforeEach(async (t) => {
t.context.sinon = sinonGlobal.createSandbox();

t.context.libReport = await esmock("istanbul-lib-report");
t.context.coverageReporter = await esmock("../../../lib/coverage-reporter.js", {
"istanbul-lib-report": t.context.libReport
});
t.context.coverageReporter = await esmock("../../../lib/coverage-reporter.js");
});

test.afterEach.always((t) => {
Expand Down Expand Up @@ -193,7 +189,11 @@ test("Report Coverage: Log warning if resource can not be found", async (t) => {
});

test("Report Coverage: Fronted config for watermarks", async (t) => {
const {sinon, coverageReporter, libReport} = t.context;
const {sinon} = t.context;
const libReport = await esmock("istanbul-lib-report");
const coverageReporter = await esmock("../../../lib/coverage-reporter.js", {
"istanbul-lib-report": libReport
});
const reportSpy = sinon.spy(libReport, "createContext");

const modifiedWatermarks = {
Expand Down Expand Up @@ -222,7 +222,11 @@ test("Report Coverage: Fronted config for watermarks", async (t) => {
});

test("Report Coverage: Fronted config for watermarks- overwrite just some properties", async (t) => {
const {sinon, coverageReporter, libReport} = t.context;
const {sinon} = t.context;
const libReport = await esmock("istanbul-lib-report");
const coverageReporter = await esmock("../../../lib/coverage-reporter.js", {
"istanbul-lib-report": libReport
});
const reportSpy = sinon.spy(libReport, "createContext");

const config = await createInstrumentationConfig();
Expand Down

0 comments on commit 11c5ba6

Please sign in to comment.