1

I have a GitHub action that is running on node. My node js file looks like this:

import fs from 'fs';
import * as core from '@actions/core';
import * as github from '@actions/github';
import { Octokit } from '@octokit/rest';

async function runAction() {

  const comments = await octokit.paginate(octokit.rest.issues.listComments, {
    1,
    "my_repo",
    1,
    per_page: 100,
  });
console.log(comments)
}

I'm trying to test this code - however I cannot seem to find a way of mocking @actions/github's listComments function.

Does anyone have any advice?

Azeem
  • 11,148
  • 4
  • 27
  • 40
Nespony
  • 1,253
  • 4
  • 24
  • 42
  • Hi @Azeem. Seems like your code is importing `@actions/github` but it is not used in any of the lines. I guess you are omitting part of the code where you obtain octokit from `@actions/github`. Could you share the complete snippet of code so the community can help you better? – OscarDOM Jul 27 '23 at 20:46
  • 1
    Hi @OscarDOM, I believe your comment was for the OP and not me. :) – Azeem Jul 28 '23 at 05:35
  • Oh sorry, I meant to tag the author of the question: @Nespony – OscarDOM Jul 28 '23 at 12:49

0 Answers0