Skip to content

Commit

Permalink
Eliminate the need to import specHelper everywhere
Browse files Browse the repository at this point in the history
While the [issue I opened on
mocha-webpack](zinserjan/mocha-webpack#1) is
still outstanding, the author’s suggestion is to use
`webpack-node-externals`.  We tried that initially, but that results in
numerous firings of the `import/no-unresolved` lint rule.

After conferring with @lexun, we decided to go back to that approach
and instead disable the linters when doing `npm run test`.  They still
run with `npm run build`, `npm run test:debug`, and `npm run dev`.

If the above-mentioned issue gets resolved, then we can go back to
running the linters in all environments.
  • Loading branch information
randycoulman committed Mar 28, 2016
1 parent a8fe227 commit cc432f1
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions client/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import './specHelper'

const context = require.context('..', true, /.+-spec\.js$/)

context.keys().forEach(context)
Expand Down
1 change: 0 additions & 1 deletion client/components/layout/Block/__tests__/Block-spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import '__tests__/specHelper'
import React from 'react'
import expectReactShallow from 'expect-react-shallow'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import '__tests__/specHelper'
import React from 'react'
import expectReactShallow from 'expect-react-shallow'

Expand Down
1 change: 0 additions & 1 deletion client/components/layout/Content/__tests__/Content-spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import '__tests__/specHelper'
import React from 'react'
import expectReactShallow from 'expect-react-shallow'

Expand Down
1 change: 0 additions & 1 deletion client/components/layout/Frame/__tests__/Frame-spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import '__tests__/specHelper'
import React from 'react'
import expectReactShallow from 'expect-react-shallow'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import '__tests__/specHelper'
import React from 'react'
import expectReactShallow from 'expect-react-shallow'
import { expect } from 'chai'
Expand Down
1 change: 0 additions & 1 deletion client/utils/__tests__/api-spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable camelcase */
import '__tests__/specHelper'
import { expect } from 'chai'
import { prop } from 'ramda'
import sinon from 'sinon'
Expand Down
1 change: 0 additions & 1 deletion client/utils/__tests__/form-spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import '__tests__/specHelper'
import { expect } from 'chai'
import sinon from 'sinon'

Expand Down
1 change: 1 addition & 0 deletions mocha-webpack.opts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
--colors
--require client/__tests__/specHelper.js
--reporter spec
--webpack-config webpack.config.js
client/**/*-spec.js
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"url-loader": "^0.5.7",
"webpack": "^1.12.9",
"webpack-dev-server": "1.14.0",
"webpack-node-externals": "^1.0.0",
"whatwg-fetch": "^0.11.0"
},
"babel": {
Expand Down
6 changes: 6 additions & 0 deletions webpack/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const config = require('./base')
const nodeExternals = require('webpack-node-externals')

config.module.loaders.push({
test: /\.scss$/,
Expand All @@ -9,6 +10,11 @@ config.module.loaders.push({
]
})

// Don't run linters in this environment.
// We get a number of false positives due to the handling of node externals.
config.module.preLoaders = []

config.externals = [nodeExternals()]
config.target = 'node'

module.exports = config

0 comments on commit cc432f1

Please sign in to comment.