Sha256: 23a6de382b96ee35bff4c3a380574de47d956134e26a27ef43081b44de5769a2

Contents?: true

Size: 1.69 KB

Versions: 1

Compression:

Stored size: 1.69 KB

Contents

const { chdirTestApp, resetEnv } = require("../../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("../../../package/config")
      config.useContentHash = true
      const environmentConfig = require("../../../package/environments/development")

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

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

      expect(environmentConfig.output.filename).toBe("js/[name].js")
      expect(environmentConfig.output.chunkFilename).toBe("js/[name].chunk.js")
    })
  })

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

      expect(environmentConfig.output.filename).toBe("js/[name].js")
      expect(environmentConfig.output.chunkFilename).toBe("js/[name].chunk.js")
    })
  })
})

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shakapacker-8.0.1 test/package/environments/development.test.js