Skip to content

Commit c1139e9

Browse files
Merge pull request #106 from conveyal/dev
3.2.0
2 parents c8f47d2 + 6adeb43 commit c1139e9

File tree

7 files changed

+56
-502
lines changed

7 files changed

+56
-502
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ Options:
165165
--no-cache Run Jest without cache (defaults to using cache)
166166
--coverage-paths <paths> Extra paths to collect code coverage from
167167
--setup-files <paths> Setup files to run before each test
168+
--test-environment <env> Jest test environment to use (Jest default is jsdom)
168169
--test-path-ignore-patterns <patterns> File patterns to ignore when scanning for test files
169170

170171
```

__tests__/lib/__snapshots__/test.js.snap

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Object {
2323
"setupFiles": Array [
2424
"beforeTestsSetup.js",
2525
],
26+
"testEnvironment": "node",
2627
"testPathIgnorePatterns": Array [
2728
"<rootDir>/node_modules/",
2829
"<rootDir>/__tests__/test-utils",

__tests__/lib/test.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ const testUtils = require('../../lib/test')
55
describe('test.js', () => {
66
it('generateTestConfig should generate proper config', () => {
77
const cfg = testUtils.generateTestConfig(['these', 'files', 'only'], {
8-
coveragePaths: 'bin src another-folder',
9-
updateSnapshots: true,
108
cache: false,
11-
setupFiles: 'beforeTestsSetup.js'
9+
coveragePaths: 'bin src another-folder',
10+
setupFiles: 'beforeTestsSetup.js',
11+
testEnvironment: 'node',
12+
updateSnapshots: true
1213
})
1314
expect(cfg).toBeTruthy()
1415
expect(cfg.length).toEqual(7)

bin/mastarm

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ commander
124124
.option('--no-cache', 'Run Jest without cache (defaults to using cache)')
125125
.option('--coverage-paths <paths>', 'Extra paths to collect code coverage from')
126126
.option('--setup-files <paths>', 'Setup files to run before each test')
127+
.option('--test-environment <env>', 'Jest test environment to use (Jest default is jsdom)')
127128
.option('--test-path-ignore-patterns <patterns>', 'File patterns to ignore when scanning for test files')
128129
.action(function (patterns, options) {
129130
const jest = require('jest')

lib/test.js

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ module.exports.generateTestConfig = (patterns, options) => {
1616
jestConfig.collectCoverageFrom = jestConfig.collectCoverageFrom.concat(options.coveragePaths.split(' '))
1717
}
1818

19+
if (options.testEnvironment) {
20+
jestConfig.testEnvironment = options.testEnvironment
21+
}
22+
1923
const stringArrayOverrides = [
2024
'setupFiles',
2125
'testPathIgnorePatterns'

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"mastarm": "bin/mastarm"
1111
},
1212
"scripts": {
13-
"cover": "bin/mastarm test --env test --coverage --coverage-paths bin",
13+
"cover": "bin/mastarm test --env test --test-environment node --coverage --coverage-paths bin",
1414
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
15-
"test": "bin/mastarm lint && bin/mastarm test --env test"
15+
"test": "bin/mastarm lint && bin/mastarm test --env test --test-environment node"
1616
},
1717
"repository": {
1818
"type": "git",
@@ -38,7 +38,7 @@
3838
"babel-plugin-add-module-exports": "^0.2.1",
3939
"babel-plugin-transform-flow-strip-types": "^6.18.0",
4040
"babel-plugin-transform-runtime": "^6.9.0",
41-
"babel-preset-env": "^0.0.9",
41+
"babel-preset-env": "^1.1.0",
4242
"babel-preset-react": "^6.5.0",
4343
"babel-preset-stage-2": "^6.17.0",
4444
"babelify": "^7.3.0",
@@ -62,7 +62,7 @@
6262
"postcss": "^5.0.21",
6363
"postcss-cssnext": "^2.6.0",
6464
"postcss-import": "^9.0.0",
65-
"postcss-reporter": "^2.0.0",
65+
"postcss-reporter": "^3.0.0",
6666
"postcss-safe-parser": "^2.0.0",
6767
"rimraf": "^2.5.4",
6868
"standard": "^8.3.0",

0 commit comments

Comments
 (0)