Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have the build be able to output / provide a copy of the graph #327

Closed
1 of 5 tasks
hutchgrant opened this issue Apr 16, 2020 · 3 comments
Closed
1 of 5 tasks

have the build be able to output / provide a copy of the graph #327

hutchgrant opened this issue Apr 16, 2020 · 3 comments
Labels
chore unit testing, maintenance, etc feature New feature or request

Comments

@hutchgrant
Copy link
Member

Type of Change

  • New Feature Request
  • Documentation / Website
  • Improvement / Suggestion
  • Bug
  • Other (please clarify below)

Summary

We use a mock of our graph to run a large number of unit tests. Everytime we change the graph, our mock graph must reflect those changes or we're testing outdated data. I propose a toggleable function which can be run within graph lifecycle to automatically export a mock of the graph

Details

const generateMockGraph = async (graph, debug) => {
  if (debug) {
    const targetDir = path.join(__dirname, '../..', 'test/unit/data/mocks');
    const targetFile = path.join(targetDir, 'graph.js');
    const mockGraph = 'module.exports = { \n'
    + '  // eslint-disable-next-line \n graph: '
      + JSON.stringify(graph)
      + '\n};';

    await fs.writeFile(path.join(targetFile), mockGraph, 'utf8');
  }

};
@thescientist13
Copy link
Member

Gonna tweak the title of this, as I would like to leave open to different options of how to approach this.

@thescientist13 thescientist13 changed the title Add toggleable functionality to build a mock graph for unit tests have the build be able to output / provide a copy of the graph Apr 16, 2020
@thescientist13 thescientist13 added the chore unit testing, maintenance, etc label Apr 16, 2020
@thescientist13
Copy link
Member

thescientist13 commented Apr 18, 2020

I think this issue would be great if implemented after #199 in which we establish modes with escalating levels of output / toggling.

Would also need this documented, at least in the CONTRIBUTING.md.

@thescientist13 thescientist13 added the enhancement Improve something existing (e.g. no docs, new APIs, etc) label Apr 18, 2020
@thescientist13
Copy link
Member

I think actually happens now as of the 0.10.0 release? Correct me I am wrong but we do emit a graph.json now, which I believe did not exist before.

@thescientist13 thescientist13 added feature New feature or request and removed enhancement Improve something existing (e.g. no docs, new APIs, etc) labels Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore unit testing, maintenance, etc feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants