Sha256: dbe2567d237066950f3f6f41a3ac61b79f0f04da9d957c841725522137413b0d

Contents?: true

Size: 1.67 KB

Versions: 8

Compression:

Stored size: 1.67 KB

Contents

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

const { chdirTestApp, resetEnv } = require('../../utils/helpers')
const rootPath = process.cwd()
chdirTestApp()

describe('Development specific config', () => {
  beforeEach(() => {
    jest.resetModules()
    resetEnv()
    process.env['NODE_ENV'] = 'development'
  })
  afterAll(() => process.chdir(rootPath))

  describe('with config.useContentHash = true', () => {
    test('sets filename to use contentHash', () => {
      const config = require("../../config");
      config.useContentHash = true
      const environmentConfig = require('../development')

      expect(environmentConfig.output.filename).toEqual('js/[name]-[contenthash].js')
      expect(environmentConfig.output.chunkFilename).toEqual(
        'js/[name]-[contenthash].chunk.js'
      )
    })
  })

  describe('with config.useContentHash = false', () => {
    test('sets filename without using contentHash', () => {
      const config = require("../../config");
      config.useContentHash = false
      const environmentConfig = require('../development')

      expect(environmentConfig.output.filename).toEqual('js/[name].js')
      expect(environmentConfig.output.chunkFilename).toEqual(
        'js/[name].chunk.js'
      )
    })
  })

  describe('with unset config.useContentHash', () => {
    test('sets filename without using contentHash', () => {
      const config = require("../../config");
      delete config.useContentHash
      const environmentConfig = require('../development')

      expect(environmentConfig.output.filename).toEqual('js/[name].js')
      expect(environmentConfig.output.chunkFilename).toEqual(
        'js/[name].chunk.js'
      )
    })
  })
})

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shakapacker-7.2.3 package/environments/__tests__/development.js
shakapacker-7.3.0.beta.1 package/environments/__tests__/development.js
shakapacker-7.2.2 package/environments/__tests__/development.js
shakapacker-7.2.1 package/environments/__tests__/development.js
shakapacker-7.2.0 package/environments/__tests__/development.js
shakapacker-7.2.0.rc.0 package/environments/__tests__/development.js
shakapacker-7.1.0 package/environments/__tests__/development.js
shakapacker-7.0.3 package/environments/__tests__/development.js