chore: verify all packages have the same engine requirement (#9871)

This commit is contained in:
Simen Bekkhus 2020-04-23 20:19:29 +02:00 committed by GitHub
parent bc1c6841f5
commit 1c2011dbce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 143 additions and 129 deletions

View File

@ -132,7 +132,7 @@ module.exports = {
'**/__mocks__/**',
'**/?(*.)(spec|test).js?(x)',
'scripts/**',
'eslintImportResolver.js',
'babel.config.js',
'testSetupFile.js',
],
},

View File

@ -5,6 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/
const semver = require('semver');
const pkg = require('./package.json');
const supportedNodeVersion = semver.minVersion(pkg.engines.node).version;
module.exports = {
babelrcRoots: ['examples/*'],
// we don't wanna run the transforms in this file over react native
@ -15,7 +20,7 @@ module.exports = {
'babel-plugin-typescript-strip-namespaces',
'babel-plugin-replace-ts-export-assignment',
require.resolve(
'./scripts/babel-plugin-jest-replace-ts-require-assignment.js'
'./scripts/babel-plugin-jest-replace-ts-require-assignment.js',
),
],
presets: ['@babel/preset-typescript'],
@ -31,7 +36,7 @@ module.exports = {
{
exclude: ['@babel/plugin-proposal-dynamic-import'],
shippedProposals: true,
targets: {node: '8.3'},
targets: {node: supportedNodeVersion},
},
],
],
@ -48,7 +53,7 @@ module.exports = {
'@babel/preset-env',
{
shippedProposals: true,
targets: {node: '8.3'},
targets: {node: supportedNodeVersion},
},
],
],

View File

@ -205,7 +205,7 @@ FAIL __tests__/failure.test.js
28 | ({left, right}) => {
> 29 | expect(left).toBe(right);
| ^
30 | }
30 | },
31 | );
32 |
@ -222,7 +222,7 @@ FAIL __tests__/failure.test.js
39 | ({left, right}) => {
> 40 | expect(left).toBe(right);
| ^
41 | }
41 | },
42 | );
43 |
@ -239,7 +239,7 @@ FAIL __tests__/failure.test.js
39 | ({left, right}) => {
> 40 | expect(left).toBe(right);
| ^
41 | }
41 | },
42 | );
43 |
@ -256,7 +256,7 @@ FAIL __tests__/failure.test.js
46 | word => {
> 47 | expect(/z/.test(word)).toBe(true);
| ^
48 | }
48 | },
49 | );
50 |
@ -273,7 +273,7 @@ FAIL __tests__/failure.test.js
46 | word => {
> 47 | expect(/z/.test(word)).toBe(true);
| ^
48 | }
48 | },
49 | );
50 |
@ -290,7 +290,7 @@ FAIL __tests__/failure.test.js
46 | word => {
> 47 | expect(/z/.test(word)).toBe(true);
| ^
48 | }
48 | },
49 | );
50 |
@ -308,7 +308,7 @@ FAIL __tests__/failure.test.js
> 59 | expect(left).toBe(right);
| ^
60 | });
61 | }
61 | },
62 | );
at Object.toBe (__tests__/failure.test.js:59:20)
@ -325,7 +325,7 @@ FAIL __tests__/failure.test.js
> 59 | expect(left).toBe(right);
| ^
60 | });
61 | }
61 | },
62 | );
at Object.toBe (__tests__/failure.test.js:59:20)
@ -342,7 +342,7 @@ FAIL __tests__/failure.test.js
> 71 | expect(left).toBe(right);
| ^
72 | });
73 | }
73 | },
74 | );
at Object.toBe (__tests__/failure.test.js:71:20)
@ -359,7 +359,7 @@ FAIL __tests__/failure.test.js
> 71 | expect(left).toBe(right);
| ^
72 | });
73 | }
73 | },
74 | );
at Object.toBe (__tests__/failure.test.js:71:20)

View File

@ -138,7 +138,7 @@ FAIL __tests__/jasmine.objectContaining.test.js
9 | test('jasmine.objectContaining', () => {
10 | expect({input: 'trash', output: 'trash'}).toEqual(
> 11 | jasmine.objectContaining({output: 'trash'})
> 11 | jasmine.objectContaining({output: 'trash'}),
| ^
12 | );
13 | });

View File

@ -77,7 +77,7 @@ FAIL __tests__/failure.test.js
21 | it('fail with expected promise values and not', () =>
> 22 | expect(Promise.resolve([1, 2])).resolves.not.toHaveLengthAsync(
| ^
23 | Promise.resolve(2)
23 | Promise.resolve(2),
24 | ));
25 |

View File

@ -71,7 +71,7 @@ test('handles property matchers', () => {
Object {
"createdAt": Any<Date>,
}
\`
\`,
);
});
@ -85,7 +85,7 @@ expect({createdAt: "string"}).toMatchInlineSnapshot(
Object {
"createdAt": Any<Date>,
}
\`
\`,
);
});
`;
@ -98,7 +98,7 @@ test('handles property matchers', () => {
Object {
"createdAt": Any<Date>,
}
\`
\`,
);
});
@ -112,7 +112,7 @@ test('handles property matchers', () => {
Object {
"createdAt": Any<String>,
}
\`
\`,
);
});
@ -192,7 +192,7 @@ test('removes obsolete external snapshots', () => {
exports[`supports async matchers 1`] = `
test('inline snapshots', async () => {
expect(Promise.resolve('success')).resolves.toMatchInlineSnapshot(
\`"success"\`
\`"success"\`,
);
expect(Promise.reject('fail')).rejects.toMatchInlineSnapshot(\`"fail"\`);
});
@ -221,7 +221,7 @@ expect.extend({
createdAt: expect.any(Date),
id: expect.any(Number),
},
...args
...args,
);
},
});
@ -242,7 +242,7 @@ test('inline snapshots', () => {
"id": Any<Number>,
"name": "LeBron James",
}
\`
\`,
);
expect(user).toMatchUserInlineSnapshot(\`
Object {

View File

@ -3,7 +3,7 @@
exports[`should support rejecting promises 1`] = `
test('should support rejecting promises', async () => {
await expect(
Promise.reject(new Error('octopus'))
Promise.reject(new Error('octopus')),
).rejects.toThrowErrorMatchingInlineSnapshot(\`"octopus"\`);
});

View File

@ -8,6 +8,6 @@ const greet = require('../greet.hbs');
test('am', () => {
expect(greet({am: true, name: 'Joe'})).toEqual(
'<p>Good\n morning\nJoe!</p>\n'
'<p>Good\n morning\nJoe!</p>\n',
);
});

View File

@ -7,7 +7,7 @@
throw new Error(
`this error should not be a problem because` +
`this file is never required or executed`
`this file is never required or executed`,
);
// Flow annotations to make sure istanbul can instrument non ES6 source

View File

@ -13,7 +13,7 @@ class CustomSequencer extends Sequencer {
setTimeout(() => {
const copyTests = Array.from(tests);
resolve(
copyTests.sort((testA, testB) => (testA.path > testB.path ? 1 : -1))
copyTests.sort((testA, testB) => (testA.path > testB.path ? 1 : -1)),
);
}, 50);
});

View File

@ -23,5 +23,5 @@ describe.each([[false, true]])(
it('fails', () => {
expect(left).toBe(right);
});
}
},
);

View File

@ -13,7 +13,7 @@ it.each`
'throws exception when one argument too few are supplied $left == $right',
({left, right}) => {
expect(left).toBe(right);
}
},
);
it.each`
@ -23,5 +23,5 @@ it.each`
'throws exception when not enough arguments are supplied $left == $right',
({left, right}) => {
expect(left).toBe(right);
}
},
);

View File

@ -37,5 +37,5 @@ it.each`
'Should not be ran: fails all rows expected $left == $right',
({left, right}) => {
expect(left).toBe(right);
}
},
);

View File

@ -35,7 +35,7 @@ it.skip.each`
'Should not be ran: fails all rows expected $left == $right',
({left, right}) => {
expect(left).toBe(right);
}
},
);
describe.skip.each([

View File

@ -27,7 +27,7 @@ it.each`
'template table fails on one row expected: $left == $right',
({left, right}) => {
expect(left).toBe(right);
}
},
);
it.each`
@ -38,14 +38,14 @@ it.each`
'template table fails on all rows expected: $left == $right',
({left, right}) => {
expect(left).toBe(right);
}
},
);
test.each(['red', 'green', 'bean'])(
"The word %s contains the letter 'z'",
word => {
expect(/z/.test(word)).toBe(true);
}
},
);
describe.each`
@ -58,7 +58,7 @@ describe.each`
it('fails ', () => {
expect(left).toBe(right);
});
}
},
);
describe.each([
@ -70,5 +70,5 @@ describe.each([
it('fails', () => {
expect(left).toBe(right);
});
}
},
);

View File

@ -9,7 +9,7 @@ test.each(['red', 'green', 'bean'])(
"The word %s contains the letter 'e'",
word => {
expect(/e/.test(word)).toBe(true);
}
},
);
it.each([

View File

@ -8,6 +8,6 @@
test('jasmine.objectContaining', () => {
expect({input: 'trash', output: 'trash'}).toEqual(
jasmine.objectContaining({output: 'trash'})
jasmine.objectContaining({output: 'trash'}),
);
});

View File

@ -20,5 +20,5 @@ it('fail with expected promise values', () =>
it('fail with expected promise values and not', () =>
expect(Promise.resolve([1, 2])).resolves.not.toHaveLengthAsync(
Promise.resolve(2)
Promise.resolve(2),
));

View File

@ -20,5 +20,5 @@ it('works with expected promise values', () =>
it('works with expected promise values and not', () =>
expect(Promise.resolve([1, 2])).resolves.not.toHaveLengthAsync(
Promise.resolve(1)
Promise.resolve(1),
));

View File

@ -8,7 +8,7 @@
export async function toHaveLengthAsync(
received: any,
lengthPromise: Promise<number>
lengthPromise: Promise<number>,
) {
const length = await lengthPromise;

View File

@ -14,7 +14,7 @@ it('correctly expects RegExp inside a new VM context', () => {
`(function(require, module, exports, __dirname, __filename, expect) {
expect('ab12cd').toMatch(/ab12cd/);
})`,
global
global,
);
const module = {
@ -28,6 +28,6 @@ it('correctly expects RegExp inside a new VM context', () => {
module.exports,
__dirname,
__filename,
expect
expect,
);
});

View File

@ -15,7 +15,7 @@ describe('promise beforeAll', () => {
process.nextTick(resolve);
}).then(() => {
flag = 1;
})
}),
);
beforeAll(() => new Promise(resolve => setTimeout(resolve, 10)), 500);

View File

@ -13,7 +13,7 @@ describe('promise beforeEach', () => {
process.nextTick(resolve);
}).then(() => {
this.flag = 1;
})
}),
);
// passing tests

View File

@ -31,7 +31,7 @@ describe('promise it', () => {
new Promise(resolve => {
if (this.someContextValue !== 'value') {
throw new Error(
'expected this.someContextValue to be set: ' + this.someContextValue
'expected this.someContextValue to be set: ' + this.someContextValue,
);
}
resolve();
@ -90,13 +90,13 @@ describe('promise it', () => {
it(
'succeeds if the test finishes in time',
() => new Promise(resolve => setTimeout(resolve, 10)),
250
250,
);
// failing tests
it(
'fails if a custom timeout is exceeded',
() => new Promise(resolve => setTimeout(resolve, 100)),
10
10,
);
});

View File

@ -21,7 +21,7 @@ test('should have correct import.meta', () => {
url: expect.any(String),
});
expect(
import.meta.url.endsWith('/e2e/native-esm/__tests__/native-esm.test.js')
import.meta.url.endsWith('/e2e/native-esm/__tests__/native-esm.test.js'),
).toBe(true);
});

View File

@ -12,7 +12,7 @@ global.testObject = new Proxy(
get: function getter(target, key) {
return key;
},
}
},
);
test('jest.resetModules should not error when _isMockFunction is defined but not boolean', () => {
jest.resetModules();

View File

@ -10,19 +10,19 @@ import {resolve} from 'path';
test('finds a module relative to one of the given paths', () => {
expect(require.resolve('./mod.js', {paths: ['../dir']})).toEqual(
resolve(__dirname, '..', 'dir', 'mod.js')
resolve(__dirname, '..', 'dir', 'mod.js'),
);
});
test('finds a module without a leading "./" relative to one of the given paths', () => {
expect(require.resolve('mod.js', {paths: ['../dir']})).toEqual(
resolve(__dirname, '..', 'dir', 'mod.js')
resolve(__dirname, '..', 'dir', 'mod.js'),
);
});
test('finds a node_module above one of the given paths', () => {
expect(require.resolve('mod', {paths: ['../dir']})).toEqual(
resolve(__dirname, '..', 'node_modules', 'mod', 'index.js')
resolve(__dirname, '..', 'node_modules', 'mod', 'index.js'),
);
});
@ -32,12 +32,12 @@ test('finds a native node module when paths are given', () => {
test('throws an error if the module cannot be found from given paths', () => {
expect(() => require.resolve('./mod.js', {paths: ['..']})).toThrowError(
"Cannot resolve module './mod.js' from paths ['..'] from "
"Cannot resolve module './mod.js' from paths ['..'] from ",
);
});
test('throws module not found error if the module cannot be found from given paths', () => {
expect(() => require.resolve('./mod.js', {paths: ['..']})).toThrow(
expect.objectContaining({code: 'MODULE_NOT_FOUND'})
expect.objectContaining({code: 'MODULE_NOT_FOUND'}),
);
});

View File

@ -66,7 +66,7 @@ test('should resolve filename.json', () => {
test('should preserve identity for symlinks', () => {
expect(require('../../../packages/jest-resolve')).toBe(
require('jest-resolve')
require('jest-resolve'),
);
});
@ -113,7 +113,7 @@ test('should throw module not found error if the module has dependencies that ca
Test7.js
__tests__/resolve.test.js\n
`,
})
}),
);
});
@ -122,6 +122,6 @@ test('should throw module not found error if the module cannot be found', () =>
expect.objectContaining({
code: 'MODULE_NOT_FOUND',
message: "Cannot find module 'Test8' from 'resolve.test.js'",
})
}),
);
});

View File

@ -30,7 +30,7 @@ describe('snapshot', () => {
it('cannot be used with .not', () => {
expect(() => expect('').not.toMatchSnapshot()).toThrow(
'Snapshot matchers cannot be used with not'
'Snapshot matchers cannot be used with not',
);
});

View File

@ -17,7 +17,7 @@ module.exports = {
module: tsc.ModuleKind.CommonJS,
},
path,
[]
[],
);
}
return src;

View File

@ -8,7 +8,7 @@ const getTitleFn = jest.fn().mockReturnValue(title);
const dataServiceSpy = jest.fn().mockImplementation(
(): Partial<DataService> => ({
getTitle: getTitleFn,
})
}),
);
describe('AppComponent', () => {
@ -36,7 +36,7 @@ describe('AppComponent', () => {
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain(
`Welcome to ${title}!`
`Welcome to ${title}!`,
);
});
});

View File

@ -14,5 +14,5 @@ const testingModule = require('@angular/platform-browser-dynamic/testing');
getTestBed().initTestEnvironment(
testingModule.BrowserDynamicTestingModule,
testingModule.platformBrowserDynamicTesting()
testingModule.platformBrowserDynamicTesting(),
);

View File

@ -15,7 +15,7 @@ export default function request(url) {
? resolve(users[userID])
: reject({
error: 'User with ' + userID + ' not found.',
})
}),
);
});
}

View File

@ -45,7 +45,7 @@ test('tests error with promises', async () => {
return user.getUserName(2).catch(e =>
expect(e).toEqual({
error: 'User with 2 not found.',
})
}),
);
});

View File

@ -18,7 +18,7 @@ describe('listFilesInDirectorySync', () => {
it('includes all files in the directory in the summary', () => {
const FileSummarizer = require('../FileSummarizer');
const fileSummary = FileSummarizer.summarizeFilesInDirectorySync(
'/path/to'
'/path/to',
);
expect(fileSummary.length).toBe(2);

View File

@ -52,7 +52,7 @@ it('renders the FlatList component', () => {
data={['apple', 'banana', 'kiwi']}
keyExtractor={item => item}
renderItem={({item}) => <Text>{item}</Text>}
/>
/>,
)
.toJSON();
expect(tree).toMatchSnapshot();

View File

@ -10,7 +10,7 @@ afterEach(cleanup);
it('CheckboxWithLabel changes the text after click', () => {
const {queryByLabelText, getByLabelText} = render(
<CheckboxWithLabel labelOn="On" labelOff="Off" />
<CheckboxWithLabel labelOn="On" labelOff="Off" />,
);
expect(queryByLabelText(/off/i)).toBeTruthy();

View File

@ -15,7 +15,7 @@ it('CheckboxWithLabel changes the text after click', () => {
inputRef={checkboxInputRef}
labelOn="On"
labelOff="Off"
/>
/>,
);
const labelNode = checkboxLabelRef.current;

View File

@ -27,7 +27,7 @@ it('properly escapes quotes', () => {
it('changes the class when hovered', () => {
const component = renderer.create(
<Link page="http://www.facebook.com">Facebook</Link>
<Link page="http://www.facebook.com">Facebook</Link>,
);
let tree = component.toJSON();
expect(tree).toMatchSnapshot();

View File

@ -15,7 +15,7 @@ it('CheckboxWithLabel changes the text after click', () => {
inputRef={checkboxInputRef}
labelOn="On"
labelOff="Off"
/>
/>,
);
const labelNode = checkboxLabelRef.current;

View File

@ -74,6 +74,7 @@
"realpath-native": "^2.0.0",
"resolve": "^1.15.0",
"rimraf": "^3.0.0",
"semver": "^6.3.0",
"slash": "^3.0.0",
"string-length": "^3.1.0",
"strip-ansi": "^6.0.0",
@ -126,22 +127,8 @@
"arrowParens": "avoid",
"overrides": [
{
"excludeFiles": [
"e2e/__tests__/**/*",
"website/versioned_docs/**/*.md"
],
"files": [
"examples/**/*",
"scripts/**/*",
"e2e/*/**/*",
"website/*.js",
"website/*/**/*",
"eslintImportResolver.js",
"babel.config.js"
],
"files": "website/**/*.js",
"options": {
"printWidth": 80,
"singleQuote": true,
"trailingComma": "es5"
}
}

View File

@ -19,5 +19,8 @@
"ansi-regex": "^5.0.0",
"ansi-styles": "^4.1.0",
"semver": "^6.3.0"
},
"engines": {
"node": ">= 8.3"
}
}

View File

@ -70,7 +70,7 @@ module.exports = ({template}) => {
path.node.name === 'fs' &&
path.parent.property &&
['readFileSync', 'writeFileSync', 'existsSync'].includes(
path.parent.property.name
path.parent.property.name,
)
) {
if (

View File

@ -23,7 +23,7 @@ module.exports = ({template}) => {
moduleExportsDeclaration({
IMPORT: node.moduleReference.expression,
NAME: node.id,
})
}),
);
},
},

View File

@ -62,7 +62,7 @@ function browserBuild(pkgName, entryPath, destination) {
alias: {
chalk: path.resolve(
__dirname,
'../packages/expect/build/fakeChalk.js'
'../packages/expect/build/fakeChalk.js',
),
},
extensions: ['.js', '.json', '.ts'],
@ -78,7 +78,7 @@ function browserBuild(pkgName, entryPath, destination) {
return;
}
resolve(stats);
}
},
);
});
}

View File

@ -84,7 +84,7 @@ function buildBrowserPackage(p) {
if (browser) {
if (browser.indexOf(BUILD_ES5_DIR) !== 0) {
throw new Error(
`browser field for ${pkgJsonPath} should start with "${BUILD_ES5_DIR}"`
`browser field for ${pkgJsonPath} should start with "${BUILD_ES5_DIR}"`,
);
}
let indexFile = path.resolve(srcDir, 'index.js');
@ -113,7 +113,7 @@ function buildFile(file, silent) {
process.stdout.write(
chalk.dim(' \u2022 ') +
path.relative(PACKAGES_DIR, file) +
' (ignore)\n'
' (ignore)\n',
);
return;
}
@ -131,7 +131,7 @@ function buildFile(file, silent) {
chalk.red(' \u21D2 ') +
path.relative(PACKAGES_DIR, destPath) +
' (copy)' +
'\n'
'\n',
);
} else {
const options = Object.assign({}, transformOptions);
@ -141,7 +141,7 @@ function buildFile(file, silent) {
// The modules in the blacklist are injected into the user's sandbox
// We need to guard some globals there.
options.plugins.push(
require.resolve('./babel-plugin-jest-native-globals')
require.resolve('./babel-plugin-jest-native-globals'),
);
} else {
options.plugins = options.plugins.map(plugin => {
@ -174,7 +174,7 @@ function buildFile(file, silent) {
path.relative(PACKAGES_DIR, file) +
chalk.green(' \u21D2 ') +
path.relative(PACKAGES_DIR, destPath) +
'\n'
'\n',
);
}
}

View File

@ -7,6 +7,7 @@
'use strict';
const assert = require('assert');
const fs = require('fs');
const os = require('os');
const path = require('path');
@ -20,25 +21,23 @@ const {getPackages} = require('./buildUtils');
const packages = getPackages();
const packagesWithTs = packages.filter(p =>
fs.existsSync(path.resolve(p, 'tsconfig.json'))
fs.existsSync(path.resolve(p, 'tsconfig.json')),
);
packagesWithTs.forEach(pkgDir => {
const pkg = require(pkgDir + '/package.json');
if (!pkg.types) {
throw new Error(`Package ${pkg.name} is missing \`types\` field`);
}
assert.ok(pkg.types, `Package ${pkg.name} is missing \`types\` field`);
assert.ok(
pkg.typesVersions,
`Package ${pkg.name} is missing \`typesVersions\` field`,
);
if (!pkg.typesVersions) {
throw new Error(`Package ${pkg.name} is missing \`typesVersions\` field`);
}
if (pkg.main.replace(/\.js$/, '.d.ts') !== pkg.types) {
throw new Error(
`\`main\` and \`types\` field of ${pkg.name} does not match`
);
}
assert.equal(
pkg.types,
pkg.main.replace(/\.js$/, '.d.ts'),
`\`main\` and \`types\` field of ${pkg.name} does not match`,
);
});
const args = [
@ -54,11 +53,11 @@ console.log(chalk.inverse(' Building TypeScript definition files '));
try {
execa.sync('yarn', args, {stdio: 'inherit'});
console.log(
chalk.inverse.green(' Successfully built TypeScript definition files ')
chalk.inverse.green(' Successfully built TypeScript definition files '),
);
} catch (e) {
console.error(
chalk.inverse.red(' Unable to build TypeScript definition files ')
chalk.inverse.red(' Unable to build TypeScript definition files '),
);
console.error(e.stack);
process.exitCode = 1;
@ -79,19 +78,19 @@ Promise.all(
rimraf.sync(path.resolve(pkgDir, 'build/ts3.4'));
return execa('yarn', downlevelArgs, {cwd: pkgDir, stdio: 'inherit'});
})
)
}),
),
)
.then(() => {
console.log(
chalk.inverse.green(
' Successfully downleveled TypeScript definition files '
)
' Successfully downleveled TypeScript definition files ',
),
);
})
.catch(e => {
console.error(
chalk.inverse.red(' Unable to downlevel TypeScript definition files ')
chalk.inverse.red(' Unable to downlevel TypeScript definition files '),
);
console.error(e.stack);
process.exitCode = 1;

View File

@ -5,10 +5,14 @@
* LICENSE file in the root directory of this source tree.
*/
'use strict';
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const chalk = require('chalk');
const stringLength = require('string-length');
const rootPackage = require('../package.json');
const PACKAGES_DIR = path.resolve(__dirname, '../packages');
@ -16,10 +20,26 @@ const OK = chalk.reset.inverse.bold.green(' DONE ');
// Get absolute paths of all directories under packages/*
module.exports.getPackages = function getPackages() {
return fs
const packages = fs
.readdirSync(PACKAGES_DIR)
.map(file => path.resolve(PACKAGES_DIR, file))
.filter(f => fs.lstatSync(path.resolve(f)).isDirectory());
const nodeEngineRequiremnt = rootPackage.engines.node;
packages.forEach(packageDir => {
const pkg = require(`${packageDir}/package.json`);
assert.ok(pkg.engines, `Engine requirement in ${pkg.name} should exist`);
assert.equal(
pkg.engines.node,
nodeEngineRequiremnt,
`Engine requirement in ${pkg.name} should match root`,
);
});
return packages;
};
module.exports.adjustToTerminalWidth = function adjustToTerminalWidth(str) {

View File

@ -140,7 +140,7 @@ function check() {
!IGNORED_PATTERNS.some(pattern => pattern.test(file)) &&
!isDirectory(file) &&
!isBinaryFileSync(file) &&
needsCopyrightHeader(file)
needsCopyrightHeader(file),
);
if (invalidFiles.length > 0) {

View File

@ -35,17 +35,17 @@ const map = istanbulCoverage.createCoverageMap();
const mapFileCoverage = fileCoverage => {
fileCoverage.path = fileCoverage.path.replace(
/(.*packages\/.*\/)(build)(\/.*)/,
'$1src$3'
'$1src$3',
);
return fileCoverage;
};
Object.keys(coverage).forEach(filename =>
map.addFileCoverage(mapFileCoverage(coverage[filename]))
map.addFileCoverage(mapFileCoverage(coverage[filename])),
);
const context = istanbulReport.createContext({coverageMap: map});
['json', 'lcov', 'text'].forEach(reporter =>
istanbulReports.create(reporter, {}).execute(context)
istanbulReports.create(reporter, {}).execute(context),
);

View File

@ -35,16 +35,16 @@ try {
execa.sync('yarn', ['add', 'typescript@~3.4'], {cwd, stdio: 'inherit'});
fs.writeFileSync(
path.join(cwd, 'tsconfig.json'),
JSON.stringify(tsConfig, null, 2)
JSON.stringify(tsConfig, null, 2),
);
fs.writeFileSync(
path.join(cwd, 'index.ts'),
`import jest = require('${jestDirectory}');`
`import jest = require('${jestDirectory}');`,
);
execa.sync('yarn', ['tsc', '--project', '.'], {cwd, stdio: 'inherit'});
console.log(
chalk.inverse.green(' Successfully compiled Jest with TypeScript 3.4 ')
chalk.inverse.green(' Successfully compiled Jest with TypeScript 3.4 '),
);
} finally {
rimraf.sync(cwd);

View File

@ -34,7 +34,7 @@ chokidar
{
ignoreInitial: true,
ignored: /(^|[\/\\])\../, // ignore dotfiles
}
},
)
.on('all', (event, filePath) => {
if (
@ -43,7 +43,7 @@ chokidar
) {
console.log(
chalk.green('->'),
`${event}: ${path.relative(PACKAGES_DIR, filePath)}`
`${event}: ${path.relative(PACKAGES_DIR, filePath)}`,
);
rebuild(filePath);
} else {
@ -51,7 +51,7 @@ chokidar
const buildFile = filePath
.replace(
path.join(path.sep, 'src', path.sep),
path.join(path.sep, 'build', path.sep)
path.join(path.sep, 'build', path.sep),
)
.replace(/\.ts$/, '.js');
try {
@ -59,8 +59,8 @@ chokidar
process.stdout.write(
`${chalk.red(' \u2022 ')}${path.relative(
PACKAGES_DIR,
buildFile
)} (deleted)\n`
buildFile,
)} (deleted)\n`,
);
} catch (e) {}
}