Sha256: dd2f781b159d199803c97419d72771fba18fa7e15e5286efd9f7ad81cd67459a

Contents?: true

Size: 1.51 KB

Versions: 14

Compression:

Stored size: 1.51 KB

Contents

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

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

const rootPath = process.cwd()
chdirTestApp()

describe('Custom environment', () => {
  afterAll(() => process.chdir(rootPath))

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

    test('should use staging config and default production environment', () => {
      process.env.RAILS_ENV = 'staging'
      delete process.env.NODE_ENV

      const { generateWebpackConfig } = require('../index')

      const webpackConfig = generateWebpackConfig()

      expect(webpackConfig.output.path).toEqual(
        resolve('public', 'packs-staging')
      )
      expect(webpackConfig.output.publicPath).toEqual('/packs-staging/')
      expect(webpackConfig).toMatchObject({
        devtool: 'source-map',
        stats: 'normal'
      })
    })
  })

  describe('globalMutableWebpackConfig', () => {
    beforeEach(() => jest.resetModules())

    test('should use staging config and default production environment', () => {
      process.env.RAILS_ENV = 'staging'
      delete process.env.NODE_ENV

      const { globalMutableWebpackConfig: webpackConfig } = require('../index')

      expect(webpackConfig.output.path).toEqual(
        resolve('public', 'packs-staging')
      )
      expect(webpackConfig.output.publicPath).toEqual('/packs-staging/')
      expect(webpackConfig).toMatchObject({
        devtool: 'source-map',
        stats: 'normal'
      })
    })
  })
})

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
shakapacker-7.2.3 package/__tests__/staging.js
shakapacker-7.3.0.beta.1 package/__tests__/staging.js
shakapacker-7.2.2 package/__tests__/staging.js
shakapacker-7.2.1 package/__tests__/staging.js
shakapacker-7.2.0 package/__tests__/staging.js
shakapacker-7.2.0.rc.0 package/__tests__/staging.js
shakapacker-7.1.0 package/__tests__/staging.js
shakapacker-7.0.3 package/__tests__/staging.js
shakapacker-7.0.2 package/__tests__/staging.js
shakapacker-7.0.1 package/__tests__/staging.js
shakapacker-7.0.0 package/__tests__/staging.js
shakapacker-7.0.0.rc.2 package/__tests__/staging.js
shakapacker-7.0.0.rc.1 package/__tests__/staging.js
shakapacker-7.0.0.rc.0 package/__tests__/staging.js