Repository: gatsbyjs/gatsby
File: packages/gatsby/src/utils/__tests__/webpack-utils.ts (TypeScript)

Code before:
          dependencies.exclude(
            `/Users/sidharthachatterjee/Code/gatsby-seo-test/node_modules/awesome-lib/index.js`
          )
        ).toEqual(false)
      })
      it(`excludes gatsby-browser.js`, () => {
        expect(
          dependencies.exclude(
            `/Users/sidharthachatterjee/Code/gatsby-seo-test/gatsby-browser.js`
          )
        ).toEqual(true)
      })
    })
  })
  describe(`postcss`, () => {
    it(`adds postcss rule`, () => {
      expect(config.loaders.postcss).toEqual(expect.any(Function))
    })
    describe(`uses defaults when no options are passed`, () => {
      let postcss
      beforeAll(() => {
        postcss = config.loaders.postcss()
      })
      it(`initialises autoprefixer with defaults`, () => {
        expect(postcss).toHaveProperty(`options`)
        expect(postcss.options).toHaveProperty(`plugins`)
        postcss.options.plugins(postcss.loader)
        expect(autoprefixer).toBeCalled()
        expect(autoprefixer).toBeCalledWith({
          flexbox: `no-2009`,
          overrideBrowserslist: [],
        })
      })
    })
    describe(`uses override options when they are passed`, () => {
      let postcss
      beforeAll(() => {
        jest.clearAllMocks()
        postcss = config.loaders.postcss({
          plugins: [
            autoprefixer({
              grid: `no-autoplace`,
            }),
          ],
        })
      })
      it(`initialises autoprefixer with overrides`, () => {
        expect(postcss).toHaveProperty(`options`)
        expect(postcss.options).toHaveProperty(`plugins`)
        postcss.options.plugins(postcss.loader)
        expect(autoprefixer).toBeCalled()

Review comment (bug):
We don't really need to test this part as we'll fail on line 190 anyway.
```suggestion
```

Code after:
          dependencies.exclude(
            `/Users/sidharthachatterjee/Code/gatsby-seo-test/node_modules/awesome-lib/index.js`
          )
        ).toEqual(false)
      })
      it(`excludes gatsby-browser.js`, () => {
        expect(
          dependencies.exclude(
            `/Users/sidharthachatterjee/Code/gatsby-seo-test/gatsby-browser.js`
          )
        ).toEqual(true)
      })
    })
  })
  describe(`postcss`, () => {
    it(`adds postcss rule`, () => {
      expect(config.loaders.postcss).toEqual(expect.any(Function))
    })
    describe(`uses defaults when no options are passed`, () => {
      let postcss
      beforeAll(() => {
        postcss = config.loaders.postcss()
      })
      it(`initialises autoprefixer with defaults`, () => {
        postcss.options.plugins(postcss.loader)
        expect(autoprefixer).toBeCalled()
        expect(autoprefixer).toBeCalledWith({
          flexbox: `no-2009`,
          overrideBrowserslist: [],
        })
      })
    })
    describe(`uses override options when they are passed`, () => {
      let postcss
      beforeAll(() => {
        jest.clearAllMocks()
        postcss = config.loaders.postcss({
          plugins: [
            autoprefixer({
              grid: `no-autoplace`,
            }),
          ],
        })
      })
      it(`initialises autoprefixer with overrides`, () => {
        postcss.options.plugins(postcss.loader)
        expect(autoprefixer).toBeCalled()
        expect(autoprefixer).toBeCalledWith({
          flexbox: `no-2009`,
          grid: `no-autoplace`,
          overrideBrowserslist: [],