Skip to content

Commit 0d49e60

Browse files
authored
Merge pull request #113 from conveyal/dev
Merge dev into master
2 parents 184e667 + 2755eec commit 0d49e60

File tree

9 files changed

+234
-204
lines changed

9 files changed

+234
-204
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ Options:
162162
-h, --help output usage information
163163
-u, --update-snapshots Force update of snapshots. USE WITH CAUTION.
164164
--coverage Run Jest with coverage reporting
165-
--no-cache Run Jest without cache (defaults to using cache)
166165
--coverage-paths <paths> Extra paths to collect code coverage from
166+
--no-cache Run Jest without cache (defaults to using cache)
167+
--run-in-band Run all tests serially in the current process
167168
--setup-files <paths> Setup files to run before each test
168169
--test-environment <env> Jest test environment to use (Jest default is jsdom)
169170
--test-path-ignore-patterns <patterns> File patterns to ignore when scanning for test files

__tests__/lib/__snapshots__/test.js.snap __tests__/lib/__snapshots__/jest.js.snap

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ exports[`test.js generateTestConfig should generate proper config 1`] = `
22
Array [
33
"-u",
44
"--no-cache",
5+
"-i",
56
"--config",
67
"these",
78
"files",
File renamed without changes.

__tests__/lib/test.js __tests__/lib/jest.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
/* globals describe, it, expect */
22

3-
const testUtils = require('../../lib/test')
3+
const jestUtils = require('../../lib/jest')
44

55
describe('test.js', () => {
66
it('generateTestConfig should generate proper config', () => {
7-
const cfg = testUtils.generateTestConfig(['these', 'files', 'only'], {
7+
const cfg = jestUtils.generateTestConfig(['these', 'files', 'only'], {
88
cache: false,
99
coveragePaths: 'bin src another-folder',
10+
runInBand: true,
1011
setupFiles: 'beforeTestsSetup.js',
1112
testEnvironment: 'node',
1213
updateSnapshots: true
1314
})
1415
expect(cfg).toBeTruthy()
15-
expect(cfg.length).toEqual(7)
16-
const jestCfg = JSON.parse(cfg.splice(3, 1))
16+
expect(cfg.length).toEqual(8)
17+
const jestCfg = JSON.parse(cfg.splice(4, 1))
1718
expect(cfg).toMatchSnapshot()
1819
expect(jestCfg.transform['.*']).toContain('lib/jest-preprocessor.js')
1920
delete jestCfg.transform

lib/__tests__/push-to-s3.js __tests__/lib/push-to-s3.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const BUILD_DIR = '__tests__/test-utils/tmp'
44
const MOCK_DIR = '__tests__/test-utils/mocks'
55

66
describe('lib > push to s3', () => {
7-
const configPush = require('../push-to-s3')
8-
const loadConfig = require('../load-config')
7+
const configPush = require('../../lib/push-to-s3')
8+
const loadConfig = require('../../lib/load-config')
99

1010
it('should compile JavaScript and CSS and send to s3 via aws-sdk', () => {
1111
const config = loadConfig(process.cwd(), '~/mastarm/configurations/default', 'test')

bin/mastarm

+4-3
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,19 @@ commander
121121
.description('Run tests using Jest')
122122
.option('-u, --update-snapshots', 'Force update of snapshots. USE WITH CAUTION.')
123123
.option('--coverage', 'Run Jest with coverage reporting')
124-
.option('--no-cache', 'Run Jest without cache (defaults to using cache)')
125124
.option('--coverage-paths <paths>', 'Extra paths to collect code coverage from')
125+
.option('--no-cache', 'Run Jest without cache (defaults to using cache)')
126+
.option('--run-in-band', 'Run all tests serially in the current process')
126127
.option('--setup-files <paths>', 'Setup files to run before each test')
127128
.option('--test-environment <env>', 'Jest test environment to use (Jest default is jsdom)')
128129
.option('--test-path-ignore-patterns <patterns>', 'File patterns to ignore when scanning for test files')
129130
.action(function (patterns, options) {
130131
const jest = require('jest')
131132
const config = loadConfig(process.cwd(), commander.config, commander.env)
132133
const get = util.makeGetFn([options, commander, config.settings])
133-
const testUtils = require('../lib/test')
134+
const jestUtils = require('../lib/jest')
134135
util.configureEnvironment({config, env: get('env')})
135-
jest.run(testUtils.generateTestConfig(patterns, options))
136+
jest.run(jestUtils.generateTestConfig(patterns, options))
136137
})
137138

138139
commander.parse(process.argv)

lib/test.js lib/jest.js

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ module.exports.generateTestConfig = (patterns, options) => {
4141
jestArguments.push('--no-cache')
4242
}
4343

44+
if (options.runInBand || process.env.CI) {
45+
jestArguments.push('-i')
46+
}
47+
4448
jestArguments.push('--config', JSON.stringify(jestConfig))
4549

4650
if (patterns) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"exorcist": "^0.4.0",
5656
"http-proxy": "^1.14.0",
5757
"isomorphic-fetch": "^2.2.1",
58-
"jest": "^17.0.3",
58+
"jest": "^18.1.0",
5959
"lodash.uniq": "^4.5.0",
6060
"mime": "^1.3.4",
6161
"mkdirp": "^0.5.1",

0 commit comments

Comments
 (0)