Sha256: e4ce8f4cbe9b2f35a90f675b5ad5176b5b9eac6dc43e6baadb806881387e1aae

Contents?: true

Size: 1.16 KB

Versions: 87

Compression:

Stored size: 1.16 KB

Contents

/* global test expect, describe */

const { chdirTestApp, chdirCwd } = require('../utils/helpers')

chdirTestApp()

describe('Env', () => {
  beforeEach(() => jest.resetModules())
  afterAll(chdirCwd)

  test('with NODE_ENV and RAILS_ENV set to development', () => {
    process.env.RAILS_ENV = 'development'
    process.env.NODE_ENV = 'development'
    expect(require('../env')).toEqual({
      railsEnv: 'development',
      nodeEnv: 'development'
    })
  })

  test('with undefined NODE_ENV and RAILS_ENV set to development', () => {
    process.env.RAILS_ENV = 'development'
    delete process.env.NODE_ENV
    expect(require('../env')).toEqual({
      railsEnv: 'development',
      nodeEnv: 'production'
    })
  })

  test('with undefined NODE_ENV and RAILS_ENV', () => {
    delete process.env.NODE_ENV
    delete process.env.RAILS_ENV
    expect(require('../env')).toEqual({
      railsEnv: 'production',
      nodeEnv: 'production'
    })
  })

  test('with a non-standard environment', () => {
    process.env.RAILS_ENV = 'staging'
    process.env.NODE_ENV = 'staging'
    expect(require('../env')).toEqual({
      railsEnv: 'staging',
      nodeEnv: 'production'
    })
  })
})

Version data entries

87 entries across 86 versions & 12 rubygems

Version Path
webpacker-4.0.4 package/__tests__/env.js
webpacker-4.0.3 package/__tests__/env.js
webpacker-4.0.2 package/__tests__/env.js
webpacker-3.6.0 package/__tests__/env.js
webpacker-4.0.1 package/__tests__/env.js
webpacker-4.0.0 package/__tests__/env.js
webpacker-4.0.0.rc.8 package/__tests__/env.js
webpacker-4.0.0.rc.7 package/__tests__/env.js
webpacker-4.0.0.rc.6 package/__tests__/env.js
webpacker-4.0.0.rc.5 package/__tests__/env.js
webpacker-4.0.0.rc.4 package/__tests__/env.js
webpacker-4.0.0.rc.3 package/__tests__/env.js
optimacms-0.4.3 spec/dummy/node_modules/@rails/webpacker/package/__tests__/env.js
optimacms-0.4.2 spec/dummy/node_modules/@rails/webpacker/package/__tests__/env.js
webpacker-4.0.0.rc.2 package/__tests__/env.js
webpacker-4.0.0.rc.1 package/__tests__/env.js
webpacker-4.0.0.pre.3 package/__tests__/env.js
webpacker-3.5.5 package/__tests__/env.js
webpacker-3.5.3 package/__tests__/env.js
webpacker-3.5.2 package/__tests__/env.js