forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Setup for Circle 2 * Try to reuse config * Fix aliases and add browser build * Adjust config * Fix save-cache alias * Add website/node_modules to alias cache * Change browser docker * Add working_directory * add yarn-install-no-sudo * Remove environment * Actually skip react-native example on Node 4 * Declare transitive deps in corresponding package.json * Install node 4 deps with yarn * Setup import/no-extraneous-dependencies rule
- Loading branch information
Showing
13 changed files
with
261 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
aliases: | ||
- &restore-cache | ||
keys: | ||
- dependencies-{{ .Branch }}-{{ checksum "package.json" }} | ||
# Fallback in case checksum fails | ||
- dependencies-{{ .Branch }}- | ||
|
||
- &save-cache | ||
paths: | ||
- node_modules | ||
- website/node_modules | ||
key: dependencies-{{ .Branch }}-{{ checksum "package.json" }} | ||
|
||
- &yarn-install | ||
run: | | ||
sudo npm i -g yarn@^0.27.5 | ||
yarn --no-progress | ||
- &yarn-install-no-sudo | ||
run: | | ||
npm i -g yarn@^0.27.5 | ||
yarn --no-progress | ||
- &deploy | ||
command: | | ||
# Deploy Jest website | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Website Deployment Script" | ||
echo "machine github.com login jest-bot password $GITHUB_TOKEN" > ~/.netrc | ||
# crowdin install start | ||
sudo apt-get install default-jre | ||
wget https://artifacts.crowdin.com/repo/deb/crowdin.deb -O crowdin.deb | ||
sudo dpkg -i crowdin.deb | ||
# crowdin install end | ||
crowdin --config crowdin.yaml upload sources --auto-update -b master | ||
crowdin --config crowdin.yaml download -b master | ||
cd website && GIT_USER=jest-bot npm run gh-pages | ||
version: 2 | ||
jobs: | ||
test-browser: | ||
working_directory: ~/jest | ||
docker: | ||
- image: markhobson/node-chrome | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-cache | ||
- *yarn-install-no-sudo | ||
- save-cache: *save-cache | ||
- run: yarn run test-ci-es5-build-in-browser | ||
|
||
test-node-8: | ||
working_directory: ~/jest | ||
docker: | ||
- image: circleci/node:8.1.4 | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-cache | ||
- *yarn-install | ||
- save-cache: *save-cache | ||
- run: yarn run test-ci-partial | ||
|
||
test-node-6: | ||
working_directory: ~/jest | ||
docker: | ||
- image: circleci/node:6.11.0 | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-cache | ||
- *yarn-install | ||
- save-cache: *save-cache | ||
- run: yarn run test-ci | ||
|
||
test-node-4: | ||
working_directory: ~/jest | ||
docker: | ||
- image: circleci/node:4.8.4 | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-cache | ||
- *yarn-install | ||
- save-cache: *save-cache | ||
- run: npm run test-ci-partial | ||
|
||
test-and-deploy-website: | ||
working_directory: ~/jest | ||
docker: | ||
- image: circleci/node:8.1.4 | ||
steps: | ||
- checkout | ||
- restore-cache: *restore-cache | ||
- run: sudo npm i -g yarn@^0.27.5 | ||
- run: | | ||
cd website | ||
yarn --no-progress | ||
- save-cache: *save-cache | ||
- run: | | ||
cd website | ||
yarn run test | ||
- deploy: *deploy | ||
|
||
# Workflows enables us to run multiple jobs in parallel | ||
workflows: | ||
version: 2 | ||
build-and-deploy: | ||
jobs: | ||
- test-node-8 | ||
- test-node-6 | ||
- test-node-4 | ||
- test-browser | ||
- test-and-deploy-website |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** | ||
* Copyright (c) 2014, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* Adapted from node resolver: https://github.com/benmosher/eslint-plugin-import/tree/master/resolvers/node | ||
* | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const resolve = require('resolve'); | ||
const path = require('path'); | ||
|
||
const log = require('debug')('eslint-plugin-import:resolver:node'); | ||
|
||
module.exports.interfaceVersion = 2; | ||
|
||
module.exports.resolve = function(source, file, config) { | ||
log('Resolving:', source, 'from:', file); | ||
let resolvedPath; | ||
|
||
if (resolve.isCore(source)) { | ||
log('resolved to core'); | ||
return {found: true, path: null}; | ||
} | ||
|
||
source = applyModuleNameMapper(source, config); | ||
|
||
try { | ||
resolvedPath = resolve.sync(source, opts(file, config)); | ||
log('Resolved to:', resolvedPath); | ||
return {found: true, path: resolvedPath}; | ||
} catch (err) { | ||
log('resolve threw error:', err); | ||
return {found: false}; | ||
} | ||
}; | ||
|
||
function opts(file, config) { | ||
return Object.assign( | ||
{ | ||
// more closely matches Node (#333) | ||
extensions: ['.js', '.json'], | ||
}, | ||
config, | ||
{ | ||
// path.resolve will handle paths relative to CWD | ||
basedir: path.dirname(path.resolve(file)), | ||
packageFilter, | ||
} | ||
); | ||
} | ||
|
||
function packageFilter(pkg) { | ||
if (pkg['jsnext:main']) { | ||
pkg['main'] = pkg['jsnext:main']; | ||
} | ||
return pkg; | ||
} | ||
|
||
function applyModuleNameMapper(source, config) { | ||
Object.keys(config.moduleNameMapper).forEach(regex => { | ||
const mappedModuleName = config.moduleNameMapper[regex]; | ||
|
||
if (source.match(regex)) { | ||
const matches = source.match(regex); | ||
if (!matches) { | ||
source = mappedModuleName; | ||
} else { | ||
source = mappedModuleName.replace( | ||
/\$([0-9]+)/g, | ||
(_, index) => matches[parseInt(index, 10)] | ||
); | ||
} | ||
source = path.resolve(source); | ||
} | ||
}); | ||
|
||
return source; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.