Sha256: 1428c85408795682daf26f961a80dc2d48d7089488258c918ea0e4ec994ea510

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

/* test expect, describe, afterAll, beforeEach */

const { resolve } = require('path')
const { chdirTestApp, chdirCwd } = require('../utils/helpers')

chdirTestApp()

describe('Development environment', () => {
  afterAll(chdirCwd)

  describe('webpackConfig', () => {
    beforeEach(() => jest.resetModules())

    test('should use development config and environment including devServer if WEBPACK_DEV_SERVER', () => {
      process.env.RAILS_ENV = 'development'
      process.env.NODE_ENV = 'development'
      process.env.WEBPACK_DEV_SERVER = 'true'
      const { webpackConfig } = require('../index')

      expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
      expect(webpackConfig.output.publicPath).toEqual('/packs/')
      expect(webpackConfig).toMatchObject({
        devServer: {
          host: 'localhost',
          port: 3035,
          hot: false
        }
      })
    })

    test('should use development config and environment if WEBPACK_DEV_SERVER', () => {
      process.env.RAILS_ENV = 'development'
      process.env.NODE_ENV = 'development'
      process.env.WEBPACK_DEV_SERVER = undefined
      const { webpackConfig } = require('../index')

      expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
      expect(webpackConfig.output.publicPath).toEqual('/packs/')
      expect(webpackConfig.devServer).toEqual(undefined)
    })
  })
})

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webpacker-6.0.0.rc.4 package/__tests__/development.js
webpacker-6.0.0.rc.3 package/__tests__/development.js