Sha256: 49a321f4594eacca452d6b478fc4727ca969725f6f0649b8f4e5097927b2f4db

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

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

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

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

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

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

  describe('with config.useContentHash = false', () => {
    test('sets filename to use contentHash', () => {
      const config = require("../../config");
      config.useContentHash = false
      const environmnetConfig = require('../production')

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

  describe('with unset config.useContentHash', () => {
    test('sets filename to use contentHash', () => {
      const config = require("../../config");
      delete config.useContentHash
      const environmnetConfig = require('../production')

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shakapacker-7.0.0 package/environments/__tests__/production.js
shakapacker-7.0.0.rc.2 package/environments/__tests__/production.js