Skip to content

Commit 703ad0b

Browse files
committed
fix: node 6 unhappy again...
1 parent 777edf5 commit 703ad0b

5 files changed

Lines changed: 26 additions & 34 deletions

File tree

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
module.exports = {
22
env: {
33
node: true,
4-
es6: true,
54
},
65
extends: 'eslint:recommended',
76
parserOptions: {
8-
ecmaVersion: 6,
7+
ecmaVersion: 5,
98
sourceType: 'module',
109
impliedStrict: true,
1110
},
1211
rules: {
12+
'no-console': ['error', { allow: ['warn', 'error', 'log'] }],
1313
indent: ['error', 2],
1414
'linebreak-style': ['error', 'unix'],
1515
quotes: ['error', 'single'],

preprocessor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
console.warn(
22
'ts-jest',
33
'[deprecated]',
4-
`Replace any occurrences of "ts-jest/dist/preprocessor.js" or ` +
5-
` "<rootDir>/node_modules/ts-jest/preprocessor.js"` +
6-
` in the 'transform' section of your Jest config with just "ts-jest".`,
4+
'Replace any occurrences of "ts-jest/dist/preprocessor.js" or ' +
5+
' "<rootDir>/node_modules/ts-jest/preprocessor.js"' +
6+
' in the \'transform\' section of your Jest config with just "ts-jest".'
77
)
88

99
module.exports = require('./dist')

scripts/e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function setupE2e() {
110110
}
111111

112112
if (!packagesOk) {
113-
if (npm.can.ci) {
113+
if (npm.can.ci()) {
114114
log(` [template: ${name}]`, 'installing packages using "npm ci"')
115115
spawnSync('npm', ['ci'], { cwd: dir })
116116
} else {

scripts/lib/bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { join } = require('path')
77
// Except that on npm < 4.0.0 the prepare doesn't exists
88

99
module.exports = function createBundle() {
10-
if (!npm.can.prepare) {
10+
if (!npm.can.prepare()) {
1111
logger.log('building ts-jest')
1212
npm.spawnSync(['-s', 'run', 'build'], { cwd: rootDir })
1313
}

scripts/lib/npm.js

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
1-
const { sync: spawnSync } = require('cross-spawn')
1+
const spawn = require('cross-spawn')
22
const { satisfies } = require('semver')
33
const memoize = require('lodash.memoize')
44

5-
const self = {}
6-
7-
Object.defineProperties(self, {
8-
version: {
9-
get: memoize(() =>
10-
self
11-
.spawnSync(['-s', '--version'])
12-
.stdout.toString()
13-
.trim(),
14-
),
15-
},
16-
spawnSync: {
17-
value(args, options = {}) {
18-
return spawnSync('npm', args, options)
19-
},
20-
},
21-
can: {
22-
value: Object.defineProperties(
23-
{},
24-
{
25-
ci: { get: memoize(() => satisfies(self.version, '>=5.7.0')) },
26-
prepare: { get: memoize(() => satisfies(self.version, '>=5.7.0')) },
27-
},
28-
),
29-
},
5+
const version = memoize(() => {
6+
return spawnSync(['-s', '--version'])
7+
.stdout.toString()
8+
.trim()
309
})
3110

32-
module.exports = self
11+
const spawnSync = (args, options = {}) => {
12+
return spawn.sync('npm', args, options)
13+
}
14+
15+
const can = {
16+
ci: memoize(() => satisfies(version(), '>=5.7.0')),
17+
prepare: memoize(() => satisfies(version(), '>=5.7.0')),
18+
}
19+
20+
module.exports = {
21+
version,
22+
spawnSync,
23+
can,
24+
}

0 commit comments

Comments
 (0)