Sha256: fd52c7a066b1a9343e8e32ea0e2c051bdeee7f5695ab9e57d5bd289e2e0dbe99

Contents?: true

Size: 1012 Bytes

Versions: 2

Compression:

Stored size: 1012 Bytes

Contents

const { resolve } = require("path")
const { chdirTestApp } = require("../helpers")

const rootPath = process.cwd()
chdirTestApp()

jest.mock("../../package/utils/helpers", () => {
  const original = jest.requireActual("../../package/utils/helpers")
  const moduleExists = () => false
  return {
    ...original,
    moduleExists
  }
})

describe("Test environment", () => {
  afterAll(() => process.chdir(rootPath))

  describe("generateWebpackConfig", () => {
    beforeEach(() => jest.resetModules())

    test("should use test config and production environment", () => {
      process.env.RAILS_ENV = "test"
      process.env.NODE_ENV = "test"

      const { generateWebpackConfig } = require("../../package/index")

      const webpackConfig = generateWebpackConfig()

      expect(webpackConfig.output.path).toStrictEqual(
        resolve("public", "packs-test")
      )
      expect(webpackConfig.output.publicPath).toBe("/packs-test/")
      expect(webpackConfig.devServer).toBeUndefined()
    })
  })
})

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shakapacker-8.1.0 test/package/test.test.js
shakapacker-8.0.2 test/package/test.test.js