Skip to content
Snippets Groups Projects
Select Git revision
1 result Searching

benchmark-performance.js

Blame
    • Pierre-Yves B's avatar
      097bf87e
      Make it easier to benchmark and profile the code (#4780) · 097bf87e
      Pierre-Yves B authored
      * Make it easier to benchmark and profile the code
      
      * Remove unnecessary escape
      
      * Clarify that the backend server is started without the frontend
      
      * Add missing NODE_CONFIG_ENV environment variable
      
      * Add error message when user has not included console.time statements
      
      * Fix lint issue
      
      * Handle multiple console.time statements
      
      * Switch NODE_CONFIG_ENV to test
      
      * Switch to const as variable never re-assigned
      097bf87e
      History
      Make it easier to benchmark and profile the code (#4780)
      Pierre-Yves B authored
      * Make it easier to benchmark and profile the code
      
      * Remove unnecessary escape
      
      * Clarify that the backend server is started without the frontend
      
      * Add missing NODE_CONFIG_ENV environment variable
      
      * Add error message when user has not included console.time statements
      
      * Fix lint issue
      
      * Handle multiple console.time statements
      
      * Switch NODE_CONFIG_ENV to test
      
      * Switch to const as variable never re-assigned
    commit.spec.js 1.51 KiB
    const { commitFilesToBranch } = require('../../../lib/workers/branch/commit');
    const defaultConfig = require('../../../lib/config/defaults').getConfig();
    
    /** @type any */
    const platform = global.platform;
    
    describe('workers/branch/automerge', () => {
      describe('commitFilesToBranch', () => {
        let config;
        beforeEach(() => {
          config = {
            ...defaultConfig,
            branchName: 'renovate/some-branch',
            commitMessage: 'some commit message',
            semanticCommits: false,
            semanticCommitType: 'a',
            semanticCommitScope: 'b',
            updatedPackageFiles: [],
            updatedArtifacts: [],
          };
          jest.resetAllMocks();
          platform.commitFilesToBranch.mockReturnValueOnce('created');
        });
        it('handles empty files', async () => {
          await commitFilesToBranch(config);
          expect(platform.commitFilesToBranch).toHaveBeenCalledTimes(0);
        });
        it('commits files', async () => {
          config.updatedPackageFiles.push({
            name: 'package.json',
            contents: 'some contents',
          });
          await commitFilesToBranch(config);
          expect(platform.commitFilesToBranch).toHaveBeenCalledTimes(1);
          expect(platform.commitFilesToBranch.mock.calls).toMatchSnapshot();
        });
        it('dry runs', async () => {
          config.dryRun = true;
          config.updatedPackageFiles.push({
            name: 'package.json',
            contents: 'some contents',
          });
          await commitFilesToBranch(config);
          expect(platform.commitFilesToBranch).toHaveBeenCalledTimes(0);
        });
      });
    });