Skip to content

Commit

Permalink
fix init
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Sep 2, 2024
1 parent 26889e3 commit e53057c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,12 @@ class MonocartReporter {
this.tickTime = this.options.tickTime || 1000;
this.tickStart();

this.trends = [];
this.initTrendsAndDir();

const stateOptions = this.options.state;
if (stateOptions) {
this.bindFunctions(stateOptions);
this.stateServer = createStateServer(stateOptions);
}
this.init();
}

async initTrendsAndDir() {
async init() {

const cwd = Util.formatPath(process.cwd());
this.options.cwd = cwd;
this.options.cwd = Util.formatPath(process.cwd());

// read trends from json before clean dir
this.trends = await getTrends(this.options.trend);
Expand All @@ -87,6 +79,12 @@ class MonocartReporter {
if (this.options.copyAttachments) {
this.options.attachmentsDir = path.resolve(outputDir, 'attachments');
}

const stateOptions = this.options.state;
if (stateOptions) {
this.bindFunctions(stateOptions);
this.stateServer = createStateServer(stateOptions);
}
}

// ==========================================================================
Expand Down
2 changes: 1 addition & 1 deletion tests/home-page/home-page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test('secrets and sensitive data', async ({ page }, testInfo) => {
});

const context = await request.newContext();
await context.get(`https://api.npmjs.org/?token=${process.env.TOKEN}`);
await context.get(`http://localhost:8090/?token=${process.env.TOKEN}`);

});

Expand Down

0 comments on commit e53057c

Please sign in to comment.