0
gitlab 테스트 파이프 라인의 모든 테스트에서이 오류가 발생하지만 로컬에서 모든 테스트가 통과합니다. 어쩌면 일부 환경 변수가 누락되었거나 Enzyme.configure ({adapter : new Adapter()})와 관련이 있습니까?반응 테스트 렌더러 얕은 렌더러를 프로덕션 모드에서 사용할 수 없습니다.
NPM 작업 :
"test": "node scripts/test.js --env=jsdom"
스크립트/test.js :
'use strict'
const jest = require('jest')
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', (err) => {
throw err
})
const argv = process.argv.slice(2)
// Watch unless on CI or in coverage mode
if (!process.env.CI && argv.indexOf('--coverage') < 0) {
argv.push('--watch')
}
jest.run(argv)
Gitlab 콘솔 오류 :
$ node scripts/test.js --env=jsdom
FAIL src/components/ui/Grid/__tests__/Grid.spec.jsx
● Test suite failed to run
shallow renderer is not available in production mode.
at Error (native)
at Object.<anonymous> (node_modules/react-test-renderer/shallow.js:4:9)
at Object.<anonymous> (node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:21:16)
at Object.<anonymous> (node_modules/enzyme-adapter-react-16/build/index.js:2:18)
at Object.<anonymous> (src/components/ui/Grid/__tests__/Grid.spec.jsx:3:27)
Grid.spec.jsx :
import React from 'react'
import Enzyme, { shallow } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import Grid from '../index'
const { Row, Column } = Grid
Enzyme.configure({ adapter: new Adapter() })
describe('Grid',() => {
it('should have a Row and a Column',() => {
expect(Grid.Row).toBeDefined()
expect(Grid.Column).toBeDefined()
})
})