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
jetpacker-0.4.1 package/__tests__/env.js
jetpacker-0.4.0 package/__tests__/env.js
jetpacker-0.3.0 package/__tests__/env.js
jetpacker-0.2.0 package/__tests__/env.js
webpacker-4.2.2 package/__tests__/env.js
webpacker-4.2.1 package/__tests__/env.js
webpacker-4.2.0 package/__tests__/env.js
webpacker-4.1.0 package/__tests__/env.js
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/webpacker-4.0.7/package/__tests__/env.js
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/webpacker-4.0.7/package/__tests__/env.js
jester-data-8.0.0 node_modules/@rails/webpacker/package/__tests__/env.js
ezii-os-5.2.1 node_modules/@rails/webpacker/package/__tests__/env.js
ezii-os-2.0.1 node_modules/@rails/webpacker/package/__tests__/env.js
ezii-os-1.1.0 node_modules/@rails/webpacker/package/__tests__/env.js
ezii-os-1.0.0 node_modules/@rails/webpacker/package/__tests__/env.js
ezii-os-0.0.0.1.0 node_modules/@rails/webpacker/package/__tests__/env.js
ezii-os-0.0.0.0.1 node_modules/@rails/webpacker/package/__tests__/env.js
webpacker-4.0.7 package/__tests__/env.js
webpacker-4.0.6 package/__tests__/env.js
webpacker-4.0.5 package/__tests__/env.js