Sha256: 3130c5dfdf8653ae5ebfe3e0c731c1ed59c0c53b1c1445dd4cd14becb375ae73

Contents?: true

Size: 1.4 KB

Versions: 29

Compression:

Stored size: 1.4 KB

Contents

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

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

chdirTestApp()

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

  describe('toWebpackConfig', () => {
    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 = 'YES'
      const { environment } = require('../index')

      const config = environment.toWebpackConfig()
      expect(config.output.path).toEqual(resolve('public', 'packs'))
      expect(config.output.publicPath).toEqual('/packs/')
      expect(config).toMatchObject({
        devServer: {
          host: 'localhost',
          port: 3035
        }
      })
    })

    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 { environment } = require('../index')

      const config = environment.toWebpackConfig()
      expect(config.output.path).toEqual(resolve('public', 'packs'))
      expect(config.output.publicPath).toEqual('/packs/')
      expect(config.devServer).toEqual(undefined)
    })
  })
})

Version data entries

29 entries across 29 versions & 7 rubygems

Version Path
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/@rails/webpacker/package/__tests__/development.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/@rails/webpacker/package/__tests__/development.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/@rails/webpacker/package/__tests__/development.js
jetpacker-0.5.0 package/__tests__/development.js
tang-0.2.0 spec/tang_app/node_modules/@rails/webpacker/package/__tests__/development.js
tang-0.1.0 spec/tang_app/node_modules/@rails/webpacker/package/__tests__/development.js
tang-0.0.9 spec/tang_app/node_modules/@rails/webpacker/package/__tests__/development.js
webpacker-5.2.1 package/__tests__/development.js
webpacker-5.2.0 package/__tests__/development.js